<select id="get***" parameterType="com.***.entity.Order"
resultType="com.***.entity.Order">
SELECT tod.*, tu.account as creatorAccount, tu.username as creatorName
FROM tbl_order tod
left join tbl_user tu on tod.creator = tu.id
where tod.status != 5
<if test="order.orderNumber != null and order.orderNumber != '' ">
and tod.order_number LIKE CONCAT('%',#{order.orderNumber},'%')
</if>
<if test="order.status != null ">
and tod.status = #{order.status}
</if>
<if test="order.creatorAccount != null and order.creatorAccount != '' ">
and tu.account LIKE CONCAT('%',#{order.creatorAccount},'%')
</if>
<if test="order.createStart != null and order.createStart != '' ">
and tod.create_
示例如下: SELECT o.* FROM tbl_order o and o.status = #{order.status} and o.create_time >= #{order.createStart} and o.create_time <= #{order.createEnd} and o.creator = #{order.creator}