Java mybatis where条件 >= <=
原文:https://www.cnblogs.com/dragon-lan/p/15351920.html
实际上就是一个转义的问题,或者用声明的方式解决。特殊符号问题
<select id="select" parameterType="com.example.test1.model.Query" resultMap="BaseResultMap">
SELECT a.*, b.content as comment_content FROM (
SELECT * FROM oms_order
<where>
<if test="true"> 1=1</if>
<if test="start_time!=null and start_time!=''"> and order_create_time <![CDATA[>=]]> #{start_time}</if>
<if test="end_time!=null and end_time!=''"> and order_create_time <![CDATA[<=]]> #{end_time} </if>
<if test="store_name!=null and store_name!=''"> and store_name LIKE CONCAT('%',#{store_name},'%')</if>
<if test="product_name!=null and product_name!=''"> and product_name LIKE CONCAT('%',#{product_name},'%')</if>
</where>
LIMIT #{offset},#{limit}
) a
LEFT JOIN oms_comment as b ON b.id=a.comment_id
</select>

浙公网安备 33010602011771号