| <?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.UserShareInfoMapper"> | 
|     <select id="queryShareInfoList" resultType="com.xzx.gc.model.admin.XzxUserShareInfoModel"> | 
|         SELECT | 
|         a.id, | 
|         a.register_time, | 
|         a.mobile_phone, | 
|         a.register_mobile_phone, | 
|         IFNULL( a.reward_money, 0 ) AS rewardMoney, | 
|         b.user_id, | 
|         c.user_id AS invitedUserId, | 
|         FROM_base64 ( b.nick_name ) "name", | 
|         FROM_base64 ( c.nick_name ) "registerName" | 
|         FROM | 
|         xzx_user_share_info a | 
|         LEFT JOIN xzx_user_info b ON a.mobile_phone = b.mobile_phone | 
|         AND b.del_flag = 0 | 
|         LEFT JOIN xzx_user_info c ON a.register_mobile_phone = c.mobile_phone | 
|         AND c.del_flag =0 | 
|         where  1=1 | 
|         <if test="mobilePhone != null and mobilePhone != ''"> | 
|             AND  a.mobile_phone like   concat("%",#{mobilePhone} ,"%") | 
|         </if> | 
|         <if test="registerMobilePhone != null and registerMobilePhone != ''"> | 
|             AND  a.register_mobile_phone like   concat("%",#{registerMobilePhone} ,"%") | 
|         </if> | 
|         <if test="registerName != null and registerName != ''"> | 
|             AND  FROM_base64 ( c.nick_name ) like   concat("%",#{registerName} ,"%") | 
|         </if> | 
|         <if test="name != null and name != ''"> | 
|             AND  FROM_base64 ( b.nick_name ) like   concat("%",#{name} ,"%") | 
|         </if> | 
|   | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.register_time>=#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.register_time<=#{endTime} | 
|         </if> | 
|         <if test="partnerId != null and partnerId != ''"> | 
|             and LOCATE(#{partnerId} ,c.partner_id)>0 | 
|         </if> | 
|          order by a.register_time desc | 
|     </select> | 
|     <select id="totalAmount" resultType="java.lang.String"> | 
|         SELECT | 
|         IFNULL(sum(a.reward_money),0) as rewardMoney | 
|         FROM | 
|         xzx_user_share_info a | 
|         LEFT JOIN xzx_user_info b ON a.mobile_phone = b.mobile_phone | 
|         AND b.del_flag = 0 | 
|         LEFT JOIN xzx_user_info c ON a.register_mobile_phone = c.mobile_phone | 
|         AND c.del_flag =0 | 
|         where  1=1 | 
|         <if test="mobilePhone != null and mobilePhone != ''"> | 
|             AND  a.mobile_phone like   concat("%",#{mobilePhone} ,"%") | 
|         </if> | 
|         <if test="registerMobilePhone != null and registerMobilePhone != ''"> | 
|             AND  a.register_mobile_phone like   concat("%",#{registerMobilePhone} ,"%") | 
|         </if> | 
|         <if test="registerName != null and registerName != ''"> | 
|             AND  FROM_base64 ( c.nick_name ) like   concat("%",#{registerName} ,"%") | 
|         </if> | 
|         <if test="name != null and name != ''"> | 
|             AND  FROM_base64 ( b.nick_name ) like   concat("%",#{name} ,"%") | 
|         </if> | 
|   | 
|         <if test="startTime != null and startTime != ''"> | 
|             AND a.register_time>=#{startTime} | 
|         </if> | 
|         <if test="endTime != null and endTime != ''"> | 
|             AND a.register_time<=#{endTime} | 
|         </if> | 
|         <if test="partnerId != null and partnerId != ''"> | 
|             and LOCATE(#{partnerId} ,c.partner_id)>0 | 
|         </if> | 
|     </select> | 
|     <select id="queryShareOrderList" resultType="com.xzx.gc.model.admin.XzxPlatformCapitalInfoModel"> | 
|         SELECT | 
|             a.order_id "orderId", | 
|             a.create_time "createTime", | 
|             c.money "orderMoney", | 
|             b.money "royaltyMoney" | 
|         FROM | 
|             xzx_order_info a | 
|             INNER JOIN xzx_order_detail_info c ON a.order_id = c.order_id | 
|             INNER JOIN xzx_pay_info b ON a.order_id = b.order_id | 
|                                          AND b.pay_type = '10' | 
|         WHERE | 
|             a.create_user_id = #{invitedUserId} | 
|             AND b.create_user_id = #{userId} | 
|     </select> | 
|     <select id="queryWeightOrderList" resultType="com.xzx.gc.model.admin.WeightOrderModel"> | 
|         select a.create_time,a.order_id,IFNULL(b.nick_name,j.name) as nickName,IFNULL(b.mobile_phone,j.mobile_phone) as mobilePhone, | 
|         a.money as royaltyMoney,k.orderMoney,k.orderWeight as designatedWeight,k.hhrMoney as partnerMoney | 
|         from xzx_pay_info a | 
|         left join xzx_order_info n on a.order_id=n.order_id | 
|         left join xzx_user_info b on a.create_user_id = b.user_id | 
|         left join xzx_user_other_info j on a.create_user_id = j.user_id | 
|         left join ( | 
|         select sum(d.money) as orderMoney,sum(d.weight) as orderWeight,c.create_user_id as user_id,c.order_id,e.money as hhrMoney | 
|         from xzx_order_info c | 
|         left join xzx_order_item_info d on c.order_id=d.order_id | 
|         left join xzx_partner_account_log e on c.order_id=e.flow_no | 
|         where e.type=3 group by c.order_id | 
|         )k on k.order_id = a.order_id | 
|         where a.pay_type=13 | 
|   | 
|         <if test="fenceIds != null and fenceIds.size() != 0"> | 
|             AND  n.town_id  in | 
|             <foreach collection="fenceIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|   | 
|         <if test="partnerId != null and partnerId != ''"> | 
|             AND  j.partner_id=#{partnerId} | 
|         </if> | 
|         <if test="partnerId==null or partnerId == ''"> | 
|             AND j.partnerId is NULL | 
|         </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="mobilePhone != null and mobilePhone != ''"> | 
|             AND  (b.mobile_phone like concat("%",#{mobilePhone}, "%") or | 
|             b.nick_name =#{nickName}) | 
|         </if> | 
|         group by a.order_id order by create_time desc | 
|     </select> | 
|     <select id="queryFenceByPartnerIds" resultType="java.lang.String"> | 
|         select fence_id from xzx_partner_fence where 1=1 | 
|         <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="queryTotalRoyaltyMoney" parameterType="java.util.List" resultType="java.lang.String"> | 
|         select sum(a.money) from   xzx_pay_info a | 
|             left join xzx_order_info n on a.order_id=n.order_id | 
|             left join xzx_user_info b on a.create_user_id= b.user_id | 
|         where a.pay_type=13 | 
|         <if test=" fenceIds != null and fenceIds.size() != 0"> | 
|             AND  n.town_id  in | 
|             <foreach collection="fenceIds" index="index" item="id" open="(" separator="," close=")"> | 
|                 #{id} | 
|             </foreach> | 
|         </if> | 
|     </select> | 
|   | 
|   | 
|     <select id="queryPackageGoods" resultType="map"> | 
|         select title,item_type  from xzx_package_goods_info | 
|         where del_flag=0 and put_storage_price is not null | 
|             <if test="packageId != null and packageId != ''"> | 
|                 AND package_id =#{packageId} | 
|             </if> | 
|     </select> | 
|   | 
|   | 
| </mapper> |