-
字段为字符串格式
<if test="test != null and test != ''">
and TEST like CONCAT(CONCAT('%',#{test}),'%')
</if>
-
字段为日期格式,前端传参格式为2020-03-09
<if test="testdate != null">
and TO_CHAR(TESTDATE, 'yyyy-MM-dd') like TO_CHAR(#{testdate}, 'yyyy-MM-dd')
</if>
-
字段为日期格式,前端传参格式为20200309
由于集成SpringBoot,导致传到后端格式转变成TIMPSTAMP 20200309-01-01 00:00:00,
需要先改entityParent.java的字段由日期格式改为String
/**
* TESTDATE
*/
private String testdate;
/**
* 获取 TESTDATE
*
* @return
*/
public String getTestdate(){
return testdate;
}
/**
* 设置 TESTDATE
*
* @param testdate
*/
public void setTestdate(String testdate){
this.testdate = testdate;
}
然后mapper.xml
<if test="effstartdate != null">
and TO_CHAR(EFFSTARTDATE, 'yyyyMM') like CONCAT(CONCAT('%',#{effstartdate}),'%')
</if>
来源:CSDN
作者:不朽的诗篇
链接:https://blog.csdn.net/weixin_41546488/article/details/104751481