|
@@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 服务实现类
|
|
|
+ * 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
* @author author
|
|
@@ -41,8 +41,8 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Result addBuilding(BaseBuilding baseBuilding) {
|
|
|
- if (this.count(new QueryWrapper<BaseBuilding>().eq("build_name",baseBuilding.getBuildName())) != 0) {
|
|
|
- return new Result(10001,"栋舍名已存在",false);
|
|
|
+ if (this.count(new QueryWrapper<BaseBuilding>().eq("build_name", baseBuilding.getBuildName())) != 0) {
|
|
|
+ return new Result(10001, "栋舍名已存在", false);
|
|
|
}
|
|
|
baseBuilding.setParentId(0);
|
|
|
baseBuilding.setFType(1);
|
|
@@ -53,8 +53,8 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Result updateBuilding(BaseBuilding baseBuilding) {
|
|
|
- if (this.count(new QueryWrapper<BaseBuilding>().eq("build_name",baseBuilding.getBuildName()).ne("id",baseBuilding.getId())) != 0) {
|
|
|
- return new Result(10001,"栋舍名已存在",false);
|
|
|
+ if (this.count(new QueryWrapper<BaseBuilding>().eq("build_name", baseBuilding.getBuildName()).ne("id", baseBuilding.getId())) != 0) {
|
|
|
+ return new Result(10001, "栋舍名已存在", false);
|
|
|
}
|
|
|
//TODO:后面补充羊只和设备的名称修改
|
|
|
baseBuildingMapper.updateById(baseBuilding);
|
|
@@ -65,7 +65,6 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
@Transactional
|
|
|
public Result deleteBuilding(Map<String, Integer> map) {
|
|
|
Integer id = map.get("id");
|
|
|
- List<Integer> cageIds = baseBuildingMapper.getCageById(id);
|
|
|
//TODO:后面再进行补充羊只和设备情况
|
|
|
// if (ObjectUtil.isNotEmpty(cageIds)){
|
|
|
// if (ObjectUtil.isNotEmpty(baseDuckInfoMapper.selectList(new QueryWrapper<BaseDuckInfo>().in("unit_id",cageIds)))) {
|
|
@@ -78,11 +77,9 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
// if (ObjectUtil.isNotEmpty(envDeviceMapper.selectList(new QueryWrapper<EnvDevice>().eq("unit_id",id)))) {
|
|
|
// return new Result(10001,"删除失败,该栋舍存在设备",false);
|
|
|
// }
|
|
|
- if (this.removeById(id) && this.removeByIds(cageIds)){
|
|
|
- return new Result(10000, "删除成功", true);
|
|
|
- }else {
|
|
|
- return new Result(10001, "删除失败", true);
|
|
|
- }
|
|
|
+ this.removeById(id);
|
|
|
+ return new Result(10000, "删除成功", true);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -91,7 +88,7 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
QueryWrapper<BaseBuilding> queryWrapper = new QueryWrapper<BaseBuilding>()
|
|
|
.eq("farm_id", farmId)
|
|
|
.eq("f_type", 1);
|
|
|
- return new Result(ResultCode.SUCCESS,baseBuildingMapper.selectList(queryWrapper));
|
|
|
+ return new Result(ResultCode.SUCCESS, baseBuildingMapper.selectList(queryWrapper));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -100,7 +97,7 @@ public class BaseBuildingServiceImpl extends ServiceImpl<BaseBuildingMapper, Bas
|
|
|
List<BaseBuilding> baseBuildings = this.list(new QueryWrapper<BaseBuilding>()
|
|
|
.eq("farm_id", farmId)
|
|
|
.orderByAsc("id"));
|
|
|
- return new Result(ResultCode.SUCCESS,baseBuildings);
|
|
|
+ return new Result(ResultCode.SUCCESS, baseBuildings);
|
|
|
}
|
|
|
|
|
|
}
|