2
sunshine
2024-11-05 d1f9fb55a136e589a5ad588ed9a93ce9272917da
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
38
39
40
41
42
43
<?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.H5LoanMarketViewLogMapper">
 
    <select id="getH5LoanMarketViewLogs" resultType="com.nova.sankuai.domain.vo.channel.H5LoanMarketViewVo">
        select
        ci.id as id,
        ci.code as code,
        IF(cvl.loan_market_id is null,null,ls.name) as suName,
        IF(cvl.channel_id is null,null,ci.name) as chName,
        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 h5_loan_market_view_log cvl
        inner join channel_info ci on cvl.channel_id = ci.id
        LEFT JOIN loan_supermarket ls ON cvl.loan_market_id = ls.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>
            <if test="visitDto.marketId != null">
                and ls.id = #{visitDto.marketId}
            </if>
        </where>
        group by ls.id,cvl.channel_id
        ORDER BY suName
    </select>
 
</mapper>