白蚁-bug修改

master
yangzhe123 2025-09-04 16:39:08 +08:00
parent b8c07682b9
commit 5d234dc250
5 changed files with 21 additions and 11 deletions

View File

@ -63,6 +63,9 @@ public class ByPlanController extends AbstractCommonFileController{
}
dto.setId(IdWorker.getId());
List<ByPlanDetail> byPlanDetail = dto.getByPlanDetail();
if(byPlanDetail == null || byPlanDetail.isEmpty()){
throw new IllegalArgumentException("防止部位至少需要一条数据");
}
byPlanDetail.forEach(detail -> {
detail.setId(IdWorker.getId());
});

View File

@ -56,9 +56,9 @@ public class PrePlaceController {
@Operation(summary = "列表")
@GetMapping("/list")
public List<PrePlace> list() {
public R<List<PrePlace>> list() {
List<PrePlace> list = prePlaceService.lambdaQuery().orderByAsc(PrePlace::getCreateTime).list();
return list;
return R.ok(list);
}
@ -78,9 +78,9 @@ public class PrePlaceController {
@Operation(summary = "防治部位列表")
@GetMapping("/detail/list")
public List<PrePlaceDetail> detailList() {
public R<List<PrePlaceDetail>> detailList() {
List<PrePlaceDetail> list = prePlaceDetailService.lambdaQuery().orderByAsc(PrePlaceDetail::getOrder).list();
return list;
return R.ok(list);
}
@Operation(summary = "防治部位列表")

View File

@ -22,7 +22,7 @@ public interface ByPlanDetailMapper extends BaseMapper<ByPlanDetail> {
join pre_place_detail t2 on t1.pre_place_detail_id = t2.id and t2.is_enable = 0
join pre_place t3 on t2.pre_id = t3.id
where 1=1 and t1.plan_id = #{planId}
<if test= "dto.dto.preDetailName !=null and dto.dto.preDetailName !=''">
<if test= "dto.preDetailName !=null and dto.preDetailName !=''">
and t2.detail_name LIKE '%'|| #{dto.preDetailName}||'%'
</if>
</script>

View File

@ -56,8 +56,12 @@ public class ByPlanService extends ServiceImpl<ByPlanMapper, ByPlan> {
}
boolean save = updateById(dto);
List<ByPlanDetail> byPlanDetail = dto.getByPlanDetail();
if(byPlanDetail == null || byPlanDetail.isEmpty()){
throw new IllegalArgumentException("防止部位至少需要一条数据");
}
byPlanDetail.forEach(detail -> {
detail.setId(IdWorker.getId());
detail.setPlanId(dto.getPlanId());
});
LambdaQueryWrapper<ByPlanDetail> queryWrapper2 = new LambdaQueryWrapper<>();
//先删除,再新增
@ -79,15 +83,17 @@ public class ByPlanService extends ServiceImpl<ByPlanMapper, ByPlan> {
while(iterator.hasNext()){
ByPlan entity = iterator.next();
List<ByPlanDetail> details = byPlanDetailMapper.selectList(entity.getPlanId(),dto);
if(details.isEmpty()){
if (!StringUtils.isBlank(dto.getPreDetailName()) && details.isEmpty()) {
iterator.remove();
continue;
}
entity.setByPlanDetail(details);
//根据用户id查询用户名称
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(entity.getUserId()));
if(sysUser != null){
entity.setUserName(sysUser.getUserName());
if(entity.getUserId() != null){
SysUser sysUser = sysUserMapper.selectUserById(Long.valueOf(entity.getUserId()));
if(sysUser != null){
entity.setUserName(sysUser.getUserName());
}
}
}
return byPlanPage;

View File

@ -36,8 +36,8 @@ public class PrePlaceService extends ServiceImpl<PrePlaceMapper, PrePlace> {
if(count > 0){
throw new RuntimeException("该防治点,还有防治部位未删,请检查");
}
boolean res = deleteById(id);
return res;
int flag = this.baseMapper.deleteById(id);
return flag > 0? true:false;
}
@ -55,6 +55,7 @@ public class PrePlaceService extends ServiceImpl<PrePlaceMapper, PrePlace> {
queryWrapper.like(PrePlaceDetail::getDetailName, dto.getPreDetailName());
}
queryWrapper.eq(PrePlaceDetail::getPreId, prePlace.getId());
queryWrapper.eq(PrePlaceDetail::getIsEnable,0);
List<PrePlaceDetail> prePlaceDetails = prePlaceDetailMapper.selectList(queryWrapper);
if(prePlaceDetails.isEmpty()){
iterator.remove();