String QUERY_WHERE_SQL = " where 1=1 " +
//直接等于
"<if test='source!=null and source!=\"\" '>" +
" AND t.source = #{source} " +
"</if>" +
//字符串转日期
"<if test='dateStart!=null and dateStart!=\"\" '>" +
" AND t.date >= STR_TO_DATE(#{dateStart}, '%Y-%m-%d %H:%i:%s') " +
"</if>" +
"<if test='dateEnd!=null and dateEnd!=\"\" '>" +
" AND t.date <= STR_TO_DATE(#{dateEnd}, '%Y-%m-%d %H:%i:%s') " +
"</if>" +
//大小比较
"<if test='score!=null and score!=\"\" '>" +
"<if test='score >= 0 '>" +
" AND t.score >= 0 " +
"</if>" +
"<if test='score < 0 '>" +
" AND t.score < 0 " +
"</if>" +
"</if>" +
//模糊比较
"<if test='searchWord!=null and searchWord!=\"\" '>" +
" AND t.title like CONCAT('%',#{searchWord},'%') " +
"</if>" ;
ps:持续更新

407

被折叠的 条评论
为什么被折叠?



