wecom-dashboards/excel-handle/src/main/resources/mapper/wecom/CustomerExportDataMapper.xml

252 lines
8.9 KiB
XML
Raw Normal View History

2026-02-07 15:55:56 +00:00
<?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.CustomerExportDataMapper">
2026-03-07 10:49:12 +00:00
<select id="countCustomerExportDataVOList" resultType="int">
SELECT count(1)
FROM customer_export_data
<where>
corp_id = #{corpId}
<if test="startDate != null">
AND add_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND add_time &lt;= #{endDate}
</if>
<if test="customerName != null">
AND customer_name like concat('%',#{customerName},'%')
</if>
</where>
</select>
2026-02-07 15:55:56 +00:00
<select id="getDistinctDate" resultType="java.util.Date">
select distinct add_date from customer_export_data where corp_id = #{corpId} order by add_date
2026-02-07 15:55:56 +00:00
</select>
<!-- 查询客户导出数据VO列表(用于导出) -->
<select id="selectCustomerExportDataVOList" resultType="com.ruoyi.excel.wecom.vo.CustomerExportDataVO">
SELECT
customer_name as customerName,
description,
add_user_name as addUserName,
add_user_account as addUserAccount,
add_user_department as addUserDepartment,
add_time as addTime,
add_date as addDate,
source,
mobile,
company,
email,
address,
position,
phone,
tag_group1 as tagGroup1,
tag_group2 as tagGroup2,
tag_group3 as tagGroup3,
tag_group4 as tagGroup4,
tag_group5 as tagGroup5,
tag_group6 as tagGroup6,
tag_group7 as tagGroup7,
tag_group8 as tagGroup8,
tag_group9 as tagGroup9,
tag_group10 as tagGroup10,
tag_group11 as tagGroup11,
tag_group12 as tagGroup12,
tag_group13 as tagGroup13,
tag_group14 as tagGroup14,
tag_group15 as tagGroup15,
tag_group16 as tagGroup16,
tag_group17 as tagGroup17,
tag_group18 as tagGroup18
FROM customer_export_data
<where>
corp_id = #{corpId}
2026-02-07 15:55:56 +00:00
<if test="startDate != null">
AND add_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND add_time &lt;= #{endDate}
</if>
<if test="customerName != null">
AND customer_name like concat('%',#{customerName},'%')
</if>
</where>
ORDER BY add_time DESC
</select>
<select id="selectCustomerExportDataList" resultType="com.ruoyi.excel.wecom.domain.CustomerExportData">
SELECT
customer_name as customerName,
description,
add_user_name as addUserName,
add_user_account as addUserAccount,
add_user_department as addUserDepartment,
add_time as addTime,
add_date as addDate,
source,
mobile,
company,
email,
address,
position,
phone,
tag_group1 as tagGroup1,
tag_group2 as tagGroup2,
tag_group3 as tagGroup3,
tag_group4 as tagGroup4,
tag_group5 as tagGroup5,
tag_group6 as tagGroup6,
tag_group7 as tagGroup7,
tag_group8 as tagGroup8,
tag_group9 as tagGroup9,
tag_group10 as tagGroup10,
tag_group11 as tagGroup11,
tag_group12 as tagGroup12,
tag_group13 as tagGroup13,
tag_group14 as tagGroup14,
tag_group15 as tagGroup15,
tag_group16 as tagGroup16,
tag_group17 as tagGroup17,
tag_group18 as tagGroup18
FROM customer_export_data
<where>
corp_id = #{corpId}
2026-02-07 15:55:56 +00:00
<if test="startDate != null">
AND add_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND add_time &lt;= #{endDate}
</if>
<if test="customerName != null">
AND customer_name like concat('%',#{customerName},'%')
</if>
</where>
ORDER BY add_time DESC
</select>
<!-- 根据客户唯一标识查询客户数据(客户名称+添加人账号+添加时间) -->
<select id="selectByUniqueKey" resultType="com.ruoyi.excel.wecom.domain.CustomerExportData">
SELECT *
FROM customer_export_data
WHERE
corp_id = #{corpId}
and
2026-03-06 09:11:45 +00:00
customer_user_id = #{customerUserId}
2026-02-07 15:55:56 +00:00
AND add_user_account = #{addUserAccount}
AND add_time = #{addTime}
LIMIT 1
</select>
2026-03-07 10:49:12 +00:00
<select id="selectByFinishDate" resultType="java.lang.Long">
select count(1) from customer_export_data
WHERE
corp_id = #{corpId} and finish_date = #{date}
<if test="attr != null and attr != '' and attr == 'tag_group1'">
AND tag_group1 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group2'">
AND tag_group2 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group3'">
AND tag_group3 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group4'">
AND tag_group4 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group5'">
AND tag_group5 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group6'">
AND tag_group6 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group7'">
AND tag_group7 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group8'">
AND tag_group8 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group9'">
AND tag_group9 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group10'">
AND tag_group10 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group11'">
AND tag_group11 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group12'">
AND tag_group12 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group13'">
AND tag_group13 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group14'">
AND tag_group14 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group15'">
AND tag_group15 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group16'">
AND tag_group16 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group17'">
AND tag_group17 is not null
</if>
<if test="attr != null and attr != '' and attr == 'tag_group18'">
AND tag_group18 is not null
</if>
</select>
<!-- 分页查询客户导出数据VO列表(用于异步导出) -->
<select id="selectCustomerExportDataVOListByPage" resultType="com.ruoyi.excel.wecom.vo.CustomerExportDataVO">
SELECT
customer_name as customerName,
description,
add_user_name as addUserName,
add_user_account as addUserAccount,
add_user_department as addUserDepartment,
add_time as addTime,
add_date as addDate,
source,
mobile,
company,
email,
address,
position,
phone,
tag_group1 as tagGroup1,
tag_group2 as tagGroup2,
tag_group3 as tagGroup3,
tag_group4 as tagGroup4,
tag_group5 as tagGroup5,
tag_group6 as tagGroup6,
tag_group7 as tagGroup7,
tag_group8 as tagGroup8,
tag_group9 as tagGroup9,
tag_group10 as tagGroup10,
tag_group11 as tagGroup11,
tag_group12 as tagGroup12,
tag_group13 as tagGroup13,
tag_group14 as tagGroup14,
tag_group15 as tagGroup15,
tag_group16 as tagGroup16,
tag_group17 as tagGroup17,
tag_group18 as tagGroup18
FROM customer_export_data
<where>
corp_id = #{corpId}
<if test="startDate != null">
AND add_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND add_time &lt;= #{endDate}
</if>
<if test="customerName != null">
AND customer_name like concat('%',#{customerName},'%')
</if>
</where>
ORDER BY add_time DESC
LIMIT #{limit} OFFSET #{offset}
</select>
2026-02-07 15:55:56 +00:00
</mapper>