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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?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.CapitalInfoMapper">
 
    <select id="pageModel" resultType="com.nova.sankuai.domain.vo.capitalresult.CapitalInfoVo">
        select *
        from capital_info
        <where>
            delete_flag = 0 and is_show_back_stage = 1
            <if test="pageDto.name != null and pageDto.name !=''">
                and name like concat('%',#{pageDto.name},'%')
            </if>
 
            <if test="pageDto.code != null and pageDto.code !=''">
                and code like concat('%',#{pageDto.code},'%')
            </if>
        </where>
        order by seq
    </select>
 
    <select id="getVerifyCapitalList" resultType="com.nova.sankuai.domain.vo.capitalresult.CapitalInfoVo">
        select ci.id as id,
        ci.name as name,
        ci.code as code,
        ci.enable_flag as enableFlag,
        ci.icon_url as iconUrl
        from customer_capital_result ccr
        left join capital_info ci on ccr.capital_info_id = ci.id
        where ci.delete_flag = 0 and ccr.delete_flag = 0
        and ci.enable_flag = 1
        and ccr.check_result = 1
        and ccr.customer_record_id = #{customerId}
        and ccr.customer_user_id = #{customerUserId}
    </select>
 
    <select id="capitalHomePageShow" resultType="com.nova.sankuai.domain.vo.CapitalHomePageShowDbVo">
        SELECT id as id,
        icon_url as iconUrl,
        page_display_type as pageDisplayType,
        city_limit as cityLimit,
        name as name
        from capital_info
        WHERE is_show_page = 1 AND delete_flag = 0 and enable_flag = 1 AND fund_type =1 AND `code` in
        <foreach collection="codes" item="item" index="index" open="(" close=")" separator=",">
            #{item}
        </foreach>
    </select>
 
    <select id="gettVerifyAutoPushCapitalList" resultType="com.nova.sankuai.domain.entity.CapitalInfo">
        select ci.*
        from customer_capital_result ccr
        inner join capital_info ci on ci.id  = ccr.capital_info_id
        where ccr.check_result = 1 and ci.auto_push = 0 AND ccr.`status` = 0
        AND ccr.customer_record_id = #{customerId}
        AND ccr.customer_user_id = #{customerUserId}
    </select>
 
 
    <select id="getSelectIncomeConfigs" resultType="com.nova.sankuai.domain.vo.IncomeConfigItemVo">
        select
        id as configRecordId,
        name as configRecordName,
        code as configRecordCode,
        '0' as type
        from capital_info
        where delete_flag = 0
    </select>
    <select id="selectOrdinaryApplyData" resultType="com.nova.sankuai.domain.entity.CapitalInfo">
        SELECT ci.*,ccr.quota_rate FROM customer_capital_result ccr
        LEFT JOIN capital_info ci ON ccr.capital_info_id = ci.id
        WHERE ccr.customer_record_id = #{customerId}
          <choose>
              <when test="approvalResult != null">
                AND ccr.approval_result = #{approvalResult}
              </when>
              <otherwise>
                  AND ccr.check_result = 1
              </otherwise>
          </choose>
            AND ci.auto_push=#{autoPush} AND ci.collion_mode=#{collionMode} AND ci.fund_type=0 AND enable_flag = 1 AND ci.delete_flag = 0
        ORDER BY ci.seq DESC LIMIT 1
    </select>
 
    <select id="selectOrdinaryApplyDataVm" resultType="com.nova.sankuai.domain.entity.CapitalInfo">
        SELECT ci.*,ccr.quota_rate FROM customer_capital_result_vm ccr
        LEFT JOIN capital_info ci ON ccr.capital_info_id = ci.id
        WHERE ccr.customer_record_id = #{customerId}
        <choose>
            <when test="approvalResult != null">
                AND ccr.approval_result = #{approvalResult}
            </when>
            <otherwise>
                AND ccr.check_result = 1
            </otherwise>
        </choose>
        AND ci.auto_push=#{autoPush} AND ci.collion_mode=#{collionMode} AND ci.fund_type=0 AND enable_flag = 1 AND ci.delete_flag = 0
        ORDER BY ci.seq DESC LIMIT 1
    </select>
 
    <!-- 第0优先级 -->
    <select id="zeroPriority" resultType="com.nova.sankuai.domain.entity.CapitalInfo">
        SELECT ci.*,ccr.quota_rate FROM customer_capital_result ccr
        LEFT JOIN capital_info ci ON ccr.capital_info_id = ci.id
        WHERE ccr.customer_record_id = #{customerId}
        AND ci.fund_type=1 AND ci.delete_flag = 0
        ORDER BY ci.seq ASC limit 3
    </select>
 
    <!-- 第0优先级,虚拟,h5单页面开启的 -->
    <select id="zeroPriorityVm" resultType="com.nova.sankuai.domain.entity.CapitalInfo">
        SELECT ci.*,ccr.quota_rate FROM customer_capital_result_vm ccr
        LEFT JOIN capital_info ci ON ccr.capital_info_id = ci.id
        WHERE ccr.customer_record_id = #{customerId}
          AND ci.fund_type=1 AND ci.delete_flag = 0
        ORDER BY ci.seq ASC limit 3
    </select>
</mapper>