Helius
2021-06-16 4e51778362c2130598a4c73ec4cebe6629dbc53f
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
<?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.WeightItemPriceMapper">
  <resultMap id="BaseResultMap" type="com.xzx.gc.entity.WeightItemPrice">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="weight" jdbcType="VARCHAR" property="weight" />
    <result column="storage_id" jdbcType="VARCHAR" property="storageId" />
    <result column="storage_time" jdbcType="VARCHAR" property="storageTime" />
    <result column="product_type" jdbcType="VARCHAR" property="productType" />
    <result column="package_id" jdbcType="VARCHAR" property="packageId" />
    <result column="create_time" jdbcType="VARCHAR" property="createTime" />
    <result column="update_time" jdbcType="VARCHAR" property="updateTime" />
    <result column="status" jdbcType="VARCHAR" property="status" />
  </resultMap>
 
    <select id="queryRoyaltyManage" resultType="com.xzx.gc.model.admin.SettlementModel">
        select a.`name` as name,
        a.mobile_phone as mobilePhone,
        '回收员' as roleName,
        a.user_id as receiver
        from xzx_user_other_info a
        left join xzx_weight_item_price b on a.user_id=b.receiver and b.status in ('2','4','1')
        <if test="packageId != null and packageId != ''">
            and b.package_id=#{packageId}
        </if>
        <if test="startTime != null and startTime != ''">
            and b.storage_time<![CDATA[>= ]]> #{startTime}
        </if>
        <if test="endTime != null and endTime != ''">
            and b.storage_time<![CDATA[<= ]]> #{endTime}
        </if>
        where a.del_flag=0 and a.user_type=2
        <if test="name != null and name != ''">
            and (a.name like  concat("%",#{name} ,"%") or a.mobile_phone like concat("%",#{name} ,"%"))
        </if>
        <if test="mobilePhone != null and mobilePhone != ''">
            and (a.name like  concat("%",#{mobilePhone} ,"%") or a.mobile_phone like concat("%",#{mobilePhone} ,"%"))
        </if>
        <if test="partnerId != null and partnerId != ''">
            and a.partner_id=#{partnerId}
        </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>
        group by a.user_id
    </select>
 
    <select id="queryWeightItemList" resultType="com.xzx.gc.entity.WeightItemPrice" parameterType="com.xzx.gc.model.order.QueryRuleManageDetailDTO">
        SELECT
        a.*,
        b.title "productName",
        c.name,
        c.mobile_phone,
        '回收员' as 'roleName'
        FROM
        xzx_weight_item_price a
        inner join  xzx_user_other_info c on a.receiver=c.user_id
        LEFT JOIN xzx_package_goods_info b ON a.package_id = b.package_id
        AND a.product_type = b.item_type
        WHERE
        a.receiver = #{receiver} and cast(a.settle_money as decimal)>0
        <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>
        <choose>
            <when test="status != null and status != ''">
                and a.status=#{status}  order by a.storage_time desc
            </when>
            <otherwise>
                and a.status in ('1','2','4')  order by a.status
            </otherwise>
        </choose>
 
    </select>
 
    <select id="queryWpList" resultType="com.xzx.gc.model.admin.WeightItemPriceModel">
        select * from xzx_weight_item_price where status='1'  and (settle_money is null or settle_money='0')
    </select>
 
 
</mapper>