123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?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.energy.manage.service.mappers.system.SysRoleMapper">
- <select id="getRoleListByName" resultType="com.energy.manage.common.po.system.SysRolePO">
- SELECT
- id AS id,
- role_description AS roleDescription,
- role_code AS roleCode,
- role_available AS roleAvailable,
- role_type as roleType,
- source as source,
- create_time as createTime
- FROM sys_role
- where 1=1
- <if test="null != roleName and '' != roleName">
- and role_description LIKE CONCAT('%',#{roleName,jdbcType=VARCHAR},'%')
- </if>
- <if test="null != roleAvailable ">
- and role_available = #{roleAvailable}
- </if>
- ORDER BY id ASC
- </select>
- <update id="updateRoleSelective" parameterType="com.energy.manage.common.po.system.SysRolePO">
- UPDATE sys_role
- <set>
- <if test="null != roleDescription and '' != roleDescription">
- role_description = #{roleDescription,jdbcType=VARCHAR},
- </if>
- <if test="null != roleCode and '' != roleCode">
- role_code = #{roleCode,jdbcType=VARCHAR},
- </if>
- </set>
- WHERE id = #{id,jdbcType=INTEGER}
- </update>
- <!-- 通过userid查询用户角色code -->
- <select id="selectUserRoleCodeByUserId" resultType="java.lang.String">
- select
- role_code
- from
- sys_role r
- inner join
- sys_user_role ur on r.id = ur.role_id
- where 1=1
- and ur.user_id = #{userId}
- </select>
- <select id="selectRoleByUserId" resultType="com.energy.manage.common.po.system.SysRolePO">
- select
- r.*
- from sys_role r
- left join sys_user_role ur on r.id = ur.role_id
- where 1=1
- and ur.user_id= #{userId}
- </select>
- </mapper>
|