935090232@qq.com
2021-01-15 e971ea090aa1f320f3c3f78c3a2a8d50f16dd4d0
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
<?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.matrix.system.hive.dao.SysOrderFlowDao">
 
    <resultMap id="SysOrderFlowMap" type="SysOrderFlow">
        <id property="id" column="id" />
        <result property="createBy" column="create_by" />
        <result property="createTime" column="create_time" />
        <result property="updateBy" column="update_by" />
        <result property="updateTime" column="update_time" />
        <result property="flowNo" column="flow_no" />
        <result property="orderId" column="order_id" />
        <result property="flowContent" column="flow_content" />
        <result property="flowType" column="flow_type" />
        <result property="amount" column="amount" />
        <result property="vipId" column="vip_id" />
        <result property="payMethod" column="pay_method" />
        <result property="cardId" column="card_id" />
        <result property="isGift" column="is_gift" />
 
        <result property="orderNo" column="order_no" />
    </resultMap>
 
    <insert id="insert" parameterType="SysOrderFlow" useGeneratedKeys="true"
            keyProperty="id">
        INSERT INTO sys_order_flow (
        ID,
        create_by,
        create_time,
        update_by,
        update_time,
        flow_no,
        order_id,
        flow_content,
        flow_type,
        amount,
        vip_id,
        pay_method,
        card_id,
        is_gift,
        shop_id,
        company_id
        )
        VALUES (
        #{id},
        #{createBy},
        now(),
        #{updateBy},
        now(),
        #{flowNo},
        #{orderId},
        #{flowContent},
        #{flowType},
        #{amount},
        #{vipId},
        #{payMethod},
        #{cardId},
        #{isGift},
        #{shopId},
        #{companyId}
        )
    </insert>
 
    <select id="selectByOrderId" resultMap="SysOrderFlowMap">
        select a.*, b.order_no from sys_order_flow a
        left join sys_order b on a.order_id=b.id
        where order_id=#{orderId}
    </select>
 
    <select id="selectPayMethodsAmountByOrderId" resultMap="SysOrderFlowMap">
        select
            pay_method,
            sum(amount) amount
        from sys_order_flow
        where order_id=#{orderId}
        group by pay_method
    </select>
</mapper>