Helius
2021-06-30 02b38bb7c08d68fffc6af25e4ba00a456d96e94e
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?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.xzx.gc.user.mapper.CityPartnerMapper">
  <resultMap id="BaseResultMap" type="com.xzx.gc.entity.CityPartner">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="account_no" jdbcType="VARCHAR" property="accountNo" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="partner_name" jdbcType="VARCHAR" property="partnerName" />
    <result column="mobile_phone" jdbcType="VARCHAR" property="mobilePhone" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="effective_statr_time" jdbcType="VARCHAR" property="effectiveStatrTime" />
    <result column="effective_end_time" jdbcType="VARCHAR" property="effectiveEndTime" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="org_id" jdbcType="INTEGER" property="orgId" />
    <result column="state" jdbcType="VARCHAR" property="state" />
    <result column="job_type1" jdbcType="VARCHAR" property="jobType1" />
    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
    <result column="update_time" jdbcType="VARCHAR" property="updateTime" />
    <result column="job_type0" jdbcType="VARCHAR" property="jobType0" />
    <result column="attachment_id" jdbcType="VARCHAR" property="attachmentId" />
    <result column="attachment_id1" jdbcType="VARCHAR" property="attachmentId1" />
    <result column="id_card" jdbcType="VARCHAR" property="idCard" />
    <result column="open_account_name" jdbcType="VARCHAR" property="openAccountName" />
    <result column="open_account_bank" jdbcType="VARCHAR" property="openAccountBank" />
    <result column="bank_account" jdbcType="VARCHAR" property="bankAccount" />
    <result column="prohibit" jdbcType="BIT" property="prohibit" />
    <result column="packing_station" jdbcType="VARCHAR" property="packingStation" />
    <result column="partner_type" jdbcType="VARCHAR" property="partnerType" />
    <result column="partner_key" jdbcType="VARCHAR" property="partnerKey" />
  </resultMap>
 
 
 
  <select id="queryEntityByUserIds" resultType="com.xzx.gc.entity.CityPartner">
    select *
    from xzx_city_partner
    where user_id like concat("%", #{userId}, "%") and del_flag = 0
  </select>
 
  <select id="queryAllCityPartnerList" resultType="com.xzx.gc.entity.CityPartner">
    select * from xzx_city_partner
    where 1=1
    <if test="partnerId != null and partnerId != ''">
      and (id=#{partnerId} or packing_station=#{partnerId})
    </if>
  </select>
 
    <select id="queryPartnerName" resultType="com.xzx.gc.entity.CityPartner">
        select * from xzx_city_partner where del_flag=0 and partner_type=1
        <if test=" partnerIds != null and partnerIds.size() != 0">
            and id in
            <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
 
    <select id="queryPackageByPartner" resultType="com.xzx.gc.entity.CityPartner">
        select *
        from xzx_city_partner
        where del_flag = 0 and partner_type = 2 and prohibit = 0
        <if test=" partnerIds != null and partnerIds.size() != 0">
            and packing_station in
            <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
 
    <select id="queryPackageIdList" resultType="java.lang.String">
        select id from xzx_city_partner where  partner_type=2 and packing_station=#{partnerId}
    </select>
 
    <select id="queryCityPartnerByPhone" resultType="java.lang.String">
        select id
        from xzx_city_partner
        where del_flag = 0 and mobile_phone = #{mobilePhone}
    </select>
 
    <select id="queryCityPartner" resultType="com.xzx.gc.model.admin.XzxCityPartnerModel">
        select a.id,a.partner_name,a.mobile_phone,a.account_no,IFNULL(sum(b.money),0) as czMoney,
        IFNULL(sum(c.money),0) as txMoney,a.effective_statr_time,a.effective_end_time,a.create_time,a.prohibit
        ,a.packing_station,
        a.partner_type,a.password,a.id_card as idCard,a.attachment_id,a.attachment_id1,a.email,a.user_id,a.partner_key
        as partnerKeys
        from xzx_city_partner a
        LEFT JOIN xzx_pay_info b ON a.user_id = b.create_user_id and b.pay_type=1
        LEFT JOIN xzx_pay_request_info c ON a.user_id=c.create_user_id and c.pay_type=4
        LEFT JOIN xzx_partner_account d ON a.user_id = d.user_id
        WHERE a.del_flag=0
 
        <if test="prohibit != null">
            and a.prohibit = #{prohibit}
        </if>
 
        <if test="startTime != null and startTime != ''">
            and a.create_time >= #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
            and a.create_time &lt;= #{endTime}
        </if>
 
        <if test="name != null and name != ''">
            and (a.partner_name like concat("%",#{name} ,"%") or a.mobile_phone like concat("%",#{name} ,"%") or
            a.packing_station like concat("%",#{name} ,"%") )
        </if>
 
        <if test="partnerType != null and partnerType != ''">
            and a.partner_type = #{partnerType}
        </if>
 
        <if test="packingStation != null and packingStation != ''">
            and a.packing_station = #{packingStation}
        </if>
 
        <if test="partnerIdList != null and partnerIdList.size() != 0">
            and (a.id in
            <foreach collection="partnerIdList" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
            or a.packing_station =#{packingStation})
        </if>
 
        GROUP BY a.id order by a.create_time desc
    </select>
 
    <select id="queryPartnerByMobile" resultType="com.xzx.gc.entity.CityPartner">
        select * from xzx_city_partner where del_flag=0
 
        <if test="mobilePhone != null and mobilePhone != ''">
            and mobile_phone=#{mobilePhone}
        </if>
 
        <if test="partnerType != null and partnerType != ''">
            and partner_type=#{partnerType}
        </if>
        <if test="partnerName != null and partnerName != ''">
            and partner_name=#{partnerName}
        </if>
 
        <if test="partnerIdList != null and partnerIdList.size() != 0">
            and id in
            <foreach collection="partnerIdList" index="index" item="id" separator="," open="(" close=")">
                #{id}
            </foreach>
        </if>
    </select>
 
    <select id="querySidByPid" resultType="java.lang.String">
        select partner_service_id
        from xzx_partner_trace
        where del_flag = 0 and partner_service_type = #{serviceType} and partner_id = #{partnerId}
        limit 1
    </select>
 
    <select id="queryPartnerKeyByOrder" resultType="com.xzx.gc.entity.CityPartner">
        select a.*
        from xzx_city_partner a
            left join (select
                           c.partner_id,
                           b.order_id
                       from xzx_order_info b
                           left join xzx_user_other_info c on b.receiver = c.user_id) m
                on a.id = m.partner_id
        where a.del_flag = 0 and m.order_id = #{orderId}
    </select>
 
    <select id="querySidByPartnerId" resultType="java.lang.String">
        select partner_service_id from xzx_partner_trace where del_flag=0 and partner_id=#{partnerId}
        <if test="type != null and type != ''">
            and partner_service_type=#{type}
        </if>
    </select>
</mapper>