shenyijian
2024-06-21 f20611265f7d34fd4fbcdfdaff6cb9cccd0b25fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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="cn.gistack.sm.sg.mapper.SgProjectPersonConfigMapper">
 
    <select id="selectByUserId" resultType="cn.gistack.sm.sg.DO.SgProjectPersonConfigDO">
        select  * from YWXT.SG_PROJECT_PERSON_CONFIG where USER_ID = #{userId}
    </select>
    <select id="getRoleList" resultType="java.lang.String">
        SELECT
         <!--   pro.id,
            pro.project_name,
            sgc.gx_device_type as deviceType,
            d.id as deviceId, -->
            sgc.role_id as roleId
        FROM
            ywxt.sg_project_info pro
                LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
                LEFT JOIN ywxt.sg_gx_config sgc ON d.device_type = sgc.gx_device_type
        where 1=1
        <if test="dto.projectId != null">
            and pro.id = #{dto.projectId}
        </if>
    </select>
    <select id="getList" resultType="cn.gistack.sm.sg.DO.SgProjectRolePersonV0">
        SELECT
            DISTINCT
            sgc.role_id as roleId,
            pro.id as projectId,
            pro.project_name,
            ro.role_name
            --   d.id as device_id,
            --   d.device_name
            , sppc.user_id
            , sppc.id
            , bu.real_name as userName
        FROM
            ywxt.sg_project_info pro
                LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
                Left JOIN ywxt.sg_gx_config sgc ON d.device_type = sgc.gx_device_type
                left join ywxt.blade_role ro on    ro.id = sgc.role_id
                left join ywxt.sg_project_person_config sppc  on sgc.role_id = sppc.rold_id and sppc.program_id = pro.id
                left join ywxt.blade_user bu on sppc.user_id = bu.id
        where 1=1 and pro.id = #{dto.projectId}
    </select>
    <select id="getUserByRole" resultType="java.util.Map">
        select id,real_name as realName from ywxt.blade_user where role_id = #{roleId}
    </select>
</mapper>