zhongrj
2023-07-06 3ce737b52fca082ac3a2ecda4a848e2e4abcd0ee
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/AttResBaseMapper.xml
@@ -11,7 +11,7 @@
        </if>
    </select>
    <select id="getListByRegion" resultType="cn.gistack.sm.sjztmd.entity.AttResBase">
        SELECT "guid","code","name","ad_guid","eng_scal" FROM "att_res_base"
        SELECT "guid","code","name","ad_guid","eng_scal","res_loc" FROM "att_res_base"
        WHERE "is_deleted"=0
         AND "ad_guid" LIKE CONCAT('%',#{obj.code},'%')
         <if test="obj.name !=null and obj.name !=''">
@@ -19,7 +19,7 @@
         </if>
    </select>
    <select id="getDetailByCode" resultType="cn.gistack.sm.sjztmd.entity.AttResBase">
        SELECT "code","name","ad_guid","guid" FROM "att_res_base"
        SELECT * FROM "att_res_base"
        WHERE "is_deleted"=0 and "code" = #{code}
    </select>
@@ -34,7 +34,10 @@
        trmp4."user_unit" technologyUnitName,trmp4."user_name" technologyUsername,trmp4."user_phone" technologyPhone,trmp4."position" technologyPosition,trmp4."guid" technologyUserGuid,
        trmp5."user_unit" patrolUnitName,trmp5."user_name" patrolUsername,trmp5."user_phone" patrolPhone,trmp5."position" patrolPosition,trmp5."guid" patrolUserGuid
        from SJZT_MD."att_res_base" arb
        left join "SJZT_MD"."att_ad_base" aab on aab."guid" = concat(arb."ad_guid",'000000')
        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"
        left join (
        select "res_guid",WM_Concat("guid") "guid",WM_Concat("user_unit") "user_unit",WM_Concat("user_name") "user_name",WM_Concat("user_phone") "user_phone",WM_Concat("position") "position"
        from "SJZT_MD"."att_res_manage_person" where  "type"=1 GROUP BY "res_guid"
@@ -97,11 +100,9 @@
                )
            )
        </if>
        <if test="list != null and list.size()>0">
            and aab."ad_code" in
            <foreach collection="list" item="adCode" separator ="," open="("  close=")">
                #{adCode}
            </foreach>
        <if test="params.adCode != null and params.adCode != '' ">
            and (aab."ad_code" = #{params.adCode} or aa."ad_code" = #{params.adCode} or ab."ad_code" = #{params.adCode} or ac."ad_code" = #{params.adCode})
        </if>
    </select>
@@ -122,8 +123,29 @@
        <if test="attResBase.interiorAdGuid !=null and attResBase.interiorAdGuid != ''">
            "interior_ad_guid" = #{attResBase.interiorAdGuid},
        </if>
        <if test="attResBase.label !=null and attResBase.label != ''">
            "label" = #{attResBase.label},
        </if>
        <if test="attResBase.label ==null or attResBase.label == ''">
            "label" = '',
        </if>
        "update_time" = #{attResBase.updateTime}
        WHERE "guid" = #{attResBase.guid}
    </update>
    <!--查询当前水库对应的市级编号和县区编号-->
    <select id="getCityCountyCodeByResGuid" resultType="cn.gistack.sm.sjztmd.vo.AttResBaseVO">
        SELECT
            case when b."ad_grad" = 3 THEN b."ad_code"
                 when c."ad_grad" = 3 THEN c."ad_code" END AS countyCode,
            case when b."ad_grad" = 2 THEN b."ad_code"
                 when c."ad_grad" = 2 THEN c."ad_code"
                 ELSE d."ad_code" END AS cityCode
        FROM sjzt_md."att_res_base" a
        LEFT JOIN sjzt_md."att_ad_base" b ON a."interior_ad_guid" = b."guid"
        LEFT JOIN sjzt_md."att_ad_base" c ON b."p_ad_code" = c."guid"
        LEFT JOIN sjzt_md."att_ad_base" d ON c."p_ad_code" = d."guid"
        where a."guid" = #{guid}
    </select>
</mapper>