Helius
2020-09-29 0fc53e33aca76db86895dfafa5e4547e45f8a14d
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
<?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">
 
    <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}
        and symbol=#{symbol}
        and position_type=2
        order by create_time desc
    </select>
 
    <select id="selectAllWholeOrderMemberIdAndSymbol" resultType="java.util.HashMap">
        select
            member_id,
            symbol
        from contract_hold_order
        where position_type=2
        group by member_id, symbol
    </select>
</mapper>