ke
2024-11-26 b672cafe6a447c9b19691b583df9542ad84bce2c
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProgressReportMapper.xml
@@ -31,6 +31,7 @@
        <if test="dto.endTime != null and dto.endTime !='' ">
            and report.report_time &lt;= #{dto.endTime}
        </if>
        order by report_time desc
    </select>
    <select id="queryPageListAll" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
@@ -38,9 +39,11 @@
        report.*,
        de.device_name,
        de.device_type,
        dict."DICT_VALUE" as typeName
        dict."DICT_VALUE" as typeName, si.control_unit,si.self_unit,dria."county_cd"
        FROM
        ywxt.SG_PROGRESS_REPORT report
        LEFT JOIN ywxt.SG_PROJECT_INFO si ON report.profram_id = si.id
        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = si.sk_id
        LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
        left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
        where 1=1 and report."STATUS" != 4
@@ -59,10 +62,21 @@
        <if test="dto.endTime != null and dto.endTime != ''">
            and report.create_time &lt;= #{dto.endTime}
        </if>
        <if test="dto.typeName != null and dto.typeName != ''">
            and dict.DICT_KEY  = #{dto.typeName}
            <if test="dto.childTypeList != null and !dto.childTypeList.isEmpty()">
                or dict.DICT_KEY in
                <foreach collection="dto.childTypeList" open="(" close=")" separator="," item="id">
                    #{id}
                </foreach>
            </if>
        </if>
        order by report.report_time desc
    </select>
    <select id="queryById" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
        select * from  SG_PROGRESS_REPORT report where id = #{id}
        select report.*,si.control_unit,si.self_unit,dria."county_cd" from  SG_PROGRESS_REPORT report  LEFT JOIN ywxt.SG_PROJECT_INFO si ON report.profram_id = si.id
                                                  LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = si.sk_id where report.id = #{id}
    </select>
    <select id="queryList" resultType="cn.gistack.sm.sg.VO.SgProgressReportVO">
        SELECT distinct
@@ -79,15 +93,39 @@
        DBMS_LOB.SUBSTR(report.video_urls) videoUrls,
        de.device_name,
        de.device_type,
       <!-- userR.approval_status, -->
        dict."DICT_VALUE" as typeName
        MAX(userR.approval_status) as approval_status,
        dict."DICT_VALUE" as typeName,
        si.control_unit,si.self_unit,dria."county_cd"
        FROM
        ywxt.SG_PROGRESS_REPORT report
        LEFT JOIN ywxt.SG_PROJECT_INFO si ON report.profram_id = si.id
        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = si.sk_id
        LEFT JOIN ywxt.sg_device de ON report.gx_device_id = de.id
        left join YWXT."BLADE_DICT_BIZ" as dict  on de.device_type=dict.DICT_KEY  and dict.CODE='SG_DEVICE_TYPE'
        LEFT JOIN ywxt.sg_report_user userR ON report.id = userR.report_id
        WHERE
        1 = 1 and report."STATUS" != 4
        <if test="dto.selfUnit != null and dto.selfUnit.size>0">
            and
            <foreach collection="dto.selfUnit" item="item" index="index" open="(" separator="or" close=")">
                si.CONSTRUCTION_UNIT Like  CONCAT(CONCAT('%', #{item}), '%') or   si.SELF_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
            </foreach>
        </if>
        <if test="dto.userUnit != null and dto.userUnit.size>0">
            and
            <foreach collection="dto.userUnit" item="item" index="index" open="(" separator="or" close=")">
                si.CONTROL_UNIT Like  CONCAT(CONCAT('%', #{item}), '%')
            </foreach>
        </if>
        <if test="dto.countryUnit != null and dto.countryUnit.size>0">
            and dria."county_cd" in
            <foreach collection="dto.countryUnit" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        <if test="dto.roleUnit != null and dto.roleUnit != ''">
            and userR.role_id=#{dto.roleUnit}
        </if>
       <!-- AND userR.is_his = 0 -->
        <if test="dto.projectName != null and dto.projectName != ''">
            and report.PROGRAM_NAME like CONCAT(CONCAT('%',#{dto.projectName}),'%')
@@ -99,7 +137,7 @@
            and userR.user_id = #{dto.userId} and userR.approval_order != 0
        </if>
        <if test="dto.approvalStatus != null and dto.approvalStatus ==0">
            and userR.approval_status = 0 and report.audit_person = #{dto.auditPerson} and (report."STATUS" = 0 or report."STATUS" = 1)
            and userR.approval_status = 0 and report.audit_person = #{dto.roleUnit} and (report."STATUS" = 0 or report."STATUS" = 1)
        </if>
        <if test="dto.approvalStatus != null and dto.approvalStatus ==1">
           and userR.approval_status = 1
@@ -113,6 +151,25 @@
        <if test="dto.endTime != null and dto.endTime !='' ">
            and report.report_time &lt;= #{dto.endTime}
        </if>
        group by
        report.id,
        report.program_name,
        report.gx_step_name,
        report."STATUS",
        report.audit_person,
        report.report_time,
        report.create_time,
        report.gx_progress,
        report.remark,
        DBMS_LOB.SUBSTR( report.images_urls) ,
        DBMS_LOB.SUBSTR( report.video_urls ) ,
        de.device_name,
        de.device_type,
        dict."DICT_VALUE" ,
        si.control_unit,
        si.self_unit,
        dria."county_cd"
        order by report.report_time desc
        <!--<choose >
            <when test="dto.approvalStatus != null and dto.approvalStatus == 0">
                and report.audit_person = #{dto.userId} and (report."STATUS" = 0 or report."STATUS" = 1)
@@ -180,13 +237,24 @@
        </if>
    </select>
    <select id="getUserByIds" resultType="java.util.Map">
        select u.id ,u.real_name ,d.full_name as deptName from ywxt.blade_user u inner join ywxt.blade_dept d on u.dept_id = convert(varchar(100),d.id) where 1 = 1
        select u.id ,u.real_name ,d.full_name as deptName from ywxt.blade_user u inner join ywxt.blade_dept d on  u.dept_id like CONCAT('%', d.id, '%') where 1 = 1  and d."SG_CODE" is not null
        <if test="ids != null and ids.size>0">
            AND u.id in
            <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="getUserByIdsCounty" resultType="java.util.Map">
        select u.id ,u.real_name ,d.full_name as deptName from ywxt.blade_user u inner join ywxt.blade_dept d  on FIND_IN_SET(u.dept_id, d.id) > 0 where 1 = 1
        <if test="ids != null and ids.size>0">
            AND u.id in
            <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="selectProframId" resultType="java.lang.Long">
        select program_id from ywxt.sg_device where id = #{deviceId}
@@ -195,4 +263,16 @@
        select  u.* from ywxt.sg_report_user u left join  ywxt.sg_progresss_report r on u.report_id = r.id
        where 1=1 and r.profram_id = #{programId}
    </select>
    <select id="getRoleByIds" resultType="java.util.Map">
        select id,role_name as roleName from "YWXT"."BLADE_ROLE" WHERE 1=1
        <if test="ids != null and ids.size>0">
            AND id in
            <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="getSgEngineerRole" resultType="java.lang.Long">
        select id from "YWXT"."BLADE_ROLE" where parent_id = 1800818080896073730;
    </select>
</mapper>