From ac24a9c6172e0ab1e4238d5dc04e7b0ca8c87a04 Mon Sep 17 00:00:00 2001
From: RuoYi <yzz_ivy@163.com>
Date: 星期五, 31 七月 2020 16:57:00 +0800
Subject: [PATCH] 防止如果导入多个同名部门dept_name,parent_id相同,但是删除状态(del_flag)不同,导致查询结果为多条,mybatis不能映射为一条数据的问题

---
 src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java |    1 -
 src/main/resources/mybatis/system/SysDeptMapper.xml              |    2 +-
 2 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java b/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java
index 675cd6c..77778a4 100644
--- a/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java
+++ b/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java
@@ -233,7 +233,6 @@
     public static String getPermissionPrefix(String moduleName, String businessName)
     {
         return StringUtils.format("{}:{}", moduleName, businessName);
-
     }
 
     /**
diff --git a/src/main/resources/mybatis/system/SysDeptMapper.xml b/src/main/resources/mybatis/system/SysDeptMapper.xml
index 3338046..0f3ee27 100644
--- a/src/main/resources/mybatis/system/SysDeptMapper.xml
+++ b/src/main/resources/mybatis/system/SysDeptMapper.xml
@@ -77,7 +77,7 @@
 	
 	<select id="checkDeptNameUnique" resultMap="SysDeptResult">
 	    <include refid="selectDeptVo"/>
-		where dept_name=#{deptName} and parent_id = #{parentId}
+		where dept_name=#{deptName} and parent_id = #{parentId} limit 1
 	</select>
     
     <insert id="insertDept" parameterType="SysDept">

--
Gitblit v1.9.3