1
zj
2024-06-13 8eea5be3b36875bd4ffe70e6c3a5bb07b1d829bf
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
<?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.yami.trading.dao.ipo.UserPromiseRecordMapper">
 
 
    <select id="sumPromise" resultType="com.yami.trading.bean.ipo.dto.SumUserPromiseDto">
        SELECT SUM(deduct_usdt)  as  sumUdst ,SUM(deduct_number)  as  deductNumber,count(*) as 'count' FROM t_user_promise_record where
           user_id = #{userId} and product_code=#{productCode}
    </select>
 
 
    <select id="pageUserPromiseData" resultType="com.yami.trading.bean.ipo.dto.UserPromiseListDto">
 
    SELECT * FROM  t_user_promise_record  pr LEFT JOIN t_apply_new_shares_order  nss
       ON pr.order_no=nss.order_no  WHERE pr.user_id=#{userId}
        <if test="symbols != null and symbols.size() >0">
            AND pr.product_code in
            <foreach collection="symbols" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
    </select>
    <select id="pagePromiseData" resultType="com.yami.trading.bean.ipo.dto.UserListDto">
 
       SELECT pr.*,nss.sub_price as subPrice,
        nss.winning_number,nss.required_subscribe,nss.required_number,
              u.user_name, u.user_code, u.real_name FROM  t_user_promise_record  pr LEFT JOIN tz_user  u
       ON pr.user_id=u.user_id
         LEFT JOIN t_apply_new_shares_order  nss
        ON pr.order_no=nss.order_no
       WHERE 1=1
 
        <if test="children != null and children.size() >0">
            AND nss.user_id in
            <foreach collection="children" item="item" index="index" open="(" close=")" separator=",">
                #{item}
            </foreach>
        </if>
 
        <if test="userCode!=null and userCode!=''">
            and (u.user_name=#{userCode} or u.user_code=#{userCode})
        </if>
 
        <if test="productCode!=null and productCode!=''">
            and pr.product_code=#{productCode}
        </if>
 
        <if test="roleName!=null and roleName!=''">
            and u.role_name=#{roleName}
        </if>
 
        <if test="name!=null and name!=''">
            and pr.name=#{name}
        </if>
        <if test="productName!=null and productName!=''">
            and pr.product_name=#{productName}
        </if>
 
       <if test="status!=null and status!=''" >
           and pr.status=#{status}
 
       </if>
        order by pr.create_time desc
    </select>
 
 
 
    <select id="topData" resultType="com.yami.trading.bean.ipo.dto.PromiseTopDto">
           SELECT SUM(pr.deduct_usdt) AS 'subscriptionLimit',SUM(nss.winning_number*nss.sub_price) AS 'winningQuota' FROM  t_user_promise_record  pr LEFT JOIN t_apply_new_shares_order  nss
    ON pr.order_no=nss.order_no   WHERE pr.user_id=#{userId}
 
    </select>
 
 
 
</mapper>