<?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 >= #{visitDto.startDate}
|
</if>
|
<if test="visitDto.endDate != null">
|
and cvl.creation_date <= #{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>
|