select a.xh,a.xm,a.TITLE,b.BJMC,b.XYMC,b.NJ from ypc_db.gxxs_tsgjc a LEFT JOIN (select XH,BJMC,XYMC,BJDM,NJ,LXDH from ypc_db.xsxxb union all select XH,BJMC,XYMC,BJDM,NJ,LXDH from ypc_db.xsxxb_other) b on a.XH=b.xh where 1=1 ${if(len(XH) == 0,"","and XH = '" + XH + "'")}${if(len(XM) == 0,"","and XM = '" + XM + "'")} AND b.XH is not NULL and MONTH(time)=MONTH(SYSDATE())and XYMC='${XYMC}'