Commit 47c133b0 authored by zhangsen's avatar zhangsen

巡检模块代码物理合并3

parent 7ac2c864
...@@ -1515,13 +1515,13 @@ public class PointController extends AbstractBaseController { ...@@ -1515,13 +1515,13 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.failure("责任人不能为空"); return CommonResponseUtil.failure("责任人不能为空");
} }
if (!ObjectUtils.isEmpty(pointNewVo.getName())) { if (!ObjectUtils.isEmpty(pointNewVo.getName())) {
List<Point> list = iPointDao.findByName(pointNewVo.getName()); List<Point> list = iPointDao.findByName(pointNewVo.getName(), pointNewVo.getId() != 0 ? String.valueOf(pointNewVo.getId()) : null);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
throw new BadRequest("该名称巡检点已存在"); throw new BadRequest("该名称巡检点已存在");
} }
} }
if (!ObjectUtils.isEmpty(pointNewVo.getName())) { if (!ObjectUtils.isEmpty(pointNewVo.getName())) {
List<Point> list = iPointDao.findByNo(pointNewVo.getPointNo()); List<Point> list = iPointDao.findByNo(pointNewVo.getPointNo(), pointNewVo.getId() != 0 ? String.valueOf(pointNewVo.getId()) : null);
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
throw new BadRequest("该编号已存在"); throw new BadRequest("该编号已存在");
} }
......
...@@ -27,10 +27,10 @@ public interface IPointDao extends BaseDao<Point, Long> { ...@@ -27,10 +27,10 @@ public interface IPointDao extends BaseDao<Point, Long> {
Optional<Point> findById(Long id); Optional<Point> findById(Long id);
@Query(value = "select * from p_point where point_no = (?1) and is_delete =0", nativeQuery = true) @Query(value = "select * from p_point where point_no = (?1) and is_delete =0 and if(?2 is null, 1 = 1 , id = ?2)", nativeQuery = true)
List<Point> findByNo(String pointNo); List<Point> findByNo(String pointNo, String id);
@Query(value = "select * from p_point where name = (?1) and is_delete =0", nativeQuery = true) @Query(value = "select * from p_point where name = (?1) and is_delete =0 and if(?2 is null, 1 = 1 , id = ?2)", nativeQuery = true)
List<Point> findByName(String name); List<Point> findByName(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