wecom-dashboards/excel-handle/src/main/resources/mapper/wecom/CustomerDataChangeLogMapper...

46 lines
1.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.excel.wecom.mapper.CustomerDataChangeLogMapper">
<!-- 根据客户ID查询所有变更日志按时间倒序 -->
<select id="selectChangeLogByCustomerId" resultType="com.ruoyi.excel.wecom.domain.CustomerDataChangeLog">
SELECT *
FROM customer_data_change_log
WHERE customer_id = #{customerId}
ORDER BY change_time DESC
</select>
<!-- 根据历史记录ID查询变更日志 -->
<select id="selectChangeLogByHistoryId" resultType="com.ruoyi.excel.wecom.domain.CustomerDataChangeLog">
SELECT *
FROM customer_data_change_log
WHERE history_id = #{historyId}
ORDER BY log_id
</select>
<!-- 根据客户ID和版本号查询变更日志 -->
<select id="selectChangeLogByCustomerIdAndVersion" resultType="com.ruoyi.excel.wecom.domain.CustomerDataChangeLog">
SELECT *
FROM customer_data_change_log
WHERE customer_id = #{customerId} AND version = #{version}
ORDER BY log_id
</select>
<!-- 批量插入变更日志 -->
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO customer_data_change_log (
corp_id,
history_id, customer_id, version, field_name, field_label,
old_value, new_value, change_time
) VALUES
<foreach collection="changeLogs" item="item" separator=",">
(#{item.corpId},
#{item.historyId}, #{item.customerId}, #{item.version},
#{item.fieldName}, #{item.fieldLabel}, #{item.oldValue},
#{item.newValue}, #{item.changeTime}
)
</foreach>
</insert>
</mapper>