2020-05-06 07:40:43 +08:00

283 lines
14 KiB
Java

<?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.java2nb.test.dao.OrderDao">
<select id="get" resultType="com.java2nb.test.domain.OrderDO">
select `id`,`fb_merchant_code`,`merchant_order_sn`,`order_sn`,`platform_order_no`,`trade_no`,`order_state`,`fn_coupon`,`red_packet`,`total_fee`,`order_price`,`fee`,`body`,`attach`,`store_id`,`cashier_id`,`device_no`,`user_id`,`user_logon_id`,`pay_time`,`pay_channel`,`no_cash_coupon_fee`,`cash_coupon_fee`,`cash_fee`,`sign`,`options`,`create_time`,`push_time`,`push_ip`,`mcht_id`,`sn` from fb_order where id = #{value}
</select>
<select id="list" resultType="com.java2nb.test.domain.OrderDO">
select `id`,`fb_merchant_code`,`merchant_order_sn`,`order_sn`,`platform_order_no`,`trade_no`,`order_state`,`fn_coupon`,`red_packet`,`total_fee`,`order_price`,`fee`,`body`,`attach`,`store_id`,`cashier_id`,`device_no`,`user_id`,`user_logon_id`,`pay_time`,`pay_channel`,`no_cash_coupon_fee`,`cash_coupon_fee`,`cash_fee`,`sign`,`options`,`create_time`,`push_time`,`push_ip`,`mcht_id`,`sn` from fb_order
<where>
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="fbMerchantCode != null and fbMerchantCode != ''"> and fb_merchant_code = #{fbMerchantCode} </if>
<if test="merchantOrderSn != null and merchantOrderSn != ''"> and merchant_order_sn = #{merchantOrderSn} </if>
<if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn} </if>
<if test="platformOrderNo != null and platformOrderNo != ''"> and platform_order_no = #{platformOrderNo} </if>
<if test="tradeNo != null and tradeNo != ''"> and trade_no = #{tradeNo} </if>
<if test="orderState != null and orderState != ''"> and order_state = #{orderState} </if>
<if test="fnCoupon != null and fnCoupon != ''"> and fn_coupon = #{fnCoupon} </if>
<if test="redPacket != null and redPacket != ''"> and red_packet = #{redPacket} </if>
<if test="totalFee != null and totalFee != ''"> and total_fee = #{totalFee} </if>
<if test="orderPrice != null and orderPrice != ''"> and order_price = #{orderPrice} </if>
<if test="fee != null and fee != ''"> and fee = #{fee} </if>
<if test="body != null and body != ''"> and body = #{body} </if>
<if test="attach != null and attach != ''"> and attach = #{attach} </if>
<if test="storeId != null and storeId != ''"> and store_id = #{storeId} </if>
<if test="cashierId != null and cashierId != ''"> and cashier_id = #{cashierId} </if>
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo} </if>
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
<if test="userLogonId != null and userLogonId != ''"> and user_logon_id = #{userLogonId} </if>
<if test="payTime != null and payTime != ''"> and pay_time = #{payTime} </if>
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel} </if>
<if test="noCashCouponFee != null and noCashCouponFee != ''"> and no_cash_coupon_fee = #{noCashCouponFee} </if>
<if test="cashCouponFee != null and cashCouponFee != ''"> and cash_coupon_fee = #{cashCouponFee} </if>
<if test="cashFee != null and cashFee != ''"> and cash_fee = #{cashFee} </if>
<if test="sign != null and sign != ''"> and sign = #{sign} </if>
<if test="options != null and options != ''"> and options = #{options} </if>
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
<if test="pushTime != null and pushTime != ''"> and push_time = #{pushTime} </if>
<if test="pushIp != null and pushIp != ''"> and push_ip = #{pushIp} </if>
<if test="mchtId != null and mchtId != ''"> and mcht_id = #{mchtId} </if>
<if test="sn != null and sn != ''"> and sn = #{sn} </if>
</where>
<choose>
<when test="sort != null and sort.trim() != ''">
order by ${sort} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="count" resultType="int">
select count(*) from fb_order
<where>
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="fbMerchantCode != null and fbMerchantCode != ''"> and fb_merchant_code = #{fbMerchantCode} </if>
<if test="merchantOrderSn != null and merchantOrderSn != ''"> and merchant_order_sn = #{merchantOrderSn} </if>
<if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn} </if>
<if test="platformOrderNo != null and platformOrderNo != ''"> and platform_order_no = #{platformOrderNo} </if>
<if test="tradeNo != null and tradeNo != ''"> and trade_no = #{tradeNo} </if>
<if test="orderState != null and orderState != ''"> and order_state = #{orderState} </if>
<if test="fnCoupon != null and fnCoupon != ''"> and fn_coupon = #{fnCoupon} </if>
<if test="redPacket != null and redPacket != ''"> and red_packet = #{redPacket} </if>
<if test="totalFee != null and totalFee != ''"> and total_fee = #{totalFee} </if>
<if test="orderPrice != null and orderPrice != ''"> and order_price = #{orderPrice} </if>
<if test="fee != null and fee != ''"> and fee = #{fee} </if>
<if test="body != null and body != ''"> and body = #{body} </if>
<if test="attach != null and attach != ''"> and attach = #{attach} </if>
<if test="storeId != null and storeId != ''"> and store_id = #{storeId} </if>
<if test="cashierId != null and cashierId != ''"> and cashier_id = #{cashierId} </if>
<if test="deviceNo != null and deviceNo != ''"> and device_no = #{deviceNo} </if>
<if test="userId != null and userId != ''"> and user_id = #{userId} </if>
<if test="userLogonId != null and userLogonId != ''"> and user_logon_id = #{userLogonId} </if>
<if test="payTime != null and payTime != ''"> and pay_time = #{payTime} </if>
<if test="payChannel != null and payChannel != ''"> and pay_channel = #{payChannel} </if>
<if test="noCashCouponFee != null and noCashCouponFee != ''"> and no_cash_coupon_fee = #{noCashCouponFee} </if>
<if test="cashCouponFee != null and cashCouponFee != ''"> and cash_coupon_fee = #{cashCouponFee} </if>
<if test="cashFee != null and cashFee != ''"> and cash_fee = #{cashFee} </if>
<if test="sign != null and sign != ''"> and sign = #{sign} </if>
<if test="options != null and options != ''"> and options = #{options} </if>
<if test="createTime != null and createTime != ''"> and create_time = #{createTime} </if>
<if test="pushTime != null and pushTime != ''"> and push_time = #{pushTime} </if>
<if test="pushIp != null and pushIp != ''"> and push_ip = #{pushIp} </if>
<if test="mchtId != null and mchtId != ''"> and mcht_id = #{mchtId} </if>
<if test="sn != null and sn != ''"> and sn = #{sn} </if>
</where>
</select>
<insert id="save" parameterType="com.java2nb.test.domain.OrderDO" useGeneratedKeys="true" keyProperty="id">
insert into fb_order
(
`fb_merchant_code`,
`merchant_order_sn`,
`order_sn`,
`platform_order_no`,
`trade_no`,
`order_state`,
`fn_coupon`,
`red_packet`,
`total_fee`,
`order_price`,
`fee`,
`body`,
`attach`,
`store_id`,
`cashier_id`,
`device_no`,
`user_id`,
`user_logon_id`,
`pay_time`,
`pay_channel`,
`no_cash_coupon_fee`,
`cash_coupon_fee`,
`cash_fee`,
`sign`,
`options`,
`create_time`,
`push_time`,
`push_ip`,
`mcht_id`,
`sn`
)
values
(
#{fbMerchantCode},
#{merchantOrderSn},
#{orderSn},
#{platformOrderNo},
#{tradeNo},
#{orderState},
#{fnCoupon},
#{redPacket},
#{totalFee},
#{orderPrice},
#{fee},
#{body},
#{attach},
#{storeId},
#{cashierId},
#{deviceNo},
#{userId},
#{userLogonId},
#{payTime},
#{payChannel},
#{noCashCouponFee},
#{cashCouponFee},
#{cashFee},
#{sign},
#{options},
#{createTime},
#{pushTime},
#{pushIp},
#{mchtId},
#{sn}
)
</insert>
<insert id="saveSelective" parameterType="com.java2nb.test.domain.OrderDO" useGeneratedKeys="true" keyProperty="id">
insert into fb_order
(
<if test="id != null"> `id`, </if>
<if test="fbMerchantCode != null"> `fb_merchant_code`, </if>
<if test="merchantOrderSn != null"> `merchant_order_sn`, </if>
<if test="orderSn != null"> `order_sn`, </if>
<if test="platformOrderNo != null"> `platform_order_no`, </if>
<if test="tradeNo != null"> `trade_no`, </if>
<if test="orderState != null"> `order_state`, </if>
<if test="fnCoupon != null"> `fn_coupon`, </if>
<if test="redPacket != null"> `red_packet`, </if>
<if test="totalFee != null"> `total_fee`, </if>
<if test="orderPrice != null"> `order_price`, </if>
<if test="fee != null"> `fee`, </if>
<if test="body != null"> `body`, </if>
<if test="attach != null"> `attach`, </if>
<if test="storeId != null"> `store_id`, </if>
<if test="cashierId != null"> `cashier_id`, </if>
<if test="deviceNo != null"> `device_no`, </if>
<if test="userId != null"> `user_id`, </if>
<if test="userLogonId != null"> `user_logon_id`, </if>
<if test="payTime != null"> `pay_time`, </if>
<if test="payChannel != null"> `pay_channel`, </if>
<if test="noCashCouponFee != null"> `no_cash_coupon_fee`, </if>
<if test="cashCouponFee != null"> `cash_coupon_fee`, </if>
<if test="cashFee != null"> `cash_fee`, </if>
<if test="sign != null"> `sign`, </if>
<if test="options != null"> `options`, </if>
<if test="createTime != null"> `create_time`, </if>
<if test="pushTime != null"> `push_time`, </if>
<if test="pushIp != null"> `push_ip`, </if>
<if test="mchtId != null"> `mcht_id`, </if>
<if test="sn != null"> `sn` </if>
)
values
(
<if test="id != null"> #{id}, </if>
<if test="fbMerchantCode != null"> #{fbMerchantCode}, </if>
<if test="merchantOrderSn != null"> #{merchantOrderSn}, </if>
<if test="orderSn != null"> #{orderSn}, </if>
<if test="platformOrderNo != null"> #{platformOrderNo}, </if>
<if test="tradeNo != null"> #{tradeNo}, </if>
<if test="orderState != null"> #{orderState}, </if>
<if test="fnCoupon != null"> #{fnCoupon}, </if>
<if test="redPacket != null"> #{redPacket}, </if>
<if test="totalFee != null"> #{totalFee}, </if>
<if test="orderPrice != null"> #{orderPrice}, </if>
<if test="fee != null"> #{fee}, </if>
<if test="body != null"> #{body}, </if>
<if test="attach != null"> #{attach}, </if>
<if test="storeId != null"> #{storeId}, </if>
<if test="cashierId != null"> #{cashierId}, </if>
<if test="deviceNo != null"> #{deviceNo}, </if>
<if test="userId != null"> #{userId}, </if>
<if test="userLogonId != null"> #{userLogonId}, </if>
<if test="payTime != null"> #{payTime}, </if>
<if test="payChannel != null"> #{payChannel}, </if>
<if test="noCashCouponFee != null"> #{noCashCouponFee}, </if>
<if test="cashCouponFee != null"> #{cashCouponFee}, </if>
<if test="cashFee != null"> #{cashFee}, </if>
<if test="sign != null"> #{sign}, </if>
<if test="options != null"> #{options}, </if>
<if test="createTime != null"> #{createTime}, </if>
<if test="pushTime != null"> #{pushTime}, </if>
<if test="pushIp != null"> #{pushIp}, </if>
<if test="mchtId != null"> #{mchtId}, </if>
<if test="sn != null"> #{sn} </if>
)
</insert>
<update id="update" parameterType="com.java2nb.test.domain.OrderDO">
update fb_order
<set>
<if test="fbMerchantCode != null">`fb_merchant_code` = #{fbMerchantCode}, </if>
<if test="merchantOrderSn != null">`merchant_order_sn` = #{merchantOrderSn}, </if>
<if test="orderSn != null">`order_sn` = #{orderSn}, </if>
<if test="platformOrderNo != null">`platform_order_no` = #{platformOrderNo}, </if>
<if test="tradeNo != null">`trade_no` = #{tradeNo}, </if>
<if test="orderState != null">`order_state` = #{orderState}, </if>
<if test="fnCoupon != null">`fn_coupon` = #{fnCoupon}, </if>
<if test="redPacket != null">`red_packet` = #{redPacket}, </if>
<if test="totalFee != null">`total_fee` = #{totalFee}, </if>
<if test="orderPrice != null">`order_price` = #{orderPrice}, </if>
<if test="fee != null">`fee` = #{fee}, </if>
<if test="body != null">`body` = #{body}, </if>
<if test="attach != null">`attach` = #{attach}, </if>
<if test="storeId != null">`store_id` = #{storeId}, </if>
<if test="cashierId != null">`cashier_id` = #{cashierId}, </if>
<if test="deviceNo != null">`device_no` = #{deviceNo}, </if>
<if test="userId != null">`user_id` = #{userId}, </if>
<if test="userLogonId != null">`user_logon_id` = #{userLogonId}, </if>
<if test="payTime != null">`pay_time` = #{payTime}, </if>
<if test="payChannel != null">`pay_channel` = #{payChannel}, </if>
<if test="noCashCouponFee != null">`no_cash_coupon_fee` = #{noCashCouponFee}, </if>
<if test="cashCouponFee != null">`cash_coupon_fee` = #{cashCouponFee}, </if>
<if test="cashFee != null">`cash_fee` = #{cashFee}, </if>
<if test="sign != null">`sign` = #{sign}, </if>
<if test="options != null">`options` = #{options}, </if>
<if test="createTime != null">`create_time` = #{createTime}, </if>
<if test="pushTime != null">`push_time` = #{pushTime}, </if>
<if test="pushIp != null">`push_ip` = #{pushIp}, </if>
<if test="mchtId != null">`mcht_id` = #{mchtId}, </if>
<if test="sn != null">`sn` = #{sn}</if>
</set>
where id = #{id}
</update>
<delete id="remove">
delete from fb_order where id = #{value}
</delete>
<delete id="batchRemove">
delete from fb_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>