|
@@ -1,13 +1,14 @@
|
|
|
package com.zksy.property.service.impl;
|
|
package com.zksy.property.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zksy.property.domain.AHouseType;
|
|
import com.zksy.property.domain.AHouseType;
|
|
|
import com.zksy.property.domain.ARoom;
|
|
import com.zksy.property.domain.ARoom;
|
|
|
-import com.zksy.property.service.AHouseTypeService;
|
|
|
|
|
import com.zksy.property.mapper.AHouseTypeMapper;
|
|
import com.zksy.property.mapper.AHouseTypeMapper;
|
|
|
|
|
+import com.zksy.property.service.AHouseTypeService;
|
|
|
import com.zksy.property.service.ARoomService;
|
|
import com.zksy.property.service.ARoomService;
|
|
|
import com.zksy.service.MinioFileStorageService;
|
|
import com.zksy.service.MinioFileStorageService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -15,17 +16,16 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
-import javax.annotation.Resource;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
-* @author Administrator
|
|
|
|
|
-* @description 针对表【a_house_type(户型表)】的数据库操作Service实现
|
|
|
|
|
-* @createDate 2025-06-24 16:24:28
|
|
|
|
|
-*/
|
|
|
|
|
|
|
+ * @author Administrator
|
|
|
|
|
+ * @description 针对表【a_house_type(户型表)】的数据库操作Service实现
|
|
|
|
|
+ * @createDate 2025-06-24 16:24:28
|
|
|
|
|
+ */
|
|
|
@Service
|
|
@Service
|
|
|
public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseType>
|
|
public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseType>
|
|
|
- implements AHouseTypeService{
|
|
|
|
|
|
|
+ implements AHouseTypeService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private AHouseTypeMapper mapper;
|
|
private AHouseTypeMapper mapper;
|
|
@@ -33,20 +33,21 @@ public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseT
|
|
|
private MinioFileStorageService minioFileStorageService;
|
|
private MinioFileStorageService minioFileStorageService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private ARoomService roomService;
|
|
private ARoomService roomService;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public List<AHouseType> getHouseTypeList(String accountNumber) {
|
|
public List<AHouseType> getHouseTypeList(String accountNumber) {
|
|
|
LambdaQueryWrapper<AHouseType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<AHouseType> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- lambdaQueryWrapper.like(accountNumber != null,AHouseType::getAccountNumber,accountNumber);
|
|
|
|
|
|
|
+ lambdaQueryWrapper.like(accountNumber != null, AHouseType::getAccountNumber, accountNumber);
|
|
|
lambdaQueryWrapper.orderByDesc(AHouseType::getUpdateTime);
|
|
lambdaQueryWrapper.orderByDesc(AHouseType::getUpdateTime);
|
|
|
List<AHouseType> list = mapper.selectList(lambdaQueryWrapper);
|
|
List<AHouseType> list = mapper.selectList(lambdaQueryWrapper);
|
|
|
return list;
|
|
return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Page<AHouseType> findByPage(long pageNum, long pageSize, String accountNumber){
|
|
|
|
|
- Page<AHouseType> page = new Page<>(pageNum,pageSize);
|
|
|
|
|
|
|
+ public Page<AHouseType> findByPage(long pageNum, long pageSize, String accountNumber) {
|
|
|
|
|
+ Page<AHouseType> page = new Page<>(pageNum, pageSize);
|
|
|
QueryWrapper<AHouseType> queryWrapper = new QueryWrapper();
|
|
QueryWrapper<AHouseType> queryWrapper = new QueryWrapper();
|
|
|
- queryWrapper.like(accountNumber != null ,"account_number",accountNumber);
|
|
|
|
|
|
|
+ queryWrapper.like(accountNumber != null, "account_number", accountNumber);
|
|
|
queryWrapper.orderByDesc("update_time");
|
|
queryWrapper.orderByDesc("update_time");
|
|
|
Page<AHouseType> page1 = mapper.selectPage(page, queryWrapper);
|
|
Page<AHouseType> page1 = mapper.selectPage(page, queryWrapper);
|
|
|
return page1;
|
|
return page1;
|
|
@@ -61,7 +62,7 @@ public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseT
|
|
|
houseType.setAccountUrl(path);
|
|
houseType.setAccountUrl(path);
|
|
|
}
|
|
}
|
|
|
return save(houseType);
|
|
return save(houseType);
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException("保存失败");
|
|
throw new RuntimeException("保存失败");
|
|
|
}
|
|
}
|
|
@@ -78,7 +79,7 @@ public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseT
|
|
|
houseType.setAccountUrl(path);
|
|
houseType.setAccountUrl(path);
|
|
|
}
|
|
}
|
|
|
return updateById(houseType);
|
|
return updateById(houseType);
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException("修改失败");
|
|
throw new RuntimeException("修改失败");
|
|
|
}
|
|
}
|
|
@@ -89,8 +90,8 @@ public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseT
|
|
|
public boolean removeBatchHouseType(String[] ids) {
|
|
public boolean removeBatchHouseType(String[] ids) {
|
|
|
try {
|
|
try {
|
|
|
for (String id : ids) {
|
|
for (String id : ids) {
|
|
|
- List<ARoom> houseTypeIds = roomService.getByHouseTypeId( id);
|
|
|
|
|
- if(houseTypeIds != null){
|
|
|
|
|
|
|
+ List<ARoom> houseTypeIds = roomService.getByHouseTypeId(id);
|
|
|
|
|
+ if (CollUtil.isNotEmpty(houseTypeIds)) {
|
|
|
throw new RuntimeException("请先删除该户型下的所有房间");
|
|
throw new RuntimeException("请先删除该户型下的所有房间");
|
|
|
}
|
|
}
|
|
|
AHouseType houseType = getById(id);
|
|
AHouseType houseType = getById(id);
|
|
@@ -100,11 +101,18 @@ public class AHouseTypeServiceImpl extends ServiceImpl<AHouseTypeMapper, AHouseT
|
|
|
removeById(id);
|
|
removeById(id);
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
- }catch (Exception e){
|
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
throw new RuntimeException("删除失败");
|
|
throw new RuntimeException("删除失败");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<AHouseType> getByRoomType(Integer roomType) {
|
|
|
|
|
+ LambdaQueryWrapper<AHouseType> aHouseTypeLambdaQueryWrapper = new LambdaQueryWrapper<AHouseType>()
|
|
|
|
|
+ .eq(AHouseType::getRoomType, roomType);
|
|
|
|
|
+ return mapper.selectList(aHouseTypeLambdaQueryWrapper);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|