| <?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.OtherUserMapper"> | 
|   | 
|     <select id="queryRKOrderIds" resultType="java.lang.String"> | 
|         select a.user_id from xzx_user_other_info a | 
|         LEFT JOIN xzx_account_info b on a.user_id=b.user_id | 
|         where 1=1 | 
|         <choose> | 
|             <when test="type != null and type != ''"> | 
|                 and a.user_type=2 | 
|             </when> | 
|             <when test="type == null or type == ''"> | 
|                 and a.user_type=4 | 
|             </when> | 
|         </choose> | 
|   | 
|         <if test="limitPrice != null and limitPrice != ''"> | 
|             and b.fixed_limit=#{limitPrice} | 
|         </if> | 
|     </select> | 
|   | 
|     <update id="UpdateUserApiByOtherUserId"> | 
|         update xzx_user_other_info set is_prohibit=#{flag} where user_id=#{userId} and user_type=#{userType} | 
|     </update> | 
|   | 
|     <select id="queryPromoterApiList" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select IFNULL(a.nick_name,k.nick_name) as nickName,c.mobile_phone as mobilePhone,a.user_id as | 
|         userId,c.is_prohibit,c.avatar as avatar, | 
|         c.regist_time as registTime,c.name, | 
|         c.partner_id as partnerId, | 
|         (select m.partner_name from xzx_city_partner m where m.id=c.partner_id) as partnerName, | 
|         count(a.id) as registNum,count(f.id) as finishNum,count(j.id) as unRegistNum,IFNULL(c.del_flag,0) as delFlag | 
|         from xzx_user_other_info c | 
|         LEFT JOIN xzx_user_target_info a ON a.user_id=c.user_id | 
|         LEFT JOIN xzx_user_target_info d ON a.id=d.id and d.regster_type>1 | 
|         LEFT JOIN xzx_user_target_info f ON a.id=f.id and f.regster_type=3 | 
|         LEFT JOIN xzx_user_target_info j ON a.id=j.id and j.regster_type=1 | 
|         LEFT JOIN xzx_user_info k ON a.mobile=k.mobile_phone | 
|         where (c.user_type=6 or c.user_type=2) | 
|         <if test=" phone!= null and phone != ''"> | 
|             AND c.mobile_phone=#{phone} | 
|         </if> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.create_time<![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.create_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="isProhibit != null and isProhibit != ''"> | 
|             AND a.is_prohibit=false | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND c.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         group by c.user_id | 
|     </select> | 
|   | 
|     <select id="queryCollectorApiList" parameterType="com.xzx.gc.model.admin.CollectorModel" | 
|             resultType="com.xzx.gc.model.admin.CollectorModel"> | 
|         select a.name as name,a.town_id as townId,a.nick_name as nickName,a.mobile_phone as mobilePhone,a.avatar as | 
|         avatar,a.user_id as userId,a.del_flag as delFlag, | 
|         (select m.partner_name from xzx_city_partner m where a.partner_id=m.id) as partnerName, | 
|         (select count(b.order_id) from xzx_order_info b where 1=1 | 
|         <if test=" userType != null and userType != ''"> | 
|             and b.receiver=a.user_id | 
|         </if> | 
|         ) as orderNum, | 
|         (select g.sys_storage_id from xzx_order_storage_info g where 1=1 | 
|         <if test="userType != null and userType != ''"> | 
|             <if test="userType==2"> | 
|                 and g.receiver=a.user_id | 
|             </if> | 
|             <if test="userType==4"> | 
|                 and g.storage_user_id=a.user_id | 
|             </if> | 
|             <if test="userType==7"> | 
|                 and g.storage_user_id=a.user_id | 
|             </if> | 
|         </if> | 
|         limit 1) as sysStorageId, | 
|         (select sum(c.storage_weight) from xzx_order_storage_info c where 1=1 | 
|         <if test="userType != null and userType != ''"> | 
|             <if test="userType==2"> | 
|                 and c.receiver=a.user_id | 
|             </if> | 
|             <if test="userType==4"> | 
|                 and c.storage_user_id=a.user_id | 
|             </if> | 
|             <if test="userType==7"> | 
|                 and c.storage_user_id=a.user_id | 
|             </if> | 
|         </if> | 
|         )as storageWeight, | 
|         (select sum(d.storage_money) from xzx_order_storage_info d where 1=1 | 
|         <if test=" userType != null and userType != ''"> | 
|             <if test="userType==2"> | 
|                 and d.receiver=a.user_id | 
|             </if> | 
|             <if test=" userType==4"> | 
|                 and d.storage_user_id=a.user_id | 
|             </if> | 
|             <if test="userType==7"> | 
|                 and d.storage_user_id=a.user_id | 
|             </if> | 
|         </if> | 
|         ) as storageMoney, | 
|         a.is_prohibit as isProhibit, | 
|         IFNULL(a.regist_time,(select f.regist_time | 
|         from xzx_user_info f | 
|         where f.user_id=a.user_id)) as registTime, | 
|         (select j.login_time from xzx_user_login_info j where j.mobile_phone=a.mobile_phone | 
|         <if test=" userType!= null and userType != ''"> | 
|             and j.user_type=#{userType} | 
|         </if> | 
|         group by j.mobile_phone order by login_time desc) as loginTime | 
|         from xzx_user_other_info a | 
|         where 1=1 | 
|         <if test="userType != null and userType != ''"> | 
|             AND a.user_type=#{userType} | 
|         </if> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND IFNULL(a.regist_time,(select f.regist_time | 
|             from xzx_user_info f | 
|             where f.user_id=a.user_id))<![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND IFNULL(a.regist_time,(select f.regist_time | 
|             from xzx_user_info f | 
|             where f.user_id=a.user_id))<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="mobilePhone != null and mobilePhone != ''"> | 
|             AND a.mobile_phone=#{mobilePhone} | 
|         </if> | 
|         <if test="area != null and area != ''"> | 
|             AND a.township_id=#{area} | 
|         </if> | 
|         <if test="isProhibit != null and isProhibit != ''"> | 
|             AND a.is_prohibit=#{isProhibit} | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND a.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         order by a.user_id desc | 
|     </select> | 
|   | 
|     <update id="updateOtherUserByPhone"> | 
|         update xzx_user_other_info set password=#{password},salt=#{salt} where mobile_phone=#{phone} | 
|     </update> | 
|   | 
|     <update id="updateOtherUserName"> | 
|         update xzx_user_other_info set name=#{name} where mobile_phone=#{mobile} | 
|     </update> | 
|   | 
|     <select id="queryCuserByPhoneRedisDelList" resultType="java.util.HashMap"> | 
|         SELECT user_id AS userId FROM xzx_user_other_info WHERE del_flag=0 | 
|         <if test="phone != null and phone != ''"> | 
|             AND mobile_phone=#{phone} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryUserByUsertype1" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info | 
|         where 1=1 | 
|         <if test="delFlag != null"> | 
|             and del_flag=#{delFlag} | 
|         </if> | 
|         <if test="phone != null and phone != ''"> | 
|             and (mobile_phone like concat("%",#{phone},"%") or nick_name =#{nickName}) | 
|         </if> | 
|         <if test="userType != null and userType != ''"> | 
|             and user_type=#{userType} | 
|         </if> | 
|         <if test="normal != null"> | 
|             and regist_type=3 | 
|         </if> | 
|     </select> | 
|   | 
|     <update id="updateDelflag"> | 
|         update xzx_user_other_info set del_flag = 0 | 
|         <if test="password != null"> | 
|             ,password=#{password} | 
|         </if> | 
|         <if test="salt != null"> | 
|             ,salt = #{salt} | 
|         </if> | 
|         <if test="area != null and area != ''"> | 
|             ,town_id=#{area} | 
|         </if> | 
|         <if test="name != null"> | 
|             ,name=#{name} | 
|         </if> | 
|         <if test="roleId != null"> | 
|             ,role_ids=#{roleId} | 
|         </if> | 
|         <if test="partnerId!= null and partnerId != ''"> | 
|             ,partner_id=#{partnerId} | 
|         </if> | 
|         <if test="cityId != null"> | 
|             ,city_id=#{cityId} | 
|         </if> | 
|         <if test="storageId != null"> | 
|             ,storage_id=#{storageId} | 
|         </if> | 
|         <if test="provinceId != null and provinceId != ''"> | 
|             , province_id=#{provinceId} | 
|         </if> | 
|         <if test="townshipId != null and townshipId != ''"> | 
|             , township_id=#{townshipId} | 
|         </if> | 
|         <if test="province != null and province != ''"> | 
|             ,province=#{province} | 
|         </if> | 
|         <if test="city != null and city != ''"> | 
|             ,city=#{city} | 
|         </if> | 
|         <if test="township != null and township != ''"> | 
|             ,township=#{township} | 
|         </if> | 
|         where mobile_phone=#{phone} | 
|         <if test="userType != null and userType != ''"> | 
|             and user_type=#{userType} | 
|         </if> | 
|     </update> | 
|   | 
|     <insert id="addCuserRole"> | 
|         INSERT INTO xzx_user_other_info ( | 
|             user_id, | 
|             mobile_phone, | 
|             `password`, | 
|             salt, | 
|             `name`, | 
|             user_type, | 
|             regist_time, | 
|             town_id, | 
|             partner_id, | 
|             role_ids, | 
|             avatar, | 
|             city_id, | 
|             storage_id, | 
|             township_id, | 
|             province_id, | 
|             province, | 
|             city, | 
|             township | 
|         ) | 
|         values | 
|             (#{id},#{mobilephone},#{password},#{salt},#{name},#{userType},SYSDATE(),#{area},#{partnerId},#{roleId},'https://res.cnxzx.com/resource/static/img/icon-loadlogo.png',#{cityId},#{storageId},#{townshipId} ,#{provinceId},#{province} ,#{city} ,#{township} ) | 
|     </insert> | 
|   | 
|     <select id="checkOtherUserByType" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info where del_flag=0 | 
|         <if test="userType != null and userType != ''"> | 
|             and user_type=#{userType} | 
|         </if> | 
|         <if test="mobilePhone != null and mobilePhone != ''"> | 
|             and mobile_phone=#{mobilePhone} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryQromoterLeven" resultType="com.xzx.gc.model.admin.PromoterModel"> | 
|         SELECT | 
|         IFNULL( k.regist_type, 0 ) AS regsterType, | 
|         c.partner_id AS partnerId, | 
|         ( SELECT n.partner_name FROM xzx_city_partner n WHERE c.partner_id = n.id ) AS partnerName, | 
|         IFNULL( m.registCount, 0 ) AS registCount, | 
|         IFNULL( m.count, 0 ) AS count, | 
|         IFNULL( m.totalNum, 0 ) AS totalNum, | 
|         c.nick_name, | 
|         c.mobile_phone, | 
|         c.user_id, | 
|         c.regist_time, | 
|         IFNULL( c.NAME, '-' ) AS NAME, | 
|         c.del_flag AS delFlag | 
|         FROM | 
|         xzx_user_other_info c | 
|         LEFT JOIN ( | 
|         SELECT | 
|         count( a.id ) AS totalNum, | 
|         count( f.id ) AS count, | 
|         count( j.id ) AS registCount, | 
|         a.real_user_id, | 
|         a.mobile | 
|         FROM | 
|         xzx_user_target_info a | 
|         LEFT JOIN xzx_user_target_info f ON a.id = f.id | 
|         AND f.regster_type = 3 | 
|         LEFT JOIN xzx_user_target_info j ON a.id = j.id | 
|         AND j.regster_type = 2 | 
|         LEFT JOIN xzx_user_other_info l ON a.real_user_id = l.user_id | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.create_time<![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.create_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         group by l.user_id | 
|         ) m ON m.real_user_id=c.user_id | 
|         LEFT JOIN xzx_user_info k ON m.mobile=k.mobile_phone | 
|   | 
|         where 1=1 | 
|         <if test="delFlag != null and delFlag != ''"> | 
|             and c.del_flag=#{delFlag} | 
|         </if> | 
|         <if test="userId != null and userId != ''"> | 
|             AND c.user_id=#{userId} | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND c.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         <if test="nickName != null and nickName != ''"> | 
|             AND c.nick_name like concat("%",#{nickName},"%") | 
|         </if> | 
|         <if test="mobilePhone != null and mobilePhone != ''"> | 
|             AND c.mobile_phone like concat("%",#{mobilePhone},"%") | 
|         </if> | 
|         <if test="name != null and name != ''"> | 
|             AND c.name like concat("%",#{name},"%") | 
|         </if> | 
|         <if test="paramName != null and paramName != ''"> | 
|             AND (c.name like concat("%",#{paramName},"%") or c.mobile_phone like concat("%",#{paramName},"%") ) | 
|         </if> | 
|         group by c.user_id | 
|         <if test="exp != null and exp != ''"> | 
|             limit #{page}, #{limit} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryCollectorNum" parameterType="java.util.List" resultType="java.lang.String"> | 
|         select user_id from xzx_user_other_info | 
|         where user_type=2 | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryCollectorPageList" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select b.user_id as userId, | 
|         b.mobile_phone as mobilePhone, | 
|         (select c.partner_name from xzx_city_partner c where c.id=b.partner_id) as partnerName, | 
|         IFNULL(sum(a.storage_weight),0) as storageWeight, | 
|         IFNULL(sum(a.storage_money),0) as storageMoney, | 
|         IFNULL(sum(a.recycle_weight),0) as recycleWeight, | 
|         IFNULL(sum(a.recycle_money),0) as recycleMoney, | 
|         (IFNULL(sum(a.storage_weight),0) - IFNULL(sum(a.recycle_weight),0)) as weightError, | 
|         (IFNULL(sum(a.storage_money),0) - IFNULL(sum(a.recycle_money),0)) as moneyError, | 
|         b.name as name, | 
|         b.del_flag as delFlag, | 
|         b.origin_type as originType | 
|         from xzx_user_other_info b | 
|         left join xzx_order_storage_info a on a.receiver=b.user_id | 
|         where  b.user_type=2 | 
|         <if test="delFlag != null and delFlag != ''"> | 
|             and b.del_flag=#{delFlag} | 
|         </if> | 
|         <if test="userId != null and userId != ''"> | 
|             AND b.user_id=#{userId} | 
|         </if> | 
|         <choose> | 
|             <when test="originType==1"> | 
|                 and b.origin_type=1 | 
|             </when> | 
|             <when test="originType==0"> | 
|                 and b.origin_type is null | 
|             </when> | 
|         </choose> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.storage_time<![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="name != null"> | 
|             AND (b.name like concat("%",#{name},"%") or b.mobile_phone like concat("%",#{name},"%") ) | 
|         </if> | 
|         <if test="nickName != null"> | 
|             AND b.nick_name like concat("%",#{nickName},"%") | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND b.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         group by b.user_id | 
|     </select> | 
|   | 
|     <select id="queryStorageByUserId" resultType="com.xzx.gc.model.admin.StorageModel"> | 
|         select a.storage_id as storageId, | 
|         (select b.storage_name from xzx_sys_storage b where a.sys_storage_id=b.id) as storageName, | 
|         a.storage_time as createTime, | 
|         IFNULL(a.recycle_weight,0) as recycleWeight, | 
|         (IFNULL(a.storage_weight,0) - IFNULL(a.recycle_weight,0)) as weightError, | 
|         IFNULL(a.recycle_money,0) as recycleMoney, | 
|         (IFNULL(a.storage_money,0) - IFNULL(a.recycle_money,0)) as moneyError | 
|         from xzx_order_storage_info a | 
|         left join xzx_user_other_info b on a.receiver=b.user_id | 
|         where a.storage_status=0 | 
|         <if test="receiver != null"> | 
|             AND a.receiver=#{receiver} | 
|         </if> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.storage_time<![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="recycleWeight != null and recycleWeight != ''"> | 
|             AND a.recycle_weight<![CDATA[>= ]]> CONVERT(#{recycleWeight},SIGNED) | 
|         </if> | 
|         <if test="weightError != null"> | 
|             AND (IFNULL(a.storage_weight,0) - IFNULL(a.recycle_weight,0))<![CDATA[>= ]]> CONVERT(#{weightError},SIGNED) | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND b.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|     </select> | 
|   | 
|   | 
|     <select id="queryStorageList" resultType="java.util.Map"> | 
|         select | 
|         IFNULL((select b.storage_name from xzx_sys_storage b where a.sys_storage_id=b.id),"-") as storageName, | 
|         a.storage_time as createTime, | 
|         IFNULL(sum(a.recycle_weight),0) as recycleWeight, | 
|         IFNULL(sum(a.storage_weight),0) as storageWeight, | 
|         IFNULL(sum(a.recycle_money),0) as recycleMoney, | 
|         IFNULL(sum(a.storage_money),0) as storageMoney, | 
|         (select c.partner_name from xzx_city_partner c where c.id=t.partner_id ) as partnerName, | 
|         count(a.storage_id) as orderId, | 
|         a.storage_user_id as storageUserId, | 
|         t.name as name, | 
|         t.mobile_phone as storageUserPhone, | 
|         t.del_flag as delFlag | 
|         from xzx_user_other_info t | 
|         left join xzx_order_storage_info a on t.user_id=a.storage_user_id and a.sys_storage_type=1 | 
|         where t.user_type =4 | 
|         <if test="delFlag != null and delFlag != ''"> | 
|             and t.del_flag=#{delFlag} | 
|         </if> | 
|         <if test="name != null and name != ''"> | 
|             AND (t.name like concat("%",#{name},"%") or a.storage_user_phone like concat("%",#{name},"%") ) | 
|         </if> | 
|         <if test="nickName != null and nickName != ''"> | 
|             AND t.nick_name =#{nickName} | 
|         </if> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.storage_time <![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="userType != null and userType != ''"> | 
|             AND t.user_type =#{userType} | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND t.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         group by t.user_id | 
|     </select> | 
|   | 
|     <select id="queryStorageList1" resultType="java.util.Map"> | 
|         select | 
|         IFNULL((select b.partner_name from xzx_city_partner b where a.sys_storage_id=b.id and partner_type=2),"-") as | 
|         storageName, | 
|         a.storage_time as createTime, | 
|         IFNULL(sum(a.recycle_weight),0) as recycleWeight, | 
|         IFNULL(sum(a.storage_weight),0) as storageWeight, | 
|         IFNULL(sum(a.recycle_money),0) as recycleMoney, | 
|         IFNULL(sum(a.storage_money),0) as storageMoney, | 
|         count(a.storage_id) as orderId, | 
|         a.storage_user_id as storageUserId, | 
|         t.name as name, | 
|         t.mobile_phone as storageUserPhone, | 
|         t.del_flag as delFlag, | 
|         a.sys_storage_id as sysStorageId | 
|         from xzx_user_other_info t | 
|         left join xzx_order_storage_info a on t.user_id=a.storage_user_id and a.sys_storage_type=2 | 
|         where t.user_type =7 | 
|         <if test=" name!= null and name != ''"> | 
|             AND (t.name like concat("%",#{name},"%") or a.storage_user_phone like concat("%",#{name},"%") ) | 
|         </if> | 
|         <if test="nickName != null and nickName != ''"> | 
|             AND t.nick_name =#{nickName} | 
|         </if> | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.storage_time <![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.storage_time<![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="userType != null and userType != ''"> | 
|             AND t.user_type =#{userType} | 
|         </if> | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             AND t.partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|         group by a.storage_user_id | 
|     </select> | 
|   | 
|     <select id="queryPackageStorageNum" parameterType="java.util.List" resultType="java.lang.Integer"> | 
|         select count(a.user_id) | 
|         from xzx_city_partner a | 
|         left join xzx_partner_gaode b on a.id=b.partner_id | 
|         where a.partner_type='2' | 
|         <if test="townIds != null"> | 
|             AND town_id in | 
|             <foreach collection="townIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryStorageObjectList" resultType="java.util.Map"> | 
|         select a.storage_id as storageId, | 
|         b.mobile_phone AS receiverPhone, | 
|         a.storage_time as storageTime, | 
|         IFNULL(sum(a.storage_weight),0) as storageWeight, | 
|         IFNULL(sum(a.storage_money),0) as storageMoney, | 
|         IFNULL(sum(a.recycle_weight),0) as recycleWeight, | 
|         IFNULL(sum(a.recycle_money),0) as recycleMoney, | 
|         b.name AS NAME | 
|         from xzx_order_storage_info a | 
|         left join xzx_user_other_info b on a.receiver = b.user_id | 
|         where a.storage_status=0 | 
|         <if test=" storageUserId!= null"> | 
|             AND a.storage_user_id =#{storageUserId} | 
|         </if> | 
|         <if test=" startTime!= null and startTime!=''"> | 
|             AND a.storage_time <![CDATA[>= ]]>#{startTime} | 
|         </if> | 
|         <if test=" endTime!= null and endTime!=''"> | 
|             AND a.storage_time <![CDATA[<= ]]>#{endTime} | 
|         </if> | 
|         <if test="sysStorageId != null and sysStorageId != ''"> | 
|             and a.sys_storage_id=#{sysStorageId} | 
|         </if> | 
|         group by a.storage_id | 
|         <choose> | 
|             <when test="recycleWeight != null and recycleWeight!=''"> | 
|                 HAVING | 
|                 IFNULL(sum(a.recycle_weight),0)<![CDATA[>= ]]>#{recycleWeight} | 
|                 <choose> | 
|                     <when test="storageWeight != null and storageWeight!=''"> | 
|                         and | 
|                         IFNULL(sum(a.storage_weight),0)<![CDATA[>= ]]>#{storageWeight} | 
|                     </when> | 
|                 </choose> | 
|             </when> | 
|             <otherwise> | 
|                 HAVING IFNULL(sum(a.recycle_weight),0)<![CDATA[>= ]]>0 | 
|                 <choose> | 
|                     <when test="storageWeight != null and storageWeight!=''"> | 
|                         and | 
|                         IFNULL(sum(a.storage_weight),0) <![CDATA[>= ]]>#{storageWeight} | 
|                     </when> | 
|                 </choose> | 
|             </otherwise> | 
|         </choose> | 
|     </select> | 
|   | 
|     <select id="queryOtherUserByPid" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info | 
|         where del_flag=0 | 
|   | 
|         <if test="pid != null and pid != ''"> | 
|             AND (partner_id =#{pid} or partner_id in | 
|             <choose> | 
|                 <when test="packageStationList != null and packageStationList.size() != 0"> | 
|                     <foreach collection="packageStationList" index="index" item="id" separator="," open="(" close=")"> | 
|                         #{id} | 
|                     </foreach> | 
|                 </when> | 
|                 <otherwise> | 
|                     ("0") | 
|                 </otherwise> | 
|             </choose> | 
|             ) | 
|         </if> | 
|   | 
|         <if test="userName != null and userName != ''"> | 
|             and (name like concat("%",#{userName} ,"%") or mobile_phone like concat("%",#{userName} ,"%")) | 
|         </if> | 
|   | 
|         <if test="roleType != null and roleType != ''"> | 
|             AND user_type =#{roleType} | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryCityPartnerForOtherUser" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info where del_flag=0 and user_type=#{userType} | 
|         <if test=" partnerIds != null and partnerIds.size() != 0"> | 
|             and partner_id in | 
|             <foreach collection="partnerIds" index="index" item="id" separator="," open="(" close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|     </select> | 
|   | 
|     <select id="queryUserOtherById" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info where 1=1 | 
|         <if test="userId != null and userId != ''"> | 
|             and user_id=#{userId} | 
|         </if> | 
|     </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> | 
|   | 
|     <delete id="deleteUserByPartnerId"> | 
|         update xzx_user_other_info | 
|         set del_flag = 1 | 
|         where partner_id = #{id} and del_flag = 0 | 
|     </delete> | 
|   | 
|     <select id="queryUserOtherByIdC" resultType="com.xzx.gc.model.admin.UserModel"> | 
|         select * from xzx_user_other_info where del_flag = 0 and user_type in (2,4) | 
|         <if test="userId != null and userId != ''"> | 
|             and user_id=#{userId} | 
|         </if> | 
|     </select> | 
|   | 
|     <insert id="insertUserOtherInfo" parameterType="com.xzx.gc.model.admin.UserModel"> | 
|         insert into xzx_user_other_info (user_id, mobile_phone, login_account, password, salt, name, | 
|                                          user_type, open_id, country, regist_time, del_flag, is_prohibit, role_ids, partner_id, avatar) | 
|         values ( | 
|             #{userId}, #{mobilePhone}, | 
|                        #{loginAccount}, #{password}, #{salt}, #{name}, #{userType}, null, 'China', SYSDATE(), 0, 0, | 
|             #{roleIds}, #{partnerId}, #{avatar} | 
|         ) | 
|     </insert> | 
|   | 
|     <update id="updateOtherUserById1"> | 
|         update xzx_user_other_info | 
|         set is_prohibit = 1 | 
|         where partner_id = #{partnerId} | 
|     </update> | 
|   | 
|   | 
|   | 
|     <select id="findOfferByPartnerId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             a.user_id AS userId, | 
|             a.NAME, | 
|             a.avatar, | 
|             b.id AS itemId, | 
|             a.partner_id AS partnerId, | 
|             a.township_id AS townshipId, | 
|             a.latitude, | 
|             a.longitude | 
|         FROM | 
|             xzx_user_other_info a | 
|             INNER JOIN xzx_sys_item_user b ON a.user_id = b.user_id | 
|         WHERE a.del_flag=0 and a.partner_id=#{partnerId} and a.user_type='2' and  a.is_prohibit=0 and b.del_flag=0 | 
|               and b.item_type=#{paperWasteItemType} | 
|               AND (a.leave_start_time IS NULL OR now() < a.leave_start_time OR  now() > a.leave_end_time ) | 
|     </select> | 
|   | 
|     <select id="findOfferByFenceId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             a.user_id AS userId, | 
|             a.NAME, | 
|             a.avatar, | 
|             b.id AS itemId, | 
|             a.partner_id AS partnerId, | 
|             a.township_id AS townshipId, | 
|             a.latitude, | 
|             a.longitude | 
|         FROM | 
|             xzx_user_other_info a | 
|             INNER JOIN xzx_sys_item_user b ON a.user_id = b.user_id | 
|         WHERE a.del_flag=0 and locate(#{fenceId},a.town_id)>0 and a.user_type='2' and  a.is_prohibit=0 and b.del_flag=0 | 
|               and b.item_type=#{paperWasteItemType} | 
|               AND (a.leave_start_time IS NULL OR now() < a.leave_start_time OR  now() > a.leave_end_time ) | 
|     </select> | 
|   | 
|     <select id="findAllOfferByPartnerId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             a.user_id AS userId, | 
|             a.NAME, | 
|             a.avatar, | 
|             b.id AS itemId, | 
|             a.partner_id AS partnerId, | 
|             a.township_id AS townshipId, | 
|             a.mobile_phone AS mobilePhone, | 
|             a.latitude, | 
|             a.longitude | 
|         FROM | 
|             xzx_user_other_info a | 
|             LEFT JOIN xzx_sys_item_user b ON a.user_id = b.user_id | 
|                                              AND b.del_flag = 0 | 
|                                              AND b.item_type = #{paperWasteItemType} | 
|         WHERE a.del_flag=0 and a.partner_id=#{partnerId} and a.user_type='2' and  a.is_prohibit=0 | 
|               AND (a.leave_start_time IS NULL OR now() < a.leave_start_time OR  now() > a.leave_end_time ) | 
|     </select> | 
|   | 
|     <select id="findAllOfferByFenceId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             a.user_id AS userId, | 
|             a.NAME, | 
|             a.avatar, | 
|             b.id AS itemId, | 
|             a.partner_id AS partnerId, | 
|             a.township_id AS townshipId, | 
|             a.mobile_phone AS mobilePhone, | 
|             a.latitude, | 
|             a.longitude | 
|         FROM | 
|             xzx_user_other_info a | 
|             LEFT JOIN xzx_sys_item_user b ON a.user_id = b.user_id | 
|                                              AND b.del_flag = 0 | 
|                                              AND b.item_type = #{paperWasteItemType} | 
|         WHERE a.del_flag=0 and locate(#{fenceId},a.town_id)>0  and a.user_type='2' and  a.is_prohibit=0 | 
|               AND (a.leave_start_time IS NULL OR now() < a.leave_start_time OR  now() > a.leave_end_time ) | 
|     </select> | 
|   | 
|   | 
|   | 
|   | 
|     <select id="findNearestByLocationAndPartnerId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             user_id AS userId, | 
|             NAME, | 
|             avatar, | 
|             partner_id AS partnerId, | 
|             township_id AS townshipId, | 
|             latitude, | 
|             longitude | 
|         FROM | 
|             xzx_user_other_info | 
|         WHERE | 
|             del_flag = 0 | 
|             AND is_prohibit = 0 | 
|             AND partner_id = #{partnerId} | 
|             and user_type='2' | 
|             AND (leave_start_time IS NULL OR now() < leave_start_time OR  now() > leave_end_time ) | 
|         order by ROUND(lat_lng_distance(#{lat}, #{lon}, latitude, longitude), 3) asc  limit  1 | 
|     </select> | 
|   | 
|     <select id="findNearestByLocationAndFenceId" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             user_id AS userId, | 
|             NAME, | 
|             avatar, | 
|             partner_id AS partnerId, | 
|             township_id AS townshipId, | 
|             latitude, | 
|             longitude | 
|         FROM | 
|             xzx_user_other_info | 
|         WHERE | 
|             del_flag = 0 | 
|             AND is_prohibit = 0 | 
|             AND locate(#{fenceId},town_id)>0 | 
|             AND user_type = '2' | 
|             AND (leave_start_time IS NULL OR now() < leave_start_time OR  now() > leave_end_time ) | 
|         order by ROUND(lat_lng_distance(#{lat}, #{lon}, latitude, longitude), 3) asc  limit  1 | 
|     </select> | 
|   | 
|     <select id="findByUserTypeAndFenceIdForNotLeave" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             user_id AS userId, | 
|             NAME, | 
|             avatar, | 
|             partner_id AS partnerId, | 
|             township_id AS townshipId, | 
|             latitude, | 
|             longitude | 
|         FROM | 
|             xzx_user_other_info | 
|         WHERE | 
|             del_flag = 0 | 
|             AND is_prohibit = 0 | 
|             AND locate(#{fenceId},town_id)>0 | 
|             AND user_type = '2' | 
|             AND (leave_start_time IS NULL OR now() < leave_start_time OR  now() > leave_end_time ) | 
|     </select> | 
|   | 
|     <select id="findByUserTypeAndPartnerIdForNotLeave" resultType="com.xzx.gc.entity.OtherUserInfo"> | 
|         SELECT | 
|             user_id AS userId, | 
|             NAME, | 
|             avatar, | 
|             partner_id AS partnerId, | 
|             township_id AS townshipId, | 
|             latitude, | 
|             longitude | 
|         FROM | 
|             xzx_user_other_info | 
|         WHERE | 
|             del_flag = 0 | 
|             AND is_prohibit = 0 | 
|             AND partner_id = #{partnerId} | 
|             AND user_type = '2' | 
|             AND (leave_start_time IS NULL OR now() < leave_start_time OR  now() > leave_end_time ) | 
|     </select> | 
| </mapper> |