guoshilong
2024-01-25 91fff6d21fcec11fca3097cd7641d9ea9ebfda8d
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/resDataCheck/mapper/QualityManageMapper.xml
@@ -5,29 +5,57 @@
    <select id="selectCustomizePage" resultType="cn.gistack.sm.resDataCheck.vo.QualityManageVO">
        SELECT
               arb."guid" AS resGuid,
               arb."name" AS resName,
               arb."res_loc" AS resLoc,
                CASE aab."ad_name"
                when '' then
                CASE aa."ad_name" when '' then
                CASE ab."ad_name" when '' then ac."ad_name" else ab."ad_name" end
                else aa."ad_name"
                END
                else aab."ad_name"
                END  adName,
               arb."res_reg_code" AS resRegCode,
               arb."eng_scal" AS engScal,
               rule.name AS ruleName,
               rule.description AS ruleDesc,
               rule.pro_description AS proDesc,
               qm.*
        FROM
            SM_RES_DATA_QUALITY_MANAGE qm
        FROM (
            select * from  SM_RES_DATA_QUALITY_MANAGE qm
            WHERE qm.is_deleted = 0
            <if test="vo.startTime !=null and vo.startTime !=''">
                AND qm.create_time &gt;= #{vo.startTime}
            </if>
            <if test="vo.endTime !=null and vo.endTime !=''">
                AND qm.create_time &lt;= #{vo.endTime}
            </if>
        ) as qm
        LEFT JOIN SJZT_MD."att_res_base" arb ON arb."guid" = qm.res_id
        LEFT JOIN SM_RES_DATA_CHECK_RULES rule ON rule.id = qm.rule_id
        WHERE qm.is_deleted = 0
        <if test="vo.resName !=null and vo.resName !='' ">
            AND arb."name" LIKE CONCAT('%',#{vo.resName},'%')
        </if>
        <if test="vo.engScal !=null and vo.engScal !='' ">
            AND arb."eng_scal"  = #{vo.engScal}
        </if>
        <if test="vo.ruleName !=null and vo.ruleName !='' ">
            AND rule.name LIKE CONCAT('%',#{vo.ruleName},'%')
        </if>
        left join "SJZT_MD"."att_ad_base" aab on aab."guid" = arb."interior_ad_guid"
        left join "SJZT_MD"."att_ad_base" aa on aab."p_ad_code" = aa."ad_code"
        left join "SJZT_MD"."att_ad_base" ab on aa."p_ad_code" = ab."ad_code"
        left join "SJZT_MD"."att_ad_base" ac on ab."p_ad_code" = ac."ad_code"
        <where>
            <if test="vo.resName !=null and vo.resName !='' ">
                AND arb."name" LIKE CONCAT('%',#{vo.resName},'%')
            </if>
            <if test="vo.engScal !=null and vo.engScal !='' ">
                AND arb."eng_scal"  = #{vo.engScal}
            </if>
            <if test="vo.ruleName !=null and vo.ruleName !='' ">
                AND rule.name LIKE CONCAT('%',#{vo.ruleName},'%')
            </if>
            <if test="vo.adCode != null and vo.adCode != '' ">
                and (aab."ad_code" = #{vo.adCode} or aa."ad_code" = #{vo.adCode} or ab."ad_code" = #{vo.adCode} or ac."ad_code" = #{vo.adCode})
            </if>
        </where>
        order by qm.create_time desc
    </select>
    <select id="getDetail" resultType="cn.gistack.sm.resDataCheck.vo.QualityManageVO">
        SELECT
@@ -47,8 +75,8 @@
    </select>
    <insert id="addQualityManage">
        insert into SM_RES_DATA_QUALITY_MANAGE (res_id,rule_id,create_time,update_time)
        select a."guid" as res_id,#{ruleId},NOW(),NOW()
        insert into SM_RES_DATA_QUALITY_MANAGE (res_id,rule_id,create_time,update_time,val)
        select a."guid" as res_id,${ruleId} AS rule_id,NOW() AS create_time,NOW() AS update_time, ${varStr}
        from SJZT_MD."att_res_base" a
                 left join SJZT_MD."att_res_danger_manage_special" b on (a."guid" = b."res_guid")
                 left join SJZT_MD."att_res_stag_char" c on (a."guid" = c."res_guid")
@@ -59,9 +87,7 @@
                 left join SJZT_MD."st_rsvr_r_last" f on (e."code" = f."stcd")
                 left join (select tmp."res_guid",max(tmp."tb_weir_top_elevation") "tb_weir_top_elevation" from SJZT_MD."att_res_rsb_norspi" tmp group by tmp."res_guid") g on (a."guid" = g."res_guid")
                 left join (select tmp2."res_guid",max(tmp2."tb_dam_top_elevation") "tb_dam_top_elevation" from SJZT_MD."att_res_water_block" tmp2 group by tmp2."res_guid") h on (a."guid" = h."res_guid")
        <where>
            #{whereStr}
        </where>
            ${whereStr}
    </insert>
</mapper>