You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.3 KiB

<?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.epmet.dao.GovStaffRoleDao">
<resultMap type="com.epmet.entity.GovStaffRoleEntity" id="govStaffRoleMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="roleKey" column="ROLE_KEY"/>
<result property="roleName" column="ROLE_NAME"/>
<result property="orgType" column="ORG_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<!--根据staffId查询具有的角色列表-->
<select id="listRolesByStaffId" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT
r.*
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID ) AND r.DEL_FLAG = '0'
WHERE
sr.STAFF_ID = #{staffId}
AND sr.ORG_ID = #{orgId}
AND sr.DEL_FLAG = '0'
AND r.DEL_FLAG = '0'
</select>
<select id="selectGovStaffRoleList" resultType="com.epmet.dto.GovStaffRoleDTO" parameterType="com.epmet.dto.GovStaffRoleDTO">
select
*
from
gov_staff_role
where
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
ORDER BY SORT ASC
</select>
<!--查询客户的指定roleKey的角色信息-->
<select id="getRoleByCustomerIdAndRoleKey" resultType="com.epmet.dto.GovStaffRoleDTO">
SELECT *
FROM gov_staff_role
WHERE CUSTOMER_ID = #{customerId}
AND ROLE_KEY = #{roleKey}
AND DEL_FLAG = '0'
</select>
<select id="listRolesByCustomer" resultType="com.epmet.dto.result.GovStaffRoleResultDTO">
SELECT r.ID AS roleId,
r.CUSTOMER_ID AS customerId,
r.ROLE_KEY AS roleKey,
r.ROLE_NAME AS roleName,
r.ORG_TYPE AS orgType
FROM gov_staff_role r
WHERE r.CUSTOMER_ID = #{customerId}
</select>
<select id="getDTOById" resultType="com.epmet.dto.result.GovStaffRoleResultDTO">
SELECT gsr.ID AS roleId,
gsr.ROLE_KEY AS roleKey,
gsr.ROLE_NAME AS roleName,
gsr.CUSTOMER_ID AS customerId,
gsr.ORG_TYPE AS orgType
FROM gov_staff_role gsr WHERE ID = #{roleId}
</select>
<!-- 查询用户的权限 -->
<select id="getRoleInfoList" resultType="com.epmet.dto.result.RoleResultDTO">
SELECT
gsr.role_key AS roleKey,
gsr.role_name AS roleName,
sr.staff_id AS userId
FROM
gov_staff_role gsr
LEFT JOIN staff_role sr ON sr.role_id = gsr.id
WHERE
gsr.del_flag = 0
AND sr.del_flag = 0
AND
5 years ago
(
<foreach collection="userIds" item="userId" separator="OR">
sr.staff_id = #{userId}
</foreach>
)
</select>
</mapper>