| <?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 <= #{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> |