DAO public List<ChargeInfoMainDTO> findChargeInfoMainMapParams(Map<String,Object> params);
<select id="findChargeInfoMainMapParams" resultMap="BaseResultMap" >
select
t.CHARGE_INFO_MAIN_ID,
t.CHARGE_NO,
t1.NAME as PATIENT_NAME,
t2.NAME as CHARGE_NAME
from CS_CHARGE_INFO_MAIN t
left join HR_PATIENT_INFO t1 on t.PATIENT_ID=t1.PATIENT_ID
left join SYS_USER t2 on t.USER_ID=t2.USER_ID
where t.NONCHARGE_FLAG in
<foreach collection="flags" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="chargeInfoMainId!=null and chargeInfoMainId!=''">
and t.CHARGE_INFO_MAIN_ID = #{chargeInfoMainId}
</if>
<if test="chargeNo!=null and chargeNo!=''">
and t.CHARGE_NO like '%'||#{chargeNo}||'%'
</if>
<if test="patientName!=null and patientName!=''">
and t1.NAME like '%'||#{patientName}||'%'
</if>
<if test="chargeName!=null and chargeName!=''">
and t2.NAME like '%'||#{chargeName}||'%'
</if>
<if test="chargeDateStart!=null and chargeDateStart!=''">
<![CDATA[ and t.CHARGE_DATE>=#{chargeDateStart,jdbcType=VARCHAR}]]>
</if>
<if test="chargeDateEnd!=null and chargeDateEnd!=''">
<![CDATA[ and t.CHARGE_DATE<=#{chargeDateEnd,jdbcType=VARCHAR} ]]>
</if>
order by t.CHARGE_DATE desc
</select>