|
|
|
@ -48,7 +48,6 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 巡检对象控制器 |
|
|
|
* 巡检对象控制器 |
|
|
|
* |
|
|
|
|
|
|
|
* @author ninglong |
|
|
|
* @author ninglong |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@ -168,7 +167,7 @@ public class ObjectController extends BladeController { |
|
|
|
qw.lambda().in(PlanObjectTemplateEntity::getObjectId,delIdList); |
|
|
|
qw.lambda().in(PlanObjectTemplateEntity::getObjectId,delIdList); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
if(count>0) { |
|
|
|
if(count>0) { |
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
return R.fail("该巡检对象已被巡检模板引用,无法删除"); |
|
|
|
} |
|
|
|
} |
|
|
|
for (Long aLong : delIdList) { |
|
|
|
for (Long aLong : delIdList) { |
|
|
|
objectTemplateService.remove(new QueryWrapper<ObjectTemplateEntity>(){{ |
|
|
|
objectTemplateService.remove(new QueryWrapper<ObjectTemplateEntity>(){{ |
|
|
|
@ -184,11 +183,9 @@ public class ObjectController extends BladeController { |
|
|
|
public R<Boolean> disableOrEnable(@RequestParam Long id,@RequestParam Integer status) { |
|
|
|
public R<Boolean> disableOrEnable(@RequestParam Long id,@RequestParam Integer status) { |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getObjectId,id); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getObjectId,id); |
|
|
|
if (status == 1) { |
|
|
|
|
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
int count = planObjectTemplateService.count(qw); |
|
|
|
if(count>0) { |
|
|
|
if(count>0) { |
|
|
|
return R.fail("该巡检对象已关联模板,请先取消关联"); |
|
|
|
return R.fail("该巡检对象已被巡检计划引用,无法停用"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
UpdateWrapper<ObjectEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<ObjectEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().set(ObjectEntity::getStatus,status).eq(ObjectEntity::getId, id); |
|
|
|
ew.lambda().set(ObjectEntity::getStatus,status).eq(ObjectEntity::getId, id); |
|
|
|
|