shenyijian
2024-06-28 f7beae39603d6a1ea76da6b0b757906b2a2932cc
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?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.SgProjectInfoMapper">
 
    <select id="queryPageList" resultType="cn.gistack.sm.sg.DO.SgProjectInfoDO">
        SELECT
        info.*,
        dria."city_nm",
        dria."county_nm",
        dria."town_nm",
        dria."eng_scal",
        dria."bas_guid"
        FROM
        YWXT.SG_PROJECT_INFO info
        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
        WHERE
        1 =1
        <if test="dto.projectName != null and dto.projectName != ''">
            and info.project_name like concat( concat ('%',#{dto.projectName}),'%')
        </if>
        <if test="dto.skName != null and dto.skName != ''">
            and info.sk_name like concat(concat('%',#{dto.skName}),'%')
        </if>
        <if test="dto.projectIds != null and dto.projectIds.size > 0">
            and info.id in
         <foreach collection="dto.projectIds" item="id" separator="," open="(" close=")">
             #{id}
         </foreach>
        </if>
    </select>
    <select id="queryStepByProject" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
        SELECT
        pro.id,
        pro.project_name,
        gx.id as gxId,
        gx.gx_name,
        d.device_name,
        d.device_type,
        dict."DICT_VALUE" as typeName,
        d.id as dId,
        step.gx_step_name,
        step.gx_step_num,
        step.id as stepId,
        re.STATUS as reportStatus,
        d.STATUS as deviceStatus,
        pro.STATUS as projectStatus,
        re.id as reportId,
        pro.lon_lat
        FROM
        ywxt.sg_project_info pro
        LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
        left join YWXT."BLADE_DICT_BIZ" as dict  on d.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
        LEFT JOIN ywxt.sg_gx gx ON d.device_type = gx.gx_type
        LEFT JOIN ywxt.sg_gx_step step ON gx.id = step.gx_info_id
        LEFT JOIN ywxt.sg_progress_report re ON re.gx_step_id = step.id and re.gx_device_id = d.id
        where 1=1
        <if test="dto.projectId != null and dto.projectId != ''">
            and pro.id = #{dto.projectId}
        </if>
        <if test="dto.projectName != null and dto.projectName != ''">
            and pro.project_name like CONCAT(CONCAT('%', #{dto.projectName}), '%')
        </if>
        <if test="dto.status != null">
            and pro.status = #{dto.status}
        </if>
        <if test="dto.projectIds != null and dto.projectIds.size > 0">
            and pro.id in
            <foreach collection="dto.projectIds" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
    <select id="progressList" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
        SELECT
            pro.id,
            pro.project_name,
            pro.lon_lat,
            pro.status
        FROM
            ywxt.sg_project_info pro where 1=1
    <if test="dto.status != null">
        and pro.status = #{dto.status}
    </if>
     <if test="dto.projectName != null and dto.projectName != ''">
         and pro.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
     </if>
    </select>
</mapper>