You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
182 lines
7.1 KiB
XML
182 lines
7.1 KiB
XML
<?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 auth_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,isCustomer)
|
|
values (#{roleName},
|
|
#{roleKey}, #{roleSort}, #{dataScope}, #{menuCheckStrictly}, #{deptCheckStrictly}, #{status}
|
|
, #{delFlag}, #{remark}, #{createBy}, #{createTime}, #{updateBy},#{isCustomer})
|
|
</insert>
|
|
|
|
|
|
<update id="updateById" parameterType="com.glxp.api.entity.auth.SysRole">
|
|
UPDATE auth_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="isCustomer != null">`isCustomer`=#{isCustomer},</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 auth_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 auth_role
|
|
where role_id = #{id}
|
|
</delete>
|
|
|
|
|
|
<select id="selectById" parameterType="java.lang.Long"
|
|
resultMap="SysRoleResult">
|
|
select *
|
|
FROM auth_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 auth_role r
|
|
left join auth_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.FilterRoleRequest"
|
|
resultMap="SysRoleResult">
|
|
SELECT *
|
|
FROM auth_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=" isCustomer != null " >
|
|
AND `isCustomer` = #{isCustomer}
|
|
</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 auth_role r
|
|
left join auth_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 auth_role r
|
|
left join auth_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 auth_role r
|
|
left join auth_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>
|