TO_DAYS 就是从0年开始 到1997年10月7号之间的天数 DATE_FORMAT(NOW(),’%Y-%m-%d %H:%i:%s’) CURDATE() 2020-09-03 CURRENT_DATE() 2020-09-03
唯一键更新:ON DUPLICATE KEY UPDATE name = VALUES(name)
public Integer insertWechatUser(@Param("list")List<Map<String,String>> mapList);
INSERT INTO t_wechat_user
(userid,`name`, `department`)
VALUES
<foreach collection ="list" item="item" separator =",">
(#{item.employee_number},#{item.name}, CONCAT('[',#{item.department_id_department_code},']'))
</foreach >
ON DUPLICATE KEY UPDATE `name` = VALUES(`name`),update_time = VALUES(update_time)
foreach多参
public Integer updateBatchJoinRecordIsFinish(@Param("list") List<String> arr,@Param("isFinish") Integer isFinish);
<update id="updateBatchJoinRecordIsFinish" parameterType="java.util.List">
update t_customer_join_record
set is_finish = #{isFinish}
where `code` in
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item,jdbcType=VARCHAR}
</foreach>
</update>