XXXXMapper 接口: 这里判断数据不能为空
@Select("<script>"
+ "select * from gs_store"
+ " <where>"
+ " <if test='storeTel != null' > "
+ " and store_tel = #{storeTel}"
+ " </if>"
+ "</where>"
+ "</script>")
List<GsStore> getStoreInfoBySelect(@Param("storeTel")String storeTel);
判断空字符串,在 Controller 里判断:
public String XXXXX(String test) {
// 如果等于空字符串
if(StringUtils.isBlank(test)) {
// 则转化成 null
storeTel = null;
}
return "1";
}
标签:判断,String,字符串,test,为空,SQL,MyBatis,storeTel,null
From: https://blog.51cto.com/u_16270801/7691813