zainali5120
2020-10-12 43385a77303aa2295d902b5a2be9e28723d08cef
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
<?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.coin.dao.OrderCoinsDao">    
    
    <select id="getOrderCountByToday" resultType="long">
        <![CDATA[  SELECT COUNT(*) from coins_order  WHERE DATE_FORMAT(create_time, '%Y-%m-%d') >= DATE_FORMAT(#{now}, '%Y-%m-%d') 
        and  DATE_FORMAT(create_time, '%Y-%m-%d') <  DATE_FORMAT(#{tomorrow}, '%Y-%m-%d') ]]>
    </select>
    
    <select id="findCoinOrderListByMemberIdAndSysmbol" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
        SELECT * FROM coins_order a where a.member_id= #{memberId} and a.order_status = #{status}
            <if test="symbol != null and symbol !=''">
                 and a.symbol = #{symbol}
            </if>
            order by create_time desc
    </select>
    
    <select id="findWalletCoinOrderByOrderNo" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
        
    SELECT *  FROM coins_order a where a.order_no= #{orderNo}  
    </select>
 
 
    <select id="selectAllEntrustingCoinOrderList" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
        select *
        from coins_order
        where order_status=1
        <if test="list != null">
            and symbol not in
            <foreach collection="list" separator="," item="item" open="(" close=")">
                #{item}
            </foreach>
        </if>
    </select>
 
    <select id="selectCoinOrderOnTrade" resultType="com.xcong.excoin.modules.coin.entity.OrderCoinsEntity">
        select *
        from coins_order
        where order_status=1
        <if test="list != null">
            and symbol in
            <foreach collection="list" separator="," item="item" open="(" close=")">
                #{item}
            </foreach>
        </if>
    </select>
 
    <update id="updateDeal" parameterType="map">
        update coins_order
        <set>
            <if test="dealCnt!=null">
                deal_cnt = deal_cnt+#{dealCnt},
            </if>
            <if test="dealAmount!=null">
                deal_amount = deal_amount+#{dealAmount},
            </if>
        </set>
        where id = #{id}
    </update>
</mapper>