(CASE zczj.zczj_zadjdm WHEN '0101' THEN '0101' WHEN '0102' THEN'0102' WHEN '0104' THEN '0104' WHEN '0105' THEN'0105' WHEN '0111' THEN '0111' ELSE '9900' END) as ZADJDM,
(select count(1) from tb_xw_rybh bhr where asj.asjbh = bhr.asjbh and bhr.xxsc_pdbz='0' and bhr.RSSHCDDM='1' ) as bhrCount
from tb_st_asj asj inner join tb_xw_asjcz asjcz on asj.asjbh=asjcz.asjbh INNER JOIN tb_xw_zczj zczj on asj.asjbh=zczj.asjbh
where asj.xxsc_pdbz='0'
and asjcz.laywsjzt ='02'
and asj.sfma_pdbz = '1'
<iftest="unitcode != null and unitcode !=''">
and asj.LADW_GAJGJGDM in (
SELECT code FROM code_gxs WHERE CODE_LEV1 =#{unitcode, jdbcType=VARCHAR}
or CODE_LEV2 =#{unitcode, jdbcType=VARCHAR}
or CODE_LEV3 =#{unitcode, jdbcType=VARCHAR}
or CODE_LEV4 =#{unitcode, jdbcType=VARCHAR}
or CODE_LEV5 =#{unitcode, jdbcType=VARCHAR})
</if>
<iftest="larqQssj!=null and larqQssj!=''"><!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ <![CDATA[>=]]> DATE_FORMAT(#{larqQssj,jdbcType=VARCHAR},'%Y%m%d')
</if>
<iftest="larqJssj!=null and larqJssj!=''"><!--时间不为空 根据立案日期选择查询-->
AND ASJ.LARQ <![CDATA[<]]> DATE_ADD(#{larqJssj,jdbcType=VARCHAR},INTERVAL 1 DAY)
<iftest="larqQssj!=null and larqQssj!=''"><!--时间不为空 根据立案日期选择查询-->
AND DATE_FORMAT(ASJ.ZCZJ_ZXSJ01 ,'%Y%m%d')<![CDATA[>=]]> DATE_FORMAT(#{larqQssj,jdbcType=VARCHAR},'%Y%m%d')
AND ASJ.ZCZJ_ZXSJ01<![CDATA[>=]]> DATE_FORMAT(#{larqQssj,jdbcType=VARCHAR},'%Y%m%d')
</if>
<iftest="larqJssj!=null and larqJssj!=''"><!--时间不为空 根据立案日期选择查询-->
AND DATE_FORMAT(ASJ.ZCZJ_ZXSJ01 ,'%Y%m%d') <![CDATA[<=]]> DATE_FORMAT(#{larqJssj,jdbcType=VARCHAR},'%Y%m%d')
AND ASJ.ZCZJ_ZXSJ01 <![CDATA[<]]> DATE_ADD(#{larqJssj,jdbcType=VARCHAR},INTERVAL 1 DAY)
</if>
and asjcz.zczjywsjzt='02'
</sql>
...
...
@@ -581,6 +581,7 @@
<iftest="type=='zadj'">
INNER JOIN TB_XW_ZCZJ ZCZJ ON asj.asjbh=zczj.asjbh
<includerefid="pa-condition"/>
and zczj.xxsc_pdbz='0'
<iftest="code == '999'">
and (zczj.zczj_zadjdm='9900' or (SELECT CODE FROM SYS_DICTITEM WHERE GROUPID='CODE_ZADJ' AND CODE=zczj.zczj_zadjdm) IS NULL or (SELECT CODE FROM SYS_DICTITEM WHERE GROUPID='CODE_ZADJ' AND CODE=zczj.zczj_zadjdm) ='')