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>
 

猜你喜欢

转载自www.cnblogs.com/ming-blogs/p/10674909.html
今日推荐