mybatis 中between and用法

今天遇到一个问题,半天没看出来问题,特意记录一下

Dao

ConfigEvaluation findConfigEvaluationByEvalpecent(BigDecimal evalPercent);

Mapper.xml

<select id="findConfigEvaluationByEvalpecent"  resultType="com.pacific.rspBonus.model.po.twBonus.mbg.ConfigEvaluation" parameterType="java.math.BigDecimal">
select * from Config_Evaluation
where #{evalPercent} between evalStart and evalEnd
</select>

Service
ConfigEvaluation configEvaluationByEvalpecent = configEvaluationMapperQuery.findConfigEvaluationByEvalpecent(new BigDecimal(8888));

我之前错把sql写成如下,导致半天没找到原因。所以以后遇到问题还是得仔细排查。
<select id="findConfigEvaluationByEvalpecent"  resultType="com.pacific.rspBonus.model.po.twBonus.mbg.ConfigEvaluation" parameterType="java.math.BigDecimal">
select * from Config_Evaluation
where evalPercent=#{evalPercent} between evalStart and evalEnd
</select>
 
上一篇:java – 日期范围中的日期范围


下一篇:运算符与日期之间的mysql