xiaoyong931011
2021-04-06 d76ed8abc8f31e210f4e93f173f41bc2861870dd
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
108
109
110
111
112
113
<?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.contract.dao.ContractHoldOrderDao">
 
    <select id="selectHoldOrderListByMemberIdAndSymbolTest" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where member_id=#{memberId}
        <if test="type!=null and type!=0">
            and contract_type=#{type}
        </if>
        and is_can_closing=1
        order by create_time desc
    </select>
 
    <update id="updateContractHoldOrderCanNotClosingByIds" parameterType="map">
        UPDATE contract_hold_order set is_can_closing = 0,batch_no=#{batchNo}
        where is_can_closing=1
        and id in
        <foreach collection="list" close=")" item="item" open="(" separator=",">
            #{item.orderId}
        </foreach>
    </update>
 
    <select id="selectContractHoldOrderByBatchNo" parameterType="string" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where batch_no=#{batchNo}
    </select>
 
    <update id="updateOrderIsCanClosingAndBatchNoById" parameterType="long">
        update contract_hold_order set is_can_closing  = 1 ,batch_no=null
        where id=#{id}
    </update>
 
    <select id="selectHoldOrderListByMemberId" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where member_id=#{memberId} and is_can_closing=1 order by create_time desc
    </select>
 
    <select id="selectHoldOrderListByMemberIdAndSymbol" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where member_id=#{memberId}
        <if test="symbol!=null and symbol!=''">
            and symbol=#{symbol}
        </if>
        <if test="type!=null and type!=0">
            and contract_type=#{type}
        </if>
        and is_can_closing=1
        order by create_time desc
    </select>
 
    <select id="selectHoldOrderByMemberIdAndId" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where member_id=#{memberId} and id=#{id}
    </select>
 
    <update id="updateHoldOrderIsCanClosingById">
        update contract_hold_order set is_can_closing=#{isCanClosing}
        where id=#{id}
    </update>
 
    <select id="selectAllHoldOrder" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order
    </select>
 
    <select id="selectMemberHoldOrderByPositionType" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order
        where position_type=#{positionType} and is_can_closing=1 and member_id=#{memberId}
    </select>
 
    <select id="selectWholeHoldOrderByOrderType" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order
        where member_id=#{memberId} and opening_type=#{orderType} and symbol=#{symbol}
    </select>
 
    <select id="selectHoldOrderListForWholeByMemberIdAndSymbol" resultType="com.xcong.excoin.modules.contract.entity.ContractHoldOrderEntity">
        select * from contract_hold_order where member_id=#{memberId}
        <if test="symbol != null  and symbol != ''">
            and symbol=#{symbol}
        </if>
        and position_type=2
        order by create_time desc
    </select>
 
    <select id="selectAllWholeOrderMemberId" resultType="java.lang.Long">
        select
            member_id
        from contract_hold_order
        where position_type=2 and is_can_closing=1
        group by member_id
    </select>
 
    <select id="selectWholeHoldOrderSymbolsByMemberId" resultType="java.lang.String">
        select distinct symbol
        from contract_hold_order
        where position_type=2 and member_id=#{memberId}
    </select>
 
    <update id="updateForcePriceBySymbolAndMemberId">
        update contract_hold_order
        set force_closing_price=#{forcePrice}, is_can_closing=1
        where member_id=#{memberId} and symbol=#{symbol}
    </update>
 
 
    <update id="updateMemberAllHoldOrderClosingStatus">
        update contract_hold_order
        set is_can_closing = 0
        where member_id=#{memberId}
    </update>
 
    <select id="selectMemberHasWholeOrder" resultType="java.lang.Long">
        select distinct member_id
        from contract_hold_order
        where position_type=2
    </select>
 
</mapper>