dao中定义方法:
List<KeyValueEntity> groupByDay(Date startDate, Date endDate);
在早期,参数没做注解时默认是按顺序获取,以0、1等为索引,所以Mapper是这样写的:
<select id="groupByDay" resultType="io.renren.modules.business.entity.template.KeyValueEntity">
select DATE_FORMAT(create_time, '%Y/%m/%d') as keyText, count(*) as value
from question_answer
where create_time BETWEEN #{0, jdbcType=DATE} AND #{1, jdbcType=DATE}
group by keyText
order by keyText
</select>
后来由0、1改为用arg0、arg1代替:
<select id="groupByDay" resultType="io.renren.modules.business.entity.template.KeyValueEntity">
select DATE_FORMAT(create_time, '%Y/%m/%d') as keyText, count(*) as value
from question_answer
where create_time BETWEEN #{arg0, jdbcType=DATE} AND #{arg1, jdbcType=DATE}
group by keyText
order by keyText
</select>
而新版的又改成以参数名使用:
<select id="groupByDay" resultType="io.renren.modules.business.entity.template.KeyValueEntity">
select DATE_FORMAT(create_time, '%Y/%m/%d') as keyText, count(*) as value
from question_answer
where create_time BETWEEN #{startDate, jdbcType=DATE} AND #{endDate, jdbcType=DATE}
group by keyText
order by keyText
</select>
对于当前库的强制更新,可以使用命令:
mvn clean install -U
对于下面打包命令,也是会使用新库:
mvn clean package