Commit 1164ea8e authored by zhangsen's avatar zhangsen

巡检模块代码bug修改

parent cddfb101
...@@ -556,11 +556,11 @@ public class InputItemController extends AbstractBaseController { ...@@ -556,11 +556,11 @@ public class InputItemController extends AbstractBaseController {
throw new BadRequest("适用类型至少需选择一项"); throw new BadRequest("适用类型至少需选择一项");
} }
if (CollectionUtils.isNotEmpty(inputItemDao.findByItemNo(param.getItemNo()))) { if (CollectionUtils.isNotEmpty(inputItemDao.findByItemNo(param.getItemNo(), param.getId() != 0 ? String.valueOf(param.getId()) : null))) {
throw new BadRequest("该编号已存在,请重新输入"); throw new BadRequest("该编号已存在,请重新输入");
} }
if (CollectionUtils.isNotEmpty(inputItemDao.findByItemName(param.getName()))) { if (CollectionUtils.isNotEmpty(inputItemDao.findByItemName(param.getName(), param.getId() != 0 ? String.valueOf(param.getId()) : null))) {
throw new BadRequest("该名称已存在,请重新输入"); throw new BadRequest("该名称已存在,请重新输入");
} }
......
...@@ -34,10 +34,10 @@ public interface IInputItemDao extends BaseDao<InputItem, Long> { ...@@ -34,10 +34,10 @@ public interface IInputItemDao extends BaseDao<InputItem, Long> {
@Query(value = "delete * from p_input_item where is not null and is_delete =0", nativeQuery = true) @Query(value = "delete * from p_input_item where is not null and is_delete =0", nativeQuery = true)
void deleteAllByEquipmentNameIsNotNull(); void deleteAllByEquipmentNameIsNotNull();
@Query(value = "select * from p_input_item where item_no = ?1 and is_delete =0", nativeQuery = true) @Query(value = "select * from p_input_item where item_no = ?1 and is_delete =0 and if(?2 is null, 1 = 1 , id != ?2", nativeQuery = true)
List<InputItem> findByItemNo(String itemNo); List<InputItem> findByItemNo(String itemNo, String id);
@Query(value = "select * from p_input_item where name = ?1 and is_delete =0", nativeQuery = true) @Query(value = "select * from p_input_item where name = ?1 and is_delete =0 and if(?2 is null, 1 = 1 , id != ?2", nativeQuery = true)
List<InputItem> findByItemName(String name); List<InputItem> findByItemName(String name, String id);
} }
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