1
zyy
2025-12-12 0f900ede938b2dda75a09451e12f37f9facefc08
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.dz.StockDzMapper">
 
 
    <select id="findStockTypeDz" resultType="com.yami.trading.bean.dz.dto.StockDzDto" parameterType="map">
        SELECT
        *
        FROM t_stock_dz
 
        WHERE start_time &lt; #{formatDate} AND end_time &gt; #{formatDate}
 
        <if test="stockType != null and stockType != '' ">
            AND stock_type = #{stockType}
        </if>
 
        <if test="keyWords != null and keyWords != '' ">
            AND (
            stock_spell LIKE CONCAT('%', #{keyWords}, '%')
            OR stock_name LIKE CONCAT('%', #{keyWords}, '%')
            )
        </if>
 
        <if test="orderBy != null">
            ORDER BY  increase_ratio
            <if test="orderBy == 'desc'">
                DESC
            </if>
            <if test="orderBy == 'asc'">
                ASC
            </if>
        </if>
    </select>
 
    <select id="getDzListByAdmin" resultType="java.util.HashMap" parameterType="map">
        SELECT
        *
        FROM t_stock_dz
        WHERE 1=1
        <if test="stockType != null and stockType != '' ">
            AND stock_type = #{stockType}
        </if>
        <if test="keyWords != null and keyWords != '' ">
            AND (
            stock_code LIKE CONCAT('%', #{keyWords}, '%')
            OR stock_name LIKE CONCAT('%', #{keyWords}, '%')
            )
        </if>
        ORDER BY  add_time DESC
    </select>
 
    <select id="getDzOrderList" resultType="com.yami.trading.bean.dz.dto.ExchangeApplyOrderDzDto" parameterType="map">
        SELECT
        t.*,s.stock_name,s.day_rate,s.period
        FROM t_exchange_apply_order_dz t
        LEFT JOIN t_stock_dz s ON t.dz_id=s.uuid
        WHERE 1=1
        <if test="stockType != null and stockType != '' ">
            AND s.stock_type = #{stockType}
        </if>
        <if test="state != null and state != ''">
            AND t.state = #{state}
        </if>
        <if test="state == null">
            AND t.state != 'position'
        </if>
        <if test="userId != null and userId != '' ">
            AND t.party_id = #{userId}
        </if>
        ORDER BY  t.create_time DESC
    </select>
 
    <select id="getDzCheckList" resultType="com.yami.trading.bean.dz.dto.ExchangeApplyOrderDzDto" parameterType="map">
        SELECT
        t.*,u.user_name,u.user_code,s.stock_name,r.user_name AS 'recomUserName'
        FROM t_exchange_apply_order_dz t
        LEFT JOIN tz_user u ON t.party_id = u.user_id
        LEFT JOIN t_stock_dz s ON s.uuid = t.dz_id
        LEFT JOIN tz_user r ON u.user_recom = r.user_id
        WHERE 1=1
        <if test="state != null and state != ''">
            AND t.state = #{state}
        </if>
        <if test="stockCode != null and stockCode != '' ">
            AND t.symbol LIKE CONCAT('%', #{stockCode}, '%')
        </if>
        <if test="stockType != null and stockType != '' ">
            AND s.stock_type = #{stockType}
        </if>
        <if test="userName != null and userName != '' ">
            AND (
            u.user_name LIKE CONCAT('%', #{userName}, '%')
            OR u.user_code LIKE CONCAT('%', #{userName}, '%')
            )
        </if>
        <if test="checkedList!=null">
            and u.user_id in
            <foreach collection="checkedList" separator="," index="index" open="(" close=")" item="r">
                #{r}
            </foreach>
 
        </if>
 
        ORDER BY  t.create_time DESC
    </select>
 
</mapper>