[MyBatis]查询SQL得到一个数字

Mapper文件中写:

<select id="findExpiredCount" resultType="integer" parameterType="java.util.HashMap">
SELECT COUNT (*) as cnt from ${tableName} where created_datetime&lt;to_date(#{date},'yyyy-MM-dd') and created_user='12344' 
</select>

Java代码中写:

Map<String, String> expiredMap = new HashMap<String, String>();
expiredMap.put("tableName", tableName);
expiredMap.put("date", dateExpiredStr);
int countExpired = session.selectOne("findExpiredCount", expiredMap);

--END-- 2019-10-10

posted @ 2019-10-10 14:34  逆火狂飙  阅读(882)  评论(0编辑  收藏  举报
生当作人杰 死亦为鬼雄 至今思项羽 不肯过江东