Commit 86e64509 authored by chenzhao's avatar chenzhao

巡检代码

parent c1c09215
......@@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.patrol.business.dao.repository.IPointInputItemDao;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -76,6 +77,8 @@ public class InputItemController extends AbstractBaseController {
JcsFeignClient jcsFeignClient;
@Autowired
InputItemMapper inputItemMapper;
@Autowired
IPointInputItemDao iPointInputItemDao;
@Value("${equipment.hierarchy}")
private String hierarchy;
......@@ -312,6 +315,10 @@ public class InputItemController extends AbstractBaseController {
if (ObjectUtils.isEmpty(itemIDs)) {
return CommonResponseUtil.failure("请选择要删除的检查项");
}
//查询该巡查项是否已有巡查点绑定 有就返回
if (iPointInputItemDao.selectByITemId(itemIDs) > 0) {
return CommonResponseUtil.failure("该巡检项已绑定,请先删除巡检设备的巡检项");
}
String[] ids = itemIDs.split(",");
inputItemService.batchDelInputItem(ids);
redisUtils.del(EQUIP_AND_FIRE_TREE + (reginParams.getPersonIdentity().getBizOrgCode() == null? "" :reginParams.getPersonIdentity().getBizOrgCode()));
......
......@@ -54,4 +54,7 @@ public interface IPointInputItemDao extends BaseDao<PointInputItem, Long> {
@Query(value = "SELECT input_item_id FROM p_point_inputitem WHERE id IN (?1) ", nativeQuery = true)
List<String> selectItemIdByid(List<String> ids);
@Query(value = "SELECT count(*) FROM p_point_inputitem WHERE input_item_id IN(?1) ", nativeQuery = true)
int selectByITemId(String inputItemIds);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment