This commit is contained in:
2023-05-10 17:17:26 +08:00
parent 0af829c451
commit 076a8aed70
91 changed files with 3837 additions and 108 deletions

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysDeptMapper">
<select id="checkDeptNameUnique" resultType="int">
select count(1) from sys_dept
where dept_name = #{deptName} and parent_id = #{parentId}
<if test="deptId != null and deptId != ''">and dept_id != #{deptId}</if>
limit 1
</select>
</mapper>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysMenuMapper">
<select id="checkMenuNameUnique" parameterType="com.qiaoba.api.system.entity.SysMenu" resultType="int">
select count(1) from sys_menu
where menu_name= #{menuName} and parent_id = #{parentId}
<if test="menuId != null">
and menu_id != #{menuId}
</if>
limit 1
</select>
<select id="selectMenuIdsByRoleId" resultType="string">
select m.menu_id
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where rm.role_id = #{roleId}
order by m.parent_id, m.order_num
</select>
</mapper>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"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
where post_name = #{postName}
<if test="postId != null and postId != ''">
and post_id != #{postId}
</if>
limit 1
</select>
<select id="checkPostCodeUnique" resultType="int">
select count(post_id) from sys_post
where post_code = #{postCode}
<if test="postId != null and postId != ''">
and post_id != #{postId}
</if>
limit 1
</select>
</mapper>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysRoleMapper">
<select id="checkRoleNameUnique" parameterType="String" resultType="int">
select count(*) from sys_role
where role_name = #{roleName} and tenant_id = #{tenantId}
<if test="roleId != null and roleId != 0">
and role_id != #{roleId}
</if>
limit 1
</select>
<select id="checkRoleKeyUnique" parameterType="String" resultType="int">
select count(*) from sys_role
where role_key = #{roleKey} and tenant_id = #{tenantId}
<if test="roleId != null and roleId != 0">
and role_id != #{roleId}
</if>
limit 1
</select>
</mapper>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysRoleMenuMapper">
<select id="checkMenuExistRole">
select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteByRoleIds">
delete from sys_role_menu where role_id in
<foreach collection="list" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysUserMapper">
<resultMap type="com.qiaoba.api.system.entity.vo.SysUserVo" id="SysUserVoResult">
<id property="userId" column="user_id"/>
<result property="deptName" column="dept_name"/>
<result property="username" column="username"/>
<result property="nickname" column="nickname"/>
<result property="email" column="email"/>
<result property="phone" column="phone"/>
<result property="sex" column="sex"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
</resultMap>
<sql id="selectUserVo">
SELECT u.user_id,u.dept_id,u.username,u.nickname,u.gender,u.phone,u.status,u.email,u.create_time,t2.dept_name
FROM sys_user u
left join sys_dept t2
on u.dept_id = t2.dept_id
where u.is_delete = #{param.isDelete}
<if test="param.username != null and param.username != ''">
AND u.username like concat('%', #{param.username}, '%')
</if>
<if test="param.nickname != null and param.nickname != ''">
AND u.nickname like concat('%', #{param.nickname}, '%')
</if>
<if test="param.status != null and param.status != ''">
AND u.status = #{param.status}
</if>
<if test="param.deptId != null and param.deptId != ''">
AND u.dept_id = #{param.deptId}
</if>
<if test="param.phone != null and param.phone != ''">
AND u.phone like concat('%', #{param.phone}, '%')
</if>
<if test="param.beginTime != null and param.beginTime != ''">
AND u.create_time &gt;= #{param.beginTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND u.create_time &lt;= #{param.endTime}
</if>
</sql>
<select id="selectVoPageList" resultMap="SysUserVoResult">
<include refid="selectUserVo"/>
</select>
<select id="selectVoList" resultMap="SysUserVoResult">
<include refid="selectUserVo"/>
</select>
<select id="checkUsernameUnique" resultType="int">
select count(*) from sys_user where username = #{username} and is_delete = #{isDelete}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
<select id="checkPhoneUnique" resultType="int">
select count(*) from sys_user where phone = #{phone} and is_delete = #{isDelete}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
<select id="checkEmailUnique" resultType="int">
select count(*) from sys_user where email = #{email} and is_delete = #{isDelete}
<if test="userId != null and userId != ''">and user_id != #{userId}</if>
limit 1
</select>
<update id="updateUserDeleteStatus">
update sys_user set is_delete = #{status} where user_id in
<foreach collection="list" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</update>
</mapper>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qiaoba.module.system.mapper.SysUserPostMapper">
<select id="selectPostIdsByUserId" resultType="string">
select post_id from sys_user_post where user_id = #{userId}
</select>
</mapper>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<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>
</mapper>