<select id="purgetapplyfood" parameterType="java.util.Map" resultType="com.trueway.apply.model.someclass">
select * from(
select zaf.*,fo.NAME as foodname,ck.CKNAME,rownum idx from tablename zaf
LEFT JOIN ZHYY_FOOD_INFO fo
on fo.ID = zaf.foodid
left join ZHYY_CK ck
on ck.ID = zaf.ckid
<where>
<if test="applyid !=null and applyid !='' ">
applyid like concat(concat('%',replace(#{applyid},' ','')),'%')
</if>
<if test="applytime !=null and applytime !='' ">
and applytime like concat(concat('%',replace(#{applytime},' ','')),'%')
</if>
</where>
) s where status = #{status} and idx between #{begin} and #{end}
order by applyid
</select>
注意此处关于applyid,我写zaf.applyid则报错,原因还不知道
传的参数需要是map