<select id="qryCord4Mgr" parameterType="map" resultMap="com.lecing.qry.ms.dao.QryCord4MsDAO.rs_CordVO">
select
a.cordno,a.rity,a.flatno,a.flatn,a.fsubno,a.fsubn,a.fordno,a.custno,a.custname,a.custmbl,a.idcard,a.cardpic2,a.cardpic1,a.headpic,a.linkman,a.linkmbl,a.realnt,a.gathno,a.roomno,a.drm,a.xrean,a.xrea,a.blockn,a.blockno,a.doorno,a.cell,a.leaseday,a.mons,a.lineday,a.odds,a.epday,a.rent,a.mgrfee,a.step,a.pledge,a.pledge_pay,a.oncefee,a.oncefee_pay,a.paidmx,a.renew,a.renew_date,a.orgfc,a.mpyaskst,a.mpyaud,a.asktime,a.ask_expired,a.ztrino,a.ztrin,a.omgr,a.omgrno,a.note,a.est_rent,a.rent_es_no,a.rent_es_docid,a.est_mpy,a.mpy_rent_no,a.mpy_rent_docid,a.mpy_fc_no,a.mpy_fc_docid,a.cordst,a.spot,a.stewno,a.stewer,a.stewmbl,a.optor,a.optno,a.crtime,a.uptime,
b.last_mx,
c.batx_size,c.last_batx,c.last_out_mx,
d.fvoust
from cord a
left join cord_pay_inf b on a.cordno=b.cordno
left join cord_out_inf c on a.cordno=c.cordno
inner join room d on a.roomno=d.roomno
<if test="cordpayst_vilt!=null and flagst_vilt==‘cordpayst_vilt‘">
inner join cord_vilt f on a.cordno=f.cordno
</if>
<where>
<if test="flatno!=null and flatno!=‘‘">and a.flatno=#{flatno}</if>
<if test="xrea!=null and xrea==‘‘">and a.xrea!=#{xrea}</if>
<if test="fsubno!=null and fsubno!=‘‘">and a.fsubno=#{fsubno}</if>
<if test="rentype!=null and rentype==‘ZZ‘">and a.cell=‘0‘</if>
<if test="rentype!=null and rentype==‘HZ‘">and a.cell!=‘0‘</if>
<if test="mpyaskst!=null and mpyaskst==‘NONE‘">and a.mpyaskst=0</if>
<if test="mpyaskst!=null and mpyaskst==‘START‘">and a.mpyaskst=1</if>
<if test="mpyaskst!=null and mpyaskst==‘WAIT_AUD‘">and a.mpyaskst=2</if>
<if test="mpyaskst!=null and mpyaskst==‘SUCCESS‘">and a.mpyaskst=3</if>
<if test="mpyaskst!=null and mpyaskst==‘REJECT_CUST‘">and a.mpyaskst=4</if>
<if test="mpyaskst!=null and mpyaskst==‘REJECT_CREDIT‘">and a.mpyaskst=5</if>
<if test="mpyaskst!=null and mpyaskst==‘REJECT_RISK‘">and a.mpyaskst=6</if>
<if test="mpyaskst!=null and mpyaskst==‘VILT‘">and a.mpyaskst=7</if>
<if test="mpyaskst!=null and mpyaskst==‘VILT_DONE‘">and a.mpyaskst=8</if>
<if test="flagst!=null and flagst==‘NORMAL‘">and a.cordst=1</if>
<if test="flagst!=null and flagst==‘VILT_FC‘">and a.cordst=2</if>
<if test="flagst!=null and flagst==‘FINISHED‘">and a.cordst=3</if>
<if test="flagst!=null and flagst==‘VILT_RENT‘">and a.cordst=4</if>
<if test="flagst!=null and flagst==‘AUDITED‘">and a.cordst=5</if>
<if test="flagst!=null and flagst==‘DELIVED‘">and a.cordst=6</if>
<if test="flagst!=null and flagst==‘NULLIFY‘">and a.cordst=7</if>
<if test="flagst!=null and flagst==‘WIAT_DELIV‘">and a.cordst in(2,3,4)</if>
<if test="flagst!=null and flagst==‘ABOUT_CUST‘">and a.cordst=1 and date_add(curdate(), interval 45 day)>a.renew_date</if>
<if test="flagst!=null and flagst==‘OUTDATE_CUST‘">and a.cordst=1 and curdate()>a.renew_date</if>
<if test="custname!=null and custname!=‘‘">and a.custname=#{custname}</if>
<if test="custmbl!=null and custmbl!=‘‘">and a.custmbl=#{custmbl}</if>
<if test="idcard!=null and idcard!=‘‘">and a.idcard=#{idcard}</if>
<if test="crtime!=null and crtime==‘T0‘.toString()">and curdate()=date_format(a.crtime,‘%Y-%m-%d‘)</if>
<if test="crtime!=null and crtime==‘T1‘.toString()">and curdate()=date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 1 day)</if>
<if test="crtime!=null and crtime==‘T2‘.toString()">and curdate()=date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 2 day)</if>
<if test="crtime!=null and crtime==‘T3‘.toString()">and curdate()=date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 3 day)</if>
<if test="crtime!=null and crtime==‘T7‘.toString()">and curdate()>=date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 4 day) and date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 7 day)>=curdate()</if>
<if test="crtime!=null and crtime==‘T15‘.toString()">and curdate()>=date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 8 day) and date_add(date_format(a.crtime,‘%Y-%m-%d‘), interval 15 day)>=curdate()</if>
<if test="cordpayst_vilt!=null and flagst_vilt==‘cordpayst_vilt‘">
and a.cordst=2
<if test="flagst!=null and flagst==‘VILT_T7‘.toString()">and curdate()>date_add(f.crtime, interval 1 day) and date_add(f.crtime, interval 7 day)>=curdate()</if>
<if test="flagst!=null and flagst==‘VILT_T15‘.toString()">and curdate()>=date_add(f.crtime, interval 8 day) and date_add(f.crtime, interval 15 day)>=curdate()</if>
<if test="flagst!=null and flagst==‘VILT_T30‘.toString()">and curdate()>=date_add(f.crtime, interval 16 day) and date_add(f.crtime, interval 30 day)>=curdate()</if>
<if test="flagst!=null and flagst==‘VILT_GT30‘.toString()">and curdate()>=date_add(f.crtime, interval 31 day)</if>
</if>
</where>
order by a.crtime desc
limit #{rowStart},#{pageSize}
</select>
原文地址:http://blog.51cto.com/lavasoft/2154752