Helius
2021-05-20 29d77ee5c824af547b4a3e814d50fd0d4bdf4de3
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
<?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.xcong.excoin.modules.otc.dao.OtcEntrustOrderDao">
 
    <select id="selectEntrustListInPage" resultType="com.xcong.excoin.modules.otc.vo.EntrustListVo">
        select
            a.id,
            b.id mbId
            ,c.name nickname
            ,a.unit_price unitPrice
            ,a.remain_coin_amount amount
            ,a.limit_min_amount min
            ,a.limit_max_amount max
            ,b.total_order_cnt orderCnt
            ,b.finish_ratio finishRatio
        from otc_entrust_order a
        left join otc_market_bussiness b on a.member_id=b.member_id
        left join member c on a.member_id=c.id
        <where>
            a.status=1
            <if test="record != null">
                <if test="record.type != null and record.type!=''">
                    and order_type = #{record.type}
                </if>
            </if>
        </where>
        order by a.create_time desc
    </select>
 
    <select id="selectEntrustOrderByOrderType" resultType="com.xcong.excoin.modules.otc.entity.OtcEntrustOrder">
        select * from otc_entrust_order
        <where>
            <if test="record.orderType != null and record.orderType != ''" >
               and order_type = #{record.orderType}
            </if>
            <if test="record.memberId != null">
                and member_id = #{record.memberId}
            </if>
            <if test="record.status != null and record.status == 3">
                and status != #{record.status}
            </if>
            <if test="record.status != null and record.status != 3">
                and status == #{record.status}
            </if>
        </where>
    </select>
 
    <select id="selectOwnEntrustListInPage" resultType="com.xcong.excoin.modules.otc.entity.OtcEntrustOrder">
        select * from otc_entrust_order
        <where>
            <if test="record.orderType != null and record.orderType != ''" >
                and order_type = #{record.orderType}
            </if>
            <if test="record.memberId != null">
                and member_id = #{record.memberId}
            </if>
            <if test="record.status != null and record.status == 3">
                and status != #{record.status}
            </if>
            <if test="record.status != null and record.status != 3">
                and status == #{record.status}
            </if>
        </where>
        order by create_time desc
    </select>
 
    <update id="updateRemainAmount">
        update otc_entrust_order
        set remain_coin_amount = remain_coin_amount + ${amount}
        where id=#{id}
    </update>
</mapper>