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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?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.order.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="queryPartnerById" resultType="com.xzx.gc.entity.CityPartner">
    select *
    from xzx_city_partner
    where id = #{id} and del_flag = 0
  </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="queryAccountByAdminId" resultType="java.lang.String">
    select group_concat(field_value) as account
    from xzx_platform_account_info;
  </select>
  <select id="queryUserModelbyPartnerId" resultType="com.xzx.gc.model.admin.UserModel">
    select a.* from xzx_user_other_info a
    left join xzx_order_info b on b.receiver=a.user_id
    where a.del_flag=0
 
    <if test="partnerId != null and partnerId.size() != 0">
      and a.partner_id in
      <foreach collection="partnerId" index="index" item="id" open="(" separator="," close=")">
        #{id}
      </foreach>
    </if>
 
 
    <if test="userType != null and userType != ''">
      and a.user_type=#{userType}
    </if>
 
    <if test="userId != null and userId != ''">
      and a.user_id=#{userId}
    </if>
 
    <if test="orderId != null and orderId != ''">
      and b.order_id=#{orderId}
    </if>
 
  </select>
  <select id="queryAccountByPartnerId" resultType="java.lang.String">
    select IFNULL(hbb, 0)
    from xzx_partner_account
    where user_id = #{userId}
    limit 1
  </select>
  <select id="queryPartnerByOther" resultType="com.xzx.gc.entity.CityPartner">
    select a.*
    from xzx_city_partner a
      left join xzx_user_other_info b on a.id = b.partner_id
    where b.user_id = #{receiver}
    group by a.id
  </select>
  <select id="queryAreaLongiLati" resultType="com.xzx.gc.model.admin.AreaModel">
    select *
    from xzx_longi_lati
    where 1 = 1 and name = #{name}
    limit 1
  </select>
  <update id="updateAccountPartner">
    update xzx_account_info
    set money = #{money}
    where user_id = #{userId}
  </update>
  <insert id="addPayInfo1">
    INSERT INTO `xzx_pay_info` (`pay_order_id`, `order_id`, `create_user_id`, `money`,
                                `account_id`, `pay_type`, `open_id`, `status`, `create_time`, `check_num`, `pay_img`, `pay_time`)
    VALUES (#{payOrderId}, NULL, #{createUserId}, #{money}, #{accountId},
                           #{payType}, NULL, #{status}, SYSDATE(), NULL, #{payImg}, #{payTime})
  </insert>
 
  <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="queryTownIdsByPartnerId" resultType="java.lang.String">
    select town_id
    from xzx_partner_gaode
    where del_flag = 0 and partner_id = #{partnerId}
  </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>
  <select id="queryOrderById" resultType="java.lang.String">
    select trace_id from xzx_order_info where order_id =#{orderId}
    <if test="userId != null and userId != ''">
      and receiver=#{userId}
    </if>
 
    <if test="startTime != null and startTime != ''">
      and b.receive_time >= #{startTime}
    </if>
    <if test="endTime != null and endTime != ''">
      and b.receive_time &lt;= #{endTime}
    </if>
 
  </select>
  <select id="queryOrderByIds" resultType="java.lang.String">
    select a.trace_id
    from xzx_order_info a
    left join xzx_order_detail_info b on a.order_id = b.order_id
    where a.del_flag = 0
    <if test="userId != null and userId != ''">
      and a.receiver=#{userId}
    </if>
 
    <if test="startTime != null and startTime != ''">
      and b.receive_time >= #{startTime}
    </if>
    <if test="endTime != null and endTime != ''">
      and b.receive_time &lt;= #{endTime}
    </if>
  </select>
 
  <delete id="deleteUserByPartnerId">
    update xzx_user_other_info
    set del_flag = 1
    where partner_id = #{id} and del_flag = 0
  </delete>
  <delete id="deleteAccount">
    update xzx_account_info
    set del_flag = 1
    where account_id = #{accountId}
  </delete>
  <select id="queryOrderByHsy" resultType="map">
    select a.order_id as orderId,c.complete_time as completeTime,a.address from xzx_order_info a
    left join xzx_user_other_info b on a.receiver= b.user_id
    left join xzx_order_detail_info c on a.order_id=c.order_id
    where a.del_flag!=1 and b.del_flag=0 and b.user_type=2
    and order_status in (4,5,7) and a.create_type in (1,3)
    <if test="startTime != null and startTime != ''">
      and c.complete_time >= #{startTime}
    </if>
    <if test="endTime != null and endTime != ''">
      and c.complete_time &lt;= #{endTime}
    </if>
 
    <if test="userId != null and userId != ''">
      and b.user_id=#{userId}
    </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="queryPidByTownId" resultType="java.lang.String">
       select partner_id from xzx_partner_fence where fence_id=#{townId} and del_flag=0 limit 1
    </select>
</mapper>