1.if
mybatis的xml 中 if 的判断一般 是string和int这2种
string 一般是用 status_order != '' and status_order != null and status_order != ‘null’
int 一般是status_order != 0 and status_order==5
2.like
mybatis的xml 中 like 的写法是 多个concat 函数 例如:name like concat(“%”,#{name},“%”)
3.时间大于小于
mybatis的xml 中 时间判断一般 这样写 >大于 <小于 >=大于等于 <=小于等于
and m.order_status >= 5 and m.order_status <= 8
<select id="listQueryCommodity" resultMap="OrderForm" parameterType="com.web.bean.WscOrderForm">
select m.*,s.name from dxw_mall.m_order_form m,dxw_mall.m_address s where s.id=m.address_content_id
<if test="status_order != '' and status_order != null and status_order != 0 and status_order != 2">
and m.order_status = #{status_order}
</if>
<if test="status_order == 2" >
and (m.order_status >=8 and m.order_status <=11 or m.order_status =2)
</if>
<if test="status_order == 0" >
and m.order_status = 0
</if>
<if test="status_text !=0 and status_text != 5 and status_text != 2 and status_text != '' and status_text != null">
and m.order_status = #{status_text}
</if>
<if test="status_text == 0 " >
and m.order_status = 0
</if>
<if test="status_text == 2 ">
and (m.order_status >=8 and m.order_status <=11 or m.order_status =2)
</if>
<if test="status_text == 5 ">
and m.order_status >= 5 and m.order_status < 8
</if>
<if test="starTime != '' and starTime != null">
and m.time >= #{starTime}
</if>
<if test="endTime != '' and endTime != null">
and m.time <= #{endTime}
</if>
<if test="qname != '' and qname != null">
and (s.name like CONCAT('%',#{qname},'%') OR s.phone like CONCAT('%',#{qname},'%') OR m.order_number like CONCAT('%',#{qname},'%'))
</if>
ORDER BY time desc
</select>