|
|
|
@ -48,6 +48,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 巡检对象控制器 |
|
|
|
* 巡检对象控制器 |
|
|
|
|
|
|
|
* |
|
|
|
* @author ninglong |
|
|
|
* @author ninglong |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@RestController |
|
|
|
@RestController |
|
|
|
@ -167,7 +168,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>() {{ |
|
|
|
@ -183,9 +184,11 @@ 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); |
|
|
|
|