Commit f4557a82a8337568168085b3950a5d2eb5df8c2d

Authored by zhangxing
1 parent 0b73874e

order 基础xml

src/main/resources/mapping/com/diligrp/xtrade/order/OrderDao.xml
1   -<?xml version="1.0" encoding="UTF-8"?>
2   -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3   -<mapper namespace="com.diligrp.xtrade.order.dao.OrderDao">
4   -
5   - <sql id="QUERY_COLUMN_LIST">
6   - <![CDATA[id , `order_id` AS orderId, `seller_account` AS sellerAccount, `seller_card_no` AS sellerCardNo,
7   - `seller_card_type` AS sellerCardType, `seller_name` AS sellerName, `seller_mobile` AS sellerMobile, `buyer_account` AS buyerAccount,
8   - `buyer_card_no` AS buyerCardCo, `buyer_card_type` AS buyerCardType, `buyer_name` AS buyerName, `buyer_mobile` AS buyerMobile,
9   - `market_id` AS marketId, `order_status` AS orderStatus, `trade_flow_id` AS tradeFlowId, `total_money` AS totalMoney,
10   - `seller_total_commission` AS sellerTotalCommission , `buyer_total_commission` AS buyerTotalCommission, `weight`,
11   - `pay_type` AS payType, `pay_src` AS paySrc, `order_created_src` AS orderCreatedSrc, `order_type` AS orderType,
12   - `payment_id` AS paymentId, `twice` , `pay_time` AS payTime, `created_time` AS createdTime, `modified_time`AS modifiedTime, `is_del` AS isDel]]>
13   - </sql>
14   -
15   - <insert id="insertEntity" parameterType="orderDo">
16   - <![CDATA[
17   - INSERT INTO `order`(`order_id`, `seller_account`, `seller_card_no`, `seller_card_type`, `seller_name`, `seller_mobile`,
18   - `buyer_account`, `buyer_card_no`, `buyer_card_type`, `buyer_name`, `buyer_mobile`, `market_id`,
19   - `order_status`, `trade_flow_id`, `total_money`, `seller_total_commission`, `buyer_total_commission`,
20   - `weight`, `pay_type`, `pay_src`, `order_created_src`, `pay_time`, `created_time`, `modified_time`, `is_del`)
21   - VALUES(#{orderId}, #{sellerAccount}, #{sellerCardNo}, #{sellerCardType}, #{sellerName},
22   - #{sellerMobile}, #{buyerAccount}, #{buyerCardNo}, #{buyerCardType}, #{buyerName}, #{buyerMobile},
23   - #{marketId}, #{orderStatus}, #{tradeFlowId}, #{totalMoney}, #{sellerTotalCommission}, #{buyerTotalCommission},
24   - #{weight}, #{payType}, #{paySrc}, #{orderCreatedSrc}, NOW(), NOW(), NOW(),1);
25   - ]]>
26   - </insert>
27   -
28   - <select id="selectEntityByOrderId" parameterType="long" resultType="orderDo">
29   - SELECT
30   - <include refid="QUERY_COLUMN_LIST"/>
31   - FROM `order`
32   - WHERE order_id =#{orderId}
33   - </select>
34   -
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.diligrp.xtrade.order.dao.OrderDao">
  4 +
  5 + <sql id="QUERY_COLUMN_LIST">
  6 + <![CDATA[id,`order_id` AS orderId, `saccount`, `scard_no` AS scardNo, `scard_type` AS scardType, `sname`, `smobile`, `baccount`, `bcard_no` AS bcardNo, `bcard_type` AS bcardType,
  7 + `bname`, `bmobile`,`market_code` AS marketCode, `order_status` AS orderStatus, `trade_no` AS tradeNo, `total_money` AS totalMoney,`scommission`, `bcommission`, `weight`,
  8 + `pay_type` AS payType, `pay_src` AS paySrc, `created_src` AS createdSrc, `order_type` AS orderType, `pay_time` AS payTime, `created_time` AS createdTime, `modified_time`AS modifiedTime, `is_del` AS isDel]]>
  9 + </sql>
  10 +
  11 + <sql id="QUERY_WHERE_CLAUSE">
  12 + <where>
  13 + <if test="orderId != null and orderId != ''"><![CDATA[AND xt_order.order_id = #{orderId}]]></if>
  14 + <if test="saccount != null and saccount != ''"><![CDATA[AND xt_order.saccount = #{saccount}]]></if>
  15 + <if test="scardNo != null and scardNo != ''"><![CDATA[AND xt_order.scard_no = #{scardNo}]]></if>
  16 + <if test="sname != null and sname != ''"><![CDATA[AND xt_order.sname = #{sname}]]></if>
  17 + <if test="bcardNo != null and bcardNo != ''"><![CDATA[AND xt_order.bcard_no = #{bcardNo}]]></if>
  18 + <if test="bname != null and bname != ''"><![CDATA[AND xt_order.bname = #{bname}]]></if>
  19 + <if test="payType != null and payType != ''"><![CDATA[AND xt_order.pay_type = #{payType}]]></if>
  20 + <if test="paySrc != null and paySrc != ''"><![CDATA[AND xt_order.pay_src = #{paySrc}]]></if>
  21 + <if test="createdSrc != null and createdSrc != '0'.toString() "><![CDATA[AND xt_order.created_src = #{createdSrc} ]]></if>
  22 + <if test="orderType != null and orderType != '' "><![CDATA[AND xt_order.order_type = #{orderType} ]]></if>
  23 + </where>
  24 + </sql>
  25 +
  26 + <sql id="UPDATE_COLUMN_SET">
  27 + <set>
  28 + <if test="buyerAccount != null"><![CDATA[buyer_account = #{buyerAccount},]]></if>
  29 + <if test="buyerCardNo != null"><![CDATA[buyer_card_no = #{buyerCardNo},]]></if>
  30 + <if test="buyerCardType != null"><![CDATA[buyer_card_type = #{buyerCardType},]]></if>
  31 + <if test="buyerName != null"><![CDATA[buyer_name = #{buyerName},]]></if>
  32 + <if test="buyerMobile != null"><![CDATA[buyer_mobile = #{buyerMobile},]]></if>
  33 + <if test="payDate != null"><![CDATA[pay_date = #{payDate},]]></if>
  34 + <if test="orderStatus != null"><![CDATA[order_status = #{orderStatus},]]></if>
  35 + <if test="tradeNo != null"><![CDATA[trade_no = #{tradeNo},]]></if>
  36 + <if test="scommission != null"><![CDATA[scommission = #{scommission},]]></if>
  37 + <if test="bcommission != null"><![CDATA[bcommission = #{bcommission},]]></if>
  38 + <if test="payType != null and payType != ''"><![CDATA[pay_type = #{payType},]]></if>
  39 + <if test="paySrc != null and paySrc != ''"><![CDATA[pay_src = #{paySrc},]]></if>
  40 + <if test="orderType != null and orderType !=''"><![CDATA[order_type = #{orderType},]]></if>
  41 + <![CDATA[modify_date = now()]]>
  42 + </set>
  43 + </sql>
  44 +
  45 + <sql id="QUERY_ORDER_LIMIT_CONDTION">
  46 + <if
  47 + test="orderField != null and orderField != '' and orderFieldType != null and orderFieldType != ''"><![CDATA[ORDER BY etrade_order.${orderField} ${orderFieldType}]]></if>
  48 + <if
  49 + test="startIndex != null and startIndex &gt;= 0 and pageSize != null and pageSize &gt; 0"><![CDATA[LIMIT #{startIndex},#{pageSize}]]></if>
  50 + </sql>
  51 +
  52 + <insert id="insertEntity" parameterType="orderDo">
  53 + <![CDATA[
  54 + INSERT INTO `xt_order`(`order_id`, `saccount`, `scard_no`, `scard_type`, `sname`, `smobile`, `baccount`, `bcard_no`, `bcard_type`, `bname`, `bmobile`, `market_code`,
  55 + `order_status`, `trade_no`, `total_money`, `scommission`, `bcommission`, `weight`, `pay_type`, `pay_src`, `created_src`, `pay_time`, `created_time`, `modified_time`, `is_del`)
  56 + VALUES(#{orderId}, #{saccount}, #{scardNo}, #{scardType}, #{sname}, #{smobile}, #{baccount}, #{bcardNo}, #{bcardType}, #{bname}, #{bmobile},
  57 + #{marketCode}, #{orderStatus}, #{tradeNo}, #{totalMoney}, #{scommission}, #{bcommission},#{weight}, #{payType}, #{paySrc}, #{createdSrc}, NOW(), NOW(), NOW(),1);
  58 + ]]>
  59 + </insert>
  60 +
  61 + <update id="updateByOrderId" parameterType="orderDo">
  62 + <![CDATA[UPDATE `xt_order`]]>
  63 + <include refid="UPDATE_COLUMN_SET" />
  64 + <![CDATA[ WHERE order_id = #{orderId}]]>
  65 + </update>
  66 +
  67 + <select id="selectEntryList" parameterType="orderDo" resultType="orderDo">
  68 + <![CDATA[SELECT]]>
  69 + <include refid="QUERY_COLUMN_LIST" />
  70 + <![CDATA[FROM `xt_order`]]>
  71 + <include refid="QUERY_WHERE_CLAUSE" />
  72 + <include refid="QUERY_ORDER_LIMIT_CONDTION" />
  73 + </select>
  74 +
  75 + <select id="selectEntryListCount" parameterType="orderDo" resultType="int">
  76 + <![CDATA[SELECT COUNT(xt_order.id) AS dataCount FROM `xt_order`]]>
  77 + <include refid="QUERY_WHERE_CLAUSE" />
  78 + </select>
  79 +
  80 + <select id="selectEntityByOrderId" parameterType="long" resultType="orderDo">
  81 + SELECT
  82 + <include refid="QUERY_COLUMN_LIST"/>
  83 + FROM `xt_order`
  84 + WHERE order_id =#{orderId}
  85 + </select>
  86 +
35 87 </mapper>
36 88 \ No newline at end of file
... ...