guoshilong
2024-01-11 a331dacaa853a79efb78937dd49e5f6cca22ba69
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sjztmd/mapper/AttResBaseMapper.xml
@@ -10,6 +10,35 @@
            AND "name" LIKE CONCAT('%',#{attResBase.name},'%')
        </if>
    </select>
    <select id="selectAttResBaseGeneralInvestigation" resultType="cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO">
        select * from (
            select *,
            case
            when (select count(*) from sjzt_md."tb_res_general_investigation" b where a."guid" = b."res_guid" and b."check_state" = 2) > 0 THEN  '2'
            when (select count(*) from sjzt_md."tb_res_general_investigation" b where a."guid" = b."res_guid" and b."check_state" = 1) > 0 THEN  '1'
            when (select count(*) from sjzt_md."tb_res_general_investigation" b where a."guid" = b."res_guid" and b."check_state" = 0) > 0 THEN  '0'
            ELSE '-1'
            END AS tb_state
            from sjzt_md."att_res_base" a
        ) a WHERE "is_deleted"=0
        <if test="attResBase.name !=null and attResBase.name !=''">
            AND "name" LIKE CONCAT('%',#{attResBase.name},'%')
        </if>
        <if test="attResBase.code !=null and attResBase.code !=''">
            AND "code" LIKE CONCAT('%',#{attResBase.code},'%')
        </if>
        <if test="attResBase.resRegCode !=null and attResBase.resRegCode !=''">
            AND "res_reg_code" LIKE CONCAT('%',#{attResBase.resRegCode},'%')
        </if>
        <if test="attResBase.tbState !=null and attResBase.tbState !=''">
            AND tb_state = #{attResBase.tbState}
        </if>
    </select>
    <select id="getListByRegion" resultType="cn.gistack.sm.sjztmd.entity.AttResBase">
        SELECT arb."guid",arb."code",arb."name",arb."ad_guid",arb."eng_scal",arb."res_loc" FROM "att_res_base" arb
        left join "att_ad_base" aab on aab."guid" = arb."interior_ad_guid"