|
@@ -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.jjt.system.mapper.SysRoleMapper">
|
|
|
+
|
|
|
+ <resultMap type="SysRole" id="SysRoleResult">
|
|
|
+ <result 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>
|
|
|
+
|
|
|
+ <sql id="selectSysRoleVo">
|
|
|
+ select role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, create_by, create_time, update_by, update_time, remark from sys_role
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectSysRoleList" parameterType="SysRole" resultMap="SysRoleResult">
|
|
|
+ <include refid="selectSysRoleVo"/>
|
|
|
+ <where>
|
|
|
+ <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="roleSort != null "> and role_sort = #{roleSort}</if>
|
|
|
+ <if test="dataScope != null and dataScope != ''"> and data_scope = #{dataScope}</if>
|
|
|
+ <if test="menuCheckStrictly != null "> and menu_check_strictly = #{menuCheckStrictly}</if>
|
|
|
+ <if test="deptCheckStrictly != null "> and dept_check_strictly = #{deptCheckStrictly}</if>
|
|
|
+ <if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSysRoleByRoleId" parameterType="Long" resultMap="SysRoleResult">
|
|
|
+ <include refid="selectSysRoleVo"/>
|
|
|
+ where role_id = #{roleId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertSysRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
|
|
|
+ insert into sys_role
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="roleName != null and roleName != ''">role_name,</if>
|
|
|
+ <if test="roleKey != null and roleKey != ''">role_key,</if>
|
|
|
+ <if test="roleSort != null">role_sort,</if>
|
|
|
+ <if test="dataScope != null">data_scope,</if>
|
|
|
+ <if test="menuCheckStrictly != null">menu_check_strictly,</if>
|
|
|
+ <if test="deptCheckStrictly != null">dept_check_strictly,</if>
|
|
|
+ <if test="status != null and status != ''">status,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="roleName != null and roleName != ''">#{roleName},</if>
|
|
|
+ <if test="roleKey != null and roleKey != ''">#{roleKey},</if>
|
|
|
+ <if test="roleSort != null">#{roleSort},</if>
|
|
|
+ <if test="dataScope != null">#{dataScope},</if>
|
|
|
+ <if test="menuCheckStrictly != null">#{menuCheckStrictly},</if>
|
|
|
+ <if test="deptCheckStrictly != null">#{deptCheckStrictly},</if>
|
|
|
+ <if test="status != null and status != ''">#{status},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateSysRole" parameterType="SysRole">
|
|
|
+ update sys_role
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="roleName != null and roleName != ''">role_name = #{roleName},</if>
|
|
|
+ <if test="roleKey != null and roleKey != ''">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 and status != ''">status = #{status},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</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>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ </trim>
|
|
|
+ where role_id = #{roleId}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteSysRoleByRoleId" parameterType="Long">
|
|
|
+ delete from sys_role where role_id = #{roleId}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteSysRoleByRoleIds" parameterType="String">
|
|
|
+ delete from sys_role where role_id in
|
|
|
+ <foreach item="roleId" collection="array" open="(" separator="," close=")">
|
|
|
+ #{roleId}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+</mapper>
|