This commit is contained in:
2023-05-16 17:28:43 +08:00
parent 77a83cee8b
commit a161a83023
64 changed files with 1367 additions and 212 deletions

View File

@ -19,4 +19,12 @@
order by d.parent_id, d.order_num
</select>
<select id="existChild" resultType="string">
SELECT dept_id FROM sys_dept where parent_id = #{deptId} LIMIT 1
</select>
<select id="existUsed" resultType="string">
SELECT nickname from sys_user where dept_id = #{deptId} and is_delete = '0' limit 1
</select>
</mapper>

View File

@ -24,11 +24,25 @@
<select id="selectByUserId" resultType="com.qiaoba.api.system.entity.vo.SysMenuVo">
select distinct t1.menu_id, t1.parent_id, t1.menu_name, t1.path, t1.component, t1.`query`, t1.is_visible, t1.perms, t1.is_frame, t1.is_cache, t1.menu_type, t1.icon, t1.order_num, t1.create_time
from sys_menu t1
left join sys_role_menu t2 on t1.menu_id = t2.menu_id
left join sys_user_role t3 on t2.role_id = t3.role_id
left join sys_role t4 on t3.role_id = t4.role_id
left join sys_user t5 on t3.user_id = t5.user_id
where t5.user_id = #{userId} and t1.menu_type in ('M', 'C') AND t4.status = '1'
LEFT JOIN sys_role_menu t2
on t2.menu_id = t1.menu_id
LEFT JOIN sys_role t3
on t3.role_id = t2.role_id
LEFT JOIN sys_user_role t4
on t4.role_id = t3.role_id
where t4.user_id = #{userId} and t1.menu_type in ('M', 'C') AND t3.status = '1'
order by t1.parent_id, t1.order_num
</select>
<select id="selectPermsByUserId" resultType="string">
SELECT t1.perms
from sys_menu t1
LEFT JOIN sys_role_menu t2
on t2.menu_id = t1.menu_id
LEFT JOIN sys_role t3
on t3.role_id = t2.role_id
LEFT JOIN sys_user_role t4
on t4.role_id = t3.role_id
where t4.user_id = #{userId} AND t3.status = '1'
</select>
</mapper>

View File

@ -4,8 +4,8 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysPostMapper">
<select id="checkPostNameUnique" resultType="int">
select count(post_id) from sys_post
<select id="checkPostNameUnique" resultType="string">
select post_id from sys_post
where post_name = #{postName}
<if test="postId != null and postId != ''">
and post_id != #{postId}
@ -13,8 +13,8 @@
limit 1
</select>
<select id="checkPostCodeUnique" resultType="int">
select count(post_id) from sys_post
<select id="checkPostCodeUnique" resultType="string">
select post_id from sys_post
where post_code = #{postCode}
<if test="postId != null and postId != ''">
and post_id != #{postId}

View File

@ -7,4 +7,16 @@
<select id="selectPostIdsByUserId" resultType="string">
select post_id from sys_user_post where user_id = #{userId}
</select>
<select id="selectUsedPostNameByIds" resultType="string">
select DISTINCT t1.post_name
from sys_post t1
LEFT JOIN sys_user_post t2
on t1.post_id = t2.post_id
where t2.post_id in
<foreach collection="list" item="postId" open="(" separator="," close=")">
#{postId}
</foreach>
</select>
</mapper>

View File

@ -5,7 +5,12 @@
<mapper namespace="com.qiaoba.module.system.mapper.SysUserRoleMapper">
<select id="selectRoleIdsByUserId" resultType="string">
select role_id from sys_user_role where user_id = #{userId}
select t1.role_id from sys_user_role t1
left join sys_role t2 on t2.role_id = t1.role_id
where t1.user_id = #{userId}
<if test="status != null and status != ''">
and t2.status = #{status}
</if>
</select>
<delete id="deleteByRoleIdAndUserIds">