1.补全合并丢失代码
parent
8f09c46796
commit
b4f09051b5
@ -0,0 +1,55 @@
|
||||
<?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.glxp.api.dao.auth.DeptHisStatusDao">
|
||||
|
||||
|
||||
<select id="selectDeptHisStatus" parameterType="com.glxp.api.req.auth.SysRoleMenuRequest"
|
||||
resultType="com.glxp.api.entity.auth.DeptHisStatusEntity">>
|
||||
SELECT *
|
||||
FROM auth_dept_status
|
||||
<where>
|
||||
<if test="deptId != null ">
|
||||
and deptId = #{deptId}
|
||||
</if>
|
||||
<if test="statusId != null ">
|
||||
and statusId = #{statusId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Integer">
|
||||
delete
|
||||
from auth_dept_status
|
||||
where deptId = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByList" parameterType="java.util.List"
|
||||
>
|
||||
delete
|
||||
from auth_dept_status
|
||||
where deptId in
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
|
||||
insert INTO auth_dept_status
|
||||
(
|
||||
deptId,statusId
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.deptId},
|
||||
#{item.statusId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,72 @@
|
||||
<?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.glxp.api.dao.auth.DeptUserDao">
|
||||
|
||||
|
||||
<select id="selectDeptUser" parameterType="com.glxp.api.req.auth.DeptUserReqeust"
|
||||
resultType="com.glxp.api.entity.auth.DeptUserEntity">>
|
||||
SELECT *
|
||||
FROM auth_dept_user
|
||||
<where>
|
||||
<if test="deptId != null ">
|
||||
and deptId = #{deptId}
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and userId = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectJoinDeptUser" parameterType="com.glxp.api.req.auth.DeptUserReqeust"
|
||||
resultType="com.glxp.api.entity.auth.DeptUserEntity">>
|
||||
SELECT auth_dept_user.*,auth_user.userName,auth_user.employeeName
|
||||
FROM auth_dept_user INNER JOIN auth_user
|
||||
on auth_dept_user.userId = auth_user.id
|
||||
<where>
|
||||
<if test="deptId != null ">
|
||||
and deptId = #{deptId}
|
||||
</if>
|
||||
<if test="userId != null ">
|
||||
and userId = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Integer">
|
||||
delete
|
||||
from auth_dept_user
|
||||
where deptId = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByList" parameterType="java.util.List"
|
||||
>
|
||||
delete
|
||||
from auth_dept_user
|
||||
where deptId in
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
|
||||
insert INTO auth_dept_user
|
||||
(
|
||||
deptId,userId
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.deptId},
|
||||
#{item.userId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,110 @@
|
||||
<?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.glxp.api.dao.auth.SysDictDataMapper">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysDictData" id="SysDictDataResult">
|
||||
<id property="dictCode" column="dict_code"/>
|
||||
<result property="dictSort" column="dict_sort"/>
|
||||
<result property="dictLabel" column="dict_label"/>
|
||||
<result property="dictValue" column="dict_value"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="cssClass" column="css_class"/>
|
||||
<result property="listClass" column="list_class"/>
|
||||
<result property="isDefault" column="is_default"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectDictDataList" parameterType="com.glxp.api.req.auth.SysDictDataRequest"
|
||||
resultMap="SysDictDataResult">
|
||||
SELECT *
|
||||
FROM sys_dict_data
|
||||
<where>
|
||||
<if test="dictType != null ">
|
||||
and dict_type = #{dictType}
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="dictLabel != null ">
|
||||
and dict_label = #{dictLabel}
|
||||
</if>
|
||||
<if test="dictValue != null ">
|
||||
and dict_value = #{dictValue}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectById" parameterType="Map"
|
||||
resultMap="SysDictDataResult">
|
||||
SELECT *
|
||||
FROM sys_dict_data
|
||||
WHERE dict_code = #{dictCode}
|
||||
</select>
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from sys_dict_data
|
||||
where dict_code = #{dictCode}
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true"
|
||||
parameterType="com.glxp.api.entity.auth.SysDictData">
|
||||
INSERT INTO sys_dict_data(`dict_code`, `dict_sort`, dict_label, dict_value
|
||||
, dict_type, css_class, list_class, is_default, status, remark,
|
||||
create_by, create_time, update_by)
|
||||
values (#{dictCode},
|
||||
#{dictSort}, #{dictLabel}, #{dictValue}, #{dictType}, #{cssClass}, #{listClass}
|
||||
, #{isDefault}, #{status}, #{remark}, #{createBy}, #{createTime}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole">
|
||||
UPDATE sys_dict_data
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="dictCode != null">`dict_code`=#{dictCode},</if>
|
||||
<if test="dictSort != null">`dict_sort`=#{dictSort},</if>
|
||||
<if test="dictLabel != null">dict_label=#{dictLabel},</if>
|
||||
<if test="dictValue != null">`dict_value`=#{dictValue},</if>
|
||||
<if test="dictType != null">dict_type=#{dictType},</if>
|
||||
<if test="cssClass != null">`css_class`=#{cssClass},</if>
|
||||
<if test="listClass != null">`list_class`=#{listClass},</if>
|
||||
<if test="isDefault != null">is_default=#{isDefault},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="createBy != null">create_by=#{createBy},</if>
|
||||
<if test="createTime != null">`create_time`=#{createTime},</if>
|
||||
<if test="updateBy != null">`update_by`=#{updateBy},</if>
|
||||
</trim>
|
||||
WHERE dict_code=#{dictCode}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="exists" parameterType="com.glxp.api.req.auth.SysDictDataRequest"
|
||||
resultMap="SysDictDataResult">
|
||||
SELECT *
|
||||
FROM sys_dict_data
|
||||
<where>
|
||||
<if test="dictType != null ">
|
||||
and dict_type = #{dictType}
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="dictLabel != null ">
|
||||
and dict_label = #{dictLabel}
|
||||
</if>
|
||||
<if test="dictValue != null ">
|
||||
and dict_value = #{dictValue}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,113 @@
|
||||
<?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.glxp.api.dao.auth.SysDictTypeMapper">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysDictType" id="SysDictTypeResult">
|
||||
<id property="dictId" column="dict_id"/>
|
||||
<result property="dictName" column="dict_name"/>
|
||||
<result property="dictType" column="dict_type"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectDictTypeList" parameterType="com.glxp.api.req.auth.SysDictTypeRequest"
|
||||
resultMap="SysDictTypeResult">
|
||||
SELECT *
|
||||
FROM sys_dict_type
|
||||
<where>
|
||||
<if test="dictId != null ">
|
||||
and dict_type = #{dictId}
|
||||
</if>
|
||||
<if test="dictName != null ">
|
||||
and status = #{dictName}
|
||||
</if>
|
||||
<if test="dictType != null ">
|
||||
and dict_label = #{dictType}
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectById" parameterType="Map"
|
||||
resultMap="SysDictTypeResult">
|
||||
SELECT *
|
||||
FROM sys_dict_type
|
||||
WHERE dict_id = #{dictId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from sys_dict_type
|
||||
where dict_id = #{dictId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteBatchIds" parameterType="java.util.List"
|
||||
>
|
||||
delete
|
||||
from sys_dict_type
|
||||
where dict_id in
|
||||
<foreach item="item" index="index" collection="dictIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true"
|
||||
parameterType="com.glxp.api.entity.auth.SysDictData">
|
||||
INSERT INTO sys_dict_type(`dict_id`, dict_name, `dict_type`, status
|
||||
create_by, create_time, update_by, update_time)
|
||||
values (#{dictId},
|
||||
#{dictName}, #{dictType}, #{status}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole">
|
||||
UPDATE sys_dict_type
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="dictName != null">`dict_name`=#{dictName},</if>
|
||||
<if test="dictType != null">dict_type=#{dictType},</if>
|
||||
<if test="status != null">`status`=#{status},</if>
|
||||
<if test="updateTime != null">update_time=#{updateTime},</if>
|
||||
<if test="createBy != null">create_by=#{createBy},</if>
|
||||
<if test="createTime != null">`create_time`=#{createTime},</if>
|
||||
<if test="updateBy != null">`update_by`=#{updateBy},</if>
|
||||
</trim>
|
||||
WHERE dict_id=#{dictId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="exists" parameterType="com.glxp.api.req.auth.SysDictTypeRequest"
|
||||
resultMap="SysDictTypeResult">
|
||||
SELECT *
|
||||
FROM sys_dict_type
|
||||
<where>
|
||||
<if test="dictType != null ">
|
||||
and dict_type = #{dictType}
|
||||
</if>
|
||||
<if test="status != null ">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="dictLabel != null ">
|
||||
and dict_label = #{dictLabel}
|
||||
</if>
|
||||
<if test="dictValue != null ">
|
||||
and dict_value = #{dictValue}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,68 @@
|
||||
<?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.glxp.api.dao.auth.SysHisStatusDao">
|
||||
|
||||
<select id="selectList" parameterType="com.glxp.api.req.auth.FilterSysHisStatusRequest"
|
||||
resultType="com.glxp.api.entity.auth.SysHisStatusEntity">
|
||||
select A.*,B.typeName parentName from sys_his_status A left JOIN sys_his_status B on A.parentId = B.id
|
||||
<where>
|
||||
<if test="id != null ">
|
||||
and A.id = #{id}
|
||||
</if>
|
||||
<if test=" parentId != null">
|
||||
and A.parentId = #{parentId}
|
||||
</if>
|
||||
<if test="typeName != null and '' != typeName">
|
||||
AND A.`typeName` LIKE CONCAT('%',#{typeName},'%')
|
||||
</if>
|
||||
<if test="type != null and '' != type">
|
||||
AND A.`type` LIKE CONCAT('%',#{type},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" keyProperty="id" parameterType="com.glxp.api.entity.auth.DeptEntity">
|
||||
INSERT INTO sys_his_status(`type`, `typeName`, `parentId`, status, remark, updateTime)
|
||||
values (#{type},
|
||||
#{typeName},
|
||||
#{parentId}, #{status}, #{remark}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.glxp.api.entity.auth.DeptEntity">
|
||||
UPDATE sys_his_status
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="type != null">`type`=#{type},</if>
|
||||
<if test="typeName != null">`typeName`=#{typeName},</if>
|
||||
<if test="parentId != null">parentId=#{parentId},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
</trim>
|
||||
WHERE id=#{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Integer">
|
||||
delete
|
||||
from sys_his_status
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectListByDeptId" resultType="java.lang.Integer">
|
||||
select id
|
||||
from sys_his_status
|
||||
left join auth_dept_status on sys_his_status.id = auth_dept_status.statusId
|
||||
where auth_dept_status.deptId = #{deptId}
|
||||
and sys_his_status.id not in
|
||||
(select parentId
|
||||
from sys_his_status
|
||||
INNER JOIN auth_dept_status
|
||||
on sys_his_status.id = auth_dept_status.statusId
|
||||
and auth_dept_status.deptId = #{deptId})
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,208 @@
|
||||
<?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.glxp.api.dao.auth.SysMenuDao">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysMenu" id="SysMenuResult">
|
||||
<id property="menuId" column="menu_id"/>
|
||||
<result property="menuName" column="menu_name"/>
|
||||
<result property="parentName" column="parent_name"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="orderNum" column="order_num"/>
|
||||
<result property="path" column="path"/>
|
||||
<result property="component" column="component"/>
|
||||
<result property="queryParam" column="query_param"/>
|
||||
<result property="isFrame" column="is_frame"/>
|
||||
<result property="isCache" column="is_cache"/>
|
||||
<result property="menuType" column="menu_type"/>
|
||||
<result property="visible" column="visible"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="perms" column="perms"/>
|
||||
<result property="icon" column="icon"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectById" parameterType="java.lang.Long"
|
||||
resultMap="SysMenuResult">
|
||||
select *
|
||||
FROM sys_menu
|
||||
WHERE menu_id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" keyProperty="id" parameterType="com.glxp.api.entity.auth.SysMenu">
|
||||
INSERT INTO sys_menu(`menu_id`, `menu_name`, parent_id, `order_num`, `path`, component
|
||||
, query_param, is_frame, is_cache, menu_type, visible, status, perms, icon,
|
||||
remark, create_by, create_time, update_time, update_by)
|
||||
values (#{menuId},
|
||||
#{menuName}, #{parentId},
|
||||
#{orderNum}, #{path}, #{component}, #{queryParam}, #{isFrame}, #{isCache}
|
||||
, #{menuType}, #{visible}, #{status}, #{perms}, #{icon}, #{remark}
|
||||
, #{createBy}, #{createTime}, #{updateTime}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysMenu">
|
||||
UPDATE sys_menu
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="menuName != null">`menu_name`=#{menuName},</if>
|
||||
<if test="parentId != null">`parent_id`=#{parentId},</if>
|
||||
<if test="orderNum != null">order_num=#{orderNum},</if>
|
||||
<if test="path != null">`path`=#{path},</if>
|
||||
<if test="component != null">component=#{component},</if>
|
||||
<if test="queryParam != null">`query_param`=#{queryParam},</if>
|
||||
<if test="isFrame != null">is_frame=#{isFrame},</if>
|
||||
<if test="isCache != null">is_cache=#{isCache},</if>
|
||||
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
||||
<if test="menuType != null">`menu_type`=#{menuType},</if>
|
||||
<if test="visible != null">`visible`=#{visible},</if>
|
||||
<if test="status != null">status=#{status},</if>
|
||||
<if test="perms != null">perms=#{perms},</if>
|
||||
<if test="icon != null">icon=#{icon},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="createBy != null">create_by=#{createBy},</if>
|
||||
<if test="createTime != null">create_time=#{createTime},</if>
|
||||
<if test="updateTime != null">update_time=#{updateTime},</if>
|
||||
<if test="updateBy != null">update_by=#{updateBy},</if>
|
||||
</trim>
|
||||
WHERE menu_id=#{menuId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from sys_menu
|
||||
where menu_id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="selectMenuTreeAll" parameterType="com.glxp.api.entity.auth.SysMenu"
|
||||
resultMap="SysMenuResult">
|
||||
|
||||
select *
|
||||
FROM sys_menu
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectMenuList" parameterType="com.glxp.api.req.auth.SysMenuRequest"
|
||||
resultMap="SysMenuResult">
|
||||
select *
|
||||
FROM sys_menu
|
||||
<where>
|
||||
<if test="menuId != null ">
|
||||
and menu_id = #{menuId}
|
||||
</if>
|
||||
<if test="menuName != null and menuName != '' ">
|
||||
AND menu_name LIKE CONCAT('%',#{menuName},'%')
|
||||
</if>
|
||||
<if test="parentName != null and parentName != '' ">
|
||||
AND `parent_name` = #{parentName}
|
||||
</if>
|
||||
<if test="parentId != null ">
|
||||
AND `parent_id` = #{parentId}
|
||||
</if>
|
||||
<if test="orderNum != null ">
|
||||
AND `order_num` = #{orderNum}
|
||||
</if>
|
||||
<if test="neMenuId != null ">
|
||||
and menu_id <![CDATA[ <> ]]> #{neMenuId}
|
||||
</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectMenuListByUserId" parameterType="com.glxp.api.entity.auth.SysMenu"
|
||||
resultMap="SysMenuResult">
|
||||
select distinct m.menu_id,
|
||||
m.parent_id,
|
||||
m.menu_name,
|
||||
m.path,
|
||||
m.component,
|
||||
m.query_param,
|
||||
m.visible,
|
||||
m.status,
|
||||
m.perms,
|
||||
m.is_frame,
|
||||
m.is_cache,
|
||||
m.menu_type,
|
||||
m.icon,
|
||||
m.order_num,
|
||||
m.create_time
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role ro on sur.role_id = ro.role_id
|
||||
</select>
|
||||
|
||||
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
|
||||
select distinct m.menu_id,
|
||||
m.parent_id,
|
||||
m.menu_name,
|
||||
m.path,
|
||||
m.component,
|
||||
m.query_param,
|
||||
m.visible,
|
||||
m.status,
|
||||
m.perms,
|
||||
m.is_frame,
|
||||
m.is_cache,
|
||||
m.menu_type,
|
||||
m.icon,
|
||||
m.order_num,
|
||||
m.create_time
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role ro on sur.role_id = ro.role_id
|
||||
left join auth_user u on sur.user_id = u.id
|
||||
where u.id = #{userId}
|
||||
and m.menu_type in ('M', 'C')
|
||||
and m.status = '0'
|
||||
and ro.status = '0'
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuListByRoleId" resultType="Long">
|
||||
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}
|
||||
<if test="menuCheckStrictly">
|
||||
and m.menu_id not in (select m.parent_id from sys_menu m inner join sys_role_menu rm on m.menu_id =
|
||||
rm.menu_id and rm.role_id = #{roleId})
|
||||
</if>
|
||||
order by m.parent_id, m.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPerms" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
left join sys_user_role sur on rm.role_id = sur.role_id
|
||||
left join sys_role r on r.role_id = sur.role_id
|
||||
where m.status = '0'
|
||||
and r.status = '0'
|
||||
and sur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
|
||||
select distinct m.perms
|
||||
from sys_menu m
|
||||
left join sys_role_menu rm on m.menu_id = rm.menu_id
|
||||
where m.status = '0'
|
||||
and rm.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,177 @@
|
||||
<?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.glxp.api.dao.auth.SysRoleMapper">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysRole" id="SysRoleResult">
|
||||
<id property="roleId" column="role_id"/>
|
||||
<result property="roleName" column="role_name"/>
|
||||
<result property="roleKey" column="role_key"/>
|
||||
<result property="roleSort" column="role_sort"/>
|
||||
<result property="dataScope" column="data_scope"/>
|
||||
<result property="menuCheckStrictly" column="menu_check_strictly"/>
|
||||
<result property="deptCheckStrictly" column="dept_check_strictly"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<insert id="insert" keyProperty="roleId" useGeneratedKeys="true"
|
||||
parameterType="com.glxp.api.entity.auth.SysRole">
|
||||
INSERT INTO sys_role(`role_name`, `role_key`, role_sort, data_scope
|
||||
, menu_check_strictly, dept_check_strictly, status, del_flag, remark,
|
||||
create_by, create_time, update_by)
|
||||
values (#{roleName},
|
||||
#{roleKey}, #{roleSort}, #{dataScope}, #{menuCheckStrictly}, #{deptCheckStrictly}, #{status}
|
||||
, #{delFlag}, #{remark}, #{createBy}, #{createTime}, #{updateBy})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole">
|
||||
UPDATE sys_role
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="roleName != null">`role_name`=#{roleName},</if>
|
||||
<if test="roleKey != null">`role_key`=#{roleKey},</if>
|
||||
<if test="roleSort != null">role_sort=#{roleSort},</if>
|
||||
<if test="dataScope != null">`data_scope`=#{dataScope},</if>
|
||||
<if test="menuCheckStrictly != null">menu_check_strictly=#{menuCheckStrictly},</if>
|
||||
<if test="deptCheckStrictly != null">`dept_check_strictly`=#{deptCheckStrictly},</if>
|
||||
<if test="status != null">`status`=#{status},</if>
|
||||
<if test="delFlag != null">del_flag=#{delFlag},</if>
|
||||
<if test="remark != null">remark=#{remark},</if>
|
||||
<if test="createBy != null">create_by=#{createBy},</if>
|
||||
<if test="createTime != null">`create_time`=#{createTime},</if>
|
||||
<if test="updateBy != null">`update_by`=#{updateBy},</if>
|
||||
<if test="updateTime != null">`update_time`=#{updateTime},</if>
|
||||
</trim>
|
||||
WHERE role_id=#{roleId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBatchIds" parameterType="java.util.List"
|
||||
>
|
||||
delete
|
||||
from sys_role
|
||||
where role_id in
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from sys_role
|
||||
where role_id = #{id}
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectById" parameterType="java.lang.Long"
|
||||
resultMap="SysRoleResult">
|
||||
select *
|
||||
FROM sys_role
|
||||
WHERE role_id = #{id}
|
||||
</select>
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.menu_check_strictly,
|
||||
r.dept_check_strictly,
|
||||
r.status,
|
||||
r.del_flag,
|
||||
r.create_time,
|
||||
r.remark
|
||||
from sys_role r
|
||||
left join sys_user_role sur on sur.role_id = r.role_id
|
||||
left join auth_user u on u.id = sur.user_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="selectRoleList" parameterType="com.glxp.api.req.auth.SysRoleRequest"
|
||||
resultMap="SysRoleResult">
|
||||
SELECT *
|
||||
FROM sys_role
|
||||
<where>
|
||||
<if test="roleId != null ">
|
||||
and role_id = #{roleId}
|
||||
</if>
|
||||
<if test="roleName != null and roleName != ''">
|
||||
AND role_name LIKE CONCAT('%',#{roleName},'%')
|
||||
</if>
|
||||
<if test="roleKey != null and roleKey != ''">
|
||||
AND `role_key` = #{roleKey}
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
AND `status` = #{status}
|
||||
</if>
|
||||
<if test="neRoleName != null and neRoleName != ''">
|
||||
AND `role_name` <![CDATA[ <> ]]> #{neRoleName}
|
||||
</if>
|
||||
<if test="neRoleKey != null and neRoleKey != ''">
|
||||
AND `role_key` <![CDATA[ <> ]]> #{neRoleKey}
|
||||
</if>
|
||||
<if test="neRoleId != null ">
|
||||
AND `role_id` <![CDATA[ <> ]]> #{neRoleId}
|
||||
</if>
|
||||
</where>
|
||||
order by role_sort
|
||||
</select>
|
||||
|
||||
<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
|
||||
|
||||
select distinct r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.menu_check_strictly,
|
||||
r.dept_check_strictly,
|
||||
r.status,
|
||||
r.del_flag,
|
||||
r.create_time,
|
||||
r.remark
|
||||
from sys_role r
|
||||
left join sys_user_role sur on sur.role_id = r.role_id
|
||||
left join auth_user u on u.id = sur.user_id
|
||||
WHERE sur.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRoleListByUserId" parameterType="Long" resultType="Long">
|
||||
select r.role_id
|
||||
from sys_role r
|
||||
left join sys_user_role sur on sur.role_id = r.role_id
|
||||
left join auth_user u on u.id = sur.user_id
|
||||
where u.id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectRolesByUserName" parameterType="String" resultMap="SysRoleResult">
|
||||
|
||||
select distinct r.role_id,
|
||||
r.role_name,
|
||||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.menu_check_strictly,
|
||||
r.dept_check_strictly,
|
||||
r.status,
|
||||
r.del_flag,
|
||||
r.create_time,
|
||||
r.remark
|
||||
from sys_role r
|
||||
left join sys_user_role sur on sur.role_id = r.role_id
|
||||
left join auth_user u on u.id = sur.user_id
|
||||
|
||||
WHERE u.userName = #{userName}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
@ -0,0 +1,60 @@
|
||||
<?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.glxp.api.dao.auth.SysRoleMenuMapper">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysRoleMenu" id="SysRoleMenuResult">
|
||||
<result property="roleId" column="role_id"/>
|
||||
<result property="menuId" column="menu_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectRoleMenuList" parameterType="com.glxp.api.req.auth.SysRoleMenuRequest"
|
||||
resultMap="SysRoleMenuResult">
|
||||
SELECT *
|
||||
FROM sys_role_menu
|
||||
<where>
|
||||
<if test="roleId != null ">
|
||||
and role_id = #{roleId}
|
||||
</if>
|
||||
<if test="menuId != null ">
|
||||
and menu_id = #{menuId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<delete id="deleteById" parameterType="java.lang.Long">
|
||||
delete
|
||||
from sys_role_menu
|
||||
where role_id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByList" parameterType="java.util.List"
|
||||
>
|
||||
delete
|
||||
from sys_role_menu
|
||||
where role_id in
|
||||
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
|
||||
insert INTO sys_role_menu
|
||||
(
|
||||
role_id,menu_id
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.roleId},
|
||||
#{item.menuId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,47 @@
|
||||
<?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.glxp.api.dao.auth.SysUserRoleMapper">
|
||||
|
||||
<resultMap type="com.glxp.api.entity.auth.SysUserRole" id="SysUserRoleResult">
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
</resultMap>
|
||||
<select id="selectUserIdsByRoleId" resultType="Long">
|
||||
select u.id
|
||||
from auth_user u
|
||||
inner join sys_user_role sur
|
||||
on u.id = sur.user_id and sur.role_id = #{roleId}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="delete" parameterType="com.glxp.api.req.auth.SysUserRoleRequest">
|
||||
DELETE
|
||||
FROM sys_user_role
|
||||
<where>
|
||||
<if test="userId != '' and userId != null">
|
||||
AND user_id = #{userId}
|
||||
</if>
|
||||
<if test="roleId != '' and roleId != null">
|
||||
AND role_id = #{roleId}
|
||||
</if>
|
||||
</where>
|
||||
</delete>
|
||||
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" parameterType="java.util.List">
|
||||
insert INTO sys_user_role
|
||||
(
|
||||
user_id,role_id
|
||||
)
|
||||
values
|
||||
<foreach collection="sysUserRoles" item="item" index="index"
|
||||
separator=",">
|
||||
(
|
||||
#{item.userId},
|
||||
#{item.roleId}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
Loading…
Reference in New Issue