New file |
| | |
| | | <?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> |