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