56 lines
2.6 KiB
XML
56 lines
2.6 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.das.modules.auth.mapper.SysRoleMapper">
|
|
|
|
<resultMap type="com.das.modules.auth.entity.SysRole" id="SysRoleMap">
|
|
<result property="id" column="id" jdbcType="BIGINT"/>
|
|
<result property="roleCode" column="role_code" jdbcType="VARCHAR"/>
|
|
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
|
|
<result property="revision" column="revision" jdbcType="VARCHAR"/>
|
|
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
|
<result property="createdTime" column="created_time" jdbcType="VARCHAR"/>
|
|
<result property="updatedBy" column="updated_by" jdbcType="VARCHAR"/>
|
|
<result property="updatedTime" column="updated_time" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<resultMap type="com.das.modules.auth.domain.vo.SysRoleVo" id="SysRoleAuthMap">
|
|
<result property="id" column="id" jdbcType="BIGINT"/>
|
|
<result property="roleCode" column="role_code" jdbcType="VARCHAR"/>
|
|
<result property="roleName" column="role_name" jdbcType="VARCHAR"/>
|
|
<result property="revision" column="revision" jdbcType="VARCHAR"/>
|
|
<collection property="list" column="id" ofType="com.das.modules.auth.domain.vo.SysRoleAuthVo" select="queryAuthorityById"/>
|
|
</resultMap>
|
|
|
|
<select id="queryRoleList" resultMap="SysRoleAuthMap">
|
|
select * from sys_role
|
|
<where>
|
|
<if test="sysRole.roleName != null and sysRole.roleName != ''">
|
|
and role_name like concat('%',#{sysRole.roleName},'%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<select id="existRoleByRoleCode" resultType="java.lang.Long">
|
|
select count(1) from sys_role t where t.role_code=#{roleCode}
|
|
</select>
|
|
|
|
<select id="existRoleByRoleId" resultType="java.lang.Long">
|
|
select count(1) from sys_role t where t.id=#{id}
|
|
</select>
|
|
|
|
<select id="queryAuthorityById" resultType="com.das.modules.auth.domain.vo.SysRoleAuthVo">
|
|
select sa.id, sa.authority_code as authorityCode, sa.authority_name as authorityName from sys_authority sa left join sys_r_role_authority srra on sa.id = srra.authority_id
|
|
where srra.role_id = #{id}
|
|
</select>
|
|
|
|
<select id="selectByCode" resultMap="SysRoleMap">
|
|
select * from sys_role t where t.role_code=#{roleCode}
|
|
</select>
|
|
|
|
<select id="existRoleByName" resultType="java.lang.Long">
|
|
select count(1) from sys_role t where t.role_name=#{name}
|
|
</select>
|
|
|
|
</mapper>
|