<?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.CustomerStatisticsDataMapper">

    <!-- 根据标签ID查询标签 -->
    <select id="selectByDate" resultType="com.ruoyi.excel.wecom.vo.CustomerStatisticsVO">
        select *
        from customer_statistics_data
        where tag_id = #{tagId}
    </select>

    <!-- 查询客户统计数据列表 -->
    <select id="selectCustomerStatisticsDataList" resultType="com.ruoyi.excel.wecom.domain.CustomerStatisticsData">
        SELECT *
        FROM customer_statistics_data
        <where>
            <if test="startDate != null">
                AND cur_date &gt;= #{startDate}
            </if>
            <if test="endDate != null">
                AND cur_date &lt;= #{endDate}
            </if>
            <if test="indicatorName != null and indicatorName != ''">
                AND indicator_name LIKE CONCAT('%', #{indicatorName}, '%')
            </if>
        </where>
        ORDER BY cur_date DESC,sort_no
    </select>

    <!-- 查询客户统计数据VO列表(用于导出) -->
    <select id="selectCustomerStatisticsDataVOList" resultType="com.ruoyi.excel.wecom.vo.CustomerStatisticsDataVO">
        SELECT
        *
        FROM customer_statistics_data
        <where>
            <if test="startDate != null">
                AND cur_date &gt;= #{startDate}
            </if>
            <if test="endDate != null">
                AND cur_date &lt;= #{endDate}
            </if>
            <if test="indicatorName != null and indicatorName != ''">
                AND indicator_name LIKE CONCAT('%', #{indicatorName}, '%')
            </if>
        </where>
        ORDER BY cur_date DESC,sort_no
    </select>

</mapper>
