Commit bdbc56d1 authored by tangwei's avatar tangwei

修改bug

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