作者 RuoYi

唯一限制条件只返回单条数据

@@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -61,7 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
61 61
62 <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult"> 62 <select id="checkConfigKeyUnique" parameterType="String" resultMap="SysConfigResult">
63 <include refid="selectConfigVo"/> 63 <include refid="selectConfigVo"/>
64 - where config_key = #{configKey} 64 + where config_key = #{configKey} limit 1
65 </select> 65 </select>
66 66
67 <insert id="insertConfig" parameterType="SysConfig"> 67 <insert id="insertConfig" parameterType="SysConfig">
@@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -64,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
64 64
65 <select id="hasChildByDeptId" parameterType="Long" resultType="int"> 65 <select id="hasChildByDeptId" parameterType="Long" resultType="int">
66 select count(1) from sys_dept 66 select count(1) from sys_dept
67 - where del_flag = '0' and parent_id = #{deptId} 67 + where del_flag = '0' and parent_id = #{deptId} limit 1
68 </select> 68 </select>
69 69
70 <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult"> 70 <select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
57 57
58 <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult"> 58 <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
59 <include refid="selectDictTypeVo"/> 59 <include refid="selectDictTypeVo"/>
60 - where dict_type = #{dictType} 60 + where dict_type = #{dictType} limit 1
61 </select> 61 </select>
62 62
63 <delete id="deleteDictTypeById" parameterType="Long"> 63 <delete id="deleteDictTypeById" parameterType="Long">
@@ -118,7 +118,7 @@ @@ -118,7 +118,7 @@
118 118
119 <select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult"> 119 <select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
120 <include refid="selectMenuVo"/> 120 <include refid="selectMenuVo"/>
121 - where menu_name=#{menuName} and parent_id = #{parentId} 121 + where menu_name=#{menuName} and parent_id = #{parentId} limit 1
122 </select> 122 </select>
123 123
124 <update id="updateMenu" parameterType="SysMenu"> 124 <update id="updateMenu" parameterType="SysMenu">
@@ -64,12 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -64,12 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
64 64
65 <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult"> 65 <select id="checkPostNameUnique" parameterType="String" resultMap="SysPostResult">
66 <include refid="selectPostVo"/> 66 <include refid="selectPostVo"/>
67 - where post_name=#{postName} 67 + where post_name=#{postName} limit 1
68 </select> 68 </select>
69 69
70 <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult"> 70 <select id="checkPostCodeUnique" parameterType="String" resultMap="SysPostResult">
71 <include refid="selectPostVo"/> 71 <include refid="selectPostVo"/>
72 - where post_code=#{postCode} 72 + where post_code=#{postCode} limit 1
73 </select> 73 </select>
74 74
75 <update id="updatePost" parameterType="SysPost"> 75 <update id="updatePost" parameterType="SysPost">
@@ -80,12 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -80,12 +80,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
80 80
81 <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult"> 81 <select id="checkRoleNameUnique" parameterType="String" resultMap="SysRoleResult">
82 <include refid="selectRoleVo"/> 82 <include refid="selectRoleVo"/>
83 - where r.role_name=#{roleName} 83 + where r.role_name=#{roleName} limit 1
84 </select> 84 </select>
85 85
86 <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult"> 86 <select id="checkRoleKeyUnique" parameterType="String" resultMap="SysRoleResult">
87 <include refid="selectRoleVo"/> 87 <include refid="selectRoleVo"/>
88 - where r.role_key=#{roleKey} 88 + where r.role_key=#{roleKey} limit 1
89 </select> 89 </select>
90 90
91 <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId"> 91 <insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
@@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -92,15 +92,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
92 </select> 92 </select>
93 93
94 <select id="checkUserNameUnique" parameterType="String" resultType="int"> 94 <select id="checkUserNameUnique" parameterType="String" resultType="int">
95 - select count(1) from sys_user where user_name = #{userName} 95 + select count(1) from sys_user where user_name = #{userName} limit 1
96 </select> 96 </select>
97 97
98 <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult"> 98 <select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
99 - select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} 99 + select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} limit 1
100 </select> 100 </select>
101 101
102 <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult"> 102 <select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
103 - select user_id, email from sys_user where email = #{email} 103 + select user_id, email from sys_user where email = #{email} limit 1
104 </select> 104 </select>
105 105
106 <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> 106 <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">