xiaoyong931011
2023-08-11 d96780e6122bace05b9f17eaabf202061f06979f
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="cc.mrbird.febs.dapp.mapper.DappAKlineMapper">
 
    <select id="selectListByType" resultType="cc.mrbird.febs.dapp.vo.AKLineVo">
        select
        a.type type,
        a.create_time createTime,
        a.price price
        from dapp_a_kline a
        <where>
            <if test="record.type != null">
                and a.type = #{record.type}
            </if>
        </where>
        order by a.create_time asc
    </select>
 
    <select id="selectListByTypeAndTime" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where a.type = #{type}
        and date_format(a.create_time, '%Y-%m-%d') in
        <foreach collection="dateStr" separator="," close=")" open="(" item="item">
            #{item}
        </foreach>
        order by a.create_time asc
    </select>
 
    <select id="selectListByTypeAndLimit" resultType="cc.mrbird.febs.dapp.vo.AKLineLimitVo">
        select
            a.open_price openPrice,
            a.close_price closePrice,
            a.lowest_price lowestPrice,
            a.highest_price highestPrice,
            a.create_time createTime
        from dapp_a_kline a
        where a.type = #{type}
<!--        <where>-->
<!--            <if test="type != 1">-->
<!--                and a.type = #{type}-->
<!--            </if>-->
<!--            <if test="type == 1">-->
<!--                and a.type in (0,1)-->
<!--            </if>-->
<!--        </where>-->
        order by a.create_time desc
        limit #{kLineLimit}
    </select>
 
    <select id="selectOneByType" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where a.type in (0,1)
        order by a.create_time desc
        limit 1
    </select>
 
    <select id="selectDayByType" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where a.type = 2
        order by a.create_time desc
        limit 1
    </select>
 
    <select id="selectOneByTypeAsc" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
            a.*
        from dapp_a_kline a
        where type in (0,1)
        order by a.create_time desc
            limit 1
    </select>
 
    <select id="selectListByTypeAndHour" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
        a.*
        from dapp_a_kline a
        where date_format(a.create_time, '%Y-%m-%d %H') in
        <foreach collection="dateStr" separator="," close=")" open="(" item="item">
            #{item}
        </foreach>
        order by a.create_time asc
    </select>
 
    <select id="selectOneHourByType" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
            a.*
        from dapp_a_kline a
        where type = 1
        order by a.create_time desc
            limit 1
    </select>
 
    <select id="selectListByIds" resultType="cc.mrbird.febs.dapp.entity.DappAKlineEntity">
        select
            a.*
        from dapp_a_kline a
        where id > #{min}
          and id <![CDATA[ <= ]]> #{max}
    </select>
 
</mapper>