解决Data truncation: Truncated incorrect DOUBLE value问题
出错现场:
更新数据库造成数据截断不正确的双值
### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '2019-09-07'
错误原因:
在更新数据时,要修改的参数之间用and连接造成的
将and改为“,”逗号就好了。
<update id="updateInventory" parameterType="java.util.HashMap">
update inventory
set
<if test="inventoryDate != null and '' != inventoryDate">inventoryDate=#{inventoryDate}</if>
<if test="inventoryStatusId != null">and inventoryStatusId=#{inventoryStatusId}</if>
<if test="userCount != null and '' != userCount">and userCount=#{userCount}</if>
<if test="departNum != null and '' != departNum">and departNum=#{departNum}</if>
<if test="assetTakePeople != null and '' != assetTakePeople">and assetTakePeople=#{assetTakePeople}</if>
<if test="spanAdress != null">and spanAdress=#{spanAdress}</if>
<if test="storeNum != null ">and spanAdress=#{spanAdress}</if>
<if test="dicProfitLossNum != null">and dicProfitLossNum=#{dicProfitLossNum}</if>
where
assetNum=#{assetNum} and inventoryBatch=#{inventoryBatch}
</update>