Commit a4b92b32 authored by tangwei's avatar tangwei

修改bug

parent 23d211da
...@@ -162,8 +162,11 @@ public class RouteController extends AbstractBaseController { ...@@ -162,8 +162,11 @@ public class RouteController extends AbstractBaseController {
if(!StringUtils.isEmpty(route.getName())){ if(!StringUtils.isEmpty(route.getName())){
List<Route> list = iRouteDao.getListByName(route.getName()); List<Route> list =null;
if (!ObjectUtils.isEmpty(list) || list.size()>0){
list = route.getId()>0?iRouteDao.getListByNameUpdate(route.getId(),route.getName()):iRouteDao.getListByName(route.getName());
if (!ObjectUtils.isEmpty(list) || list.size()>0 ){
throw new BadRequest("该名称路线已存在"); throw new BadRequest("该名称路线已存在");
} }
} }
......
...@@ -23,6 +23,10 @@ public interface IRouteDao extends BaseDao<Route, Long> { ...@@ -23,6 +23,10 @@ public interface IRouteDao extends BaseDao<Route, Long> {
@Query(value = "select * from p_route where original_id in ?1 and is_delete =0", nativeQuery = true) @Query(value = "select * from p_route where original_id in ?1 and is_delete =0", nativeQuery = true)
List<Route> listByOriginalIds(List<String> originalIds); List<Route> listByOriginalIds(List<String> originalIds);
@Query(value = "select * from p_route where `name` = ?1 and is_delete =0", nativeQuery = true) @Query(value = "select * from p_route where `name` = ?1 and is_delete =0", nativeQuery = true)
List<Route> getListByName(String name); List<Route> getListByName(String name);
@Query(value = "select * from p_route where id !=?1 and `name` = ?2 and is_delete =0", nativeQuery = true)
List<Route> getListByNameUpdate(Long id,String name);
} }
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