sunshine
2024-11-05 1bd51ea22b75760704843d9bed886a7262bb1cb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?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.nova.sankuai.infra.mapper.ChannelViewLogMapper">
 
    <select id="getChannelVisitList" resultType="com.nova.sankuai.domain.vo.channel.ChannelVisitVo">
        select
        ci.id as id,
        ci.code as code,
        ci.name as name,
        ci.app_id as appId,
        sum(IF((cvl.visit_type='0'),1,0)) as uvCount,
        sum(IF((cvl.visit_type='1'),1,0)) as pvCount,
        #{visitDto.startDate} as startDate,
        #{visitDto.endDate} as endDate
        from channel_view_log cvl
        inner join channel_info ci on cvl.channel_id = ci.id
        <where>
            ci.type = 0
            <if test="visitDto.startDate != null">
                and cvl.creation_date &gt;= #{visitDto.startDate}
            </if>
            <if test="visitDto.endDate != null">
                and cvl.creation_date &lt;= #{visitDto.endDate}
            </if>
            <if test="visitDto.code != null">
                and ci.code = #{visitDto.code}
            </if>
            <if test="visitDto.name != null and visitDto.name !=''">
                and ci.name like concat('%',#{visitDto.name},'%')
            </if>
        </where>
        group by cvl.channel_id
    </select>
 
</mapper>