123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972 |
- <?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.caimei.modules.order.dao.NewShopOrderDao">
- <sql id="shopOrderColumns">
- a.shopOrderID AS shopOrderID,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.fee AS fee,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.discountFee AS discountFee,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- a.shopPostFee AS shopPostFee,
- a.shopTaxFee AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- a.shopOtherFee AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- proportional AS proportional,
- a.promotionFullReduction As promotionFullReduction,
- a.zeroCostFlag AS zeroCostFlag
- </sql>
- <select id="get" resultType="NewShopOrder" useCache="false" flushCache="true">
- select <include refid="shopOrderColumns"/>
- from cm_shop_order a
- where a.shopOrderID = #{shopOrderID}
- </select>
- <delete id="deleteByOrderID">
- DELETE FROM cm_shop_order WHERE orderID=#{orderID}
- </delete>
- <insert id="insert" parameterType="NewShopOrder" keyProperty="shopOrderID" useGeneratedKeys="true">
- INSERT INTO cm_shop_order(
- orderID,
- shopOrderNo,
- orderNo,
- userID,
- shopID,
- itemCount,
- townID,
- productAmount,
- fee,
- discountAmount,
- accountAmount,
- totalAmount,
- payFlag,
- payTime,
- finishTime,
- status,
- refundStatus,
- needPayAmount,
- canRefundAmount,
- refundAmount,
- clubID,
- spID,
- mainSpID,
- orderBeanAmount,
- useBeanAmount,
- useBeanFlag,
- canRefundFlag,
- useBalanceFlag,
- canRefundBeans,
- freePostageFee,
- freePostageTicketID,
- brokerage,
- delFlag,
- refundsAmount,
- orderStatusFlag,
- buyStatus,
- orderSubmitType,
- orderType,
- orderTime,
- deliveryTimeMills,
- presentNum,
- preferential,
- discountFee,
- splitFlag,
- autoReceiveTimeMills,
- autoOverTimeMills,
- totalAddedValueTax,
- receiveGoodsTime,
- sendOutStatus,
- payStatus,
- costType,
- orderPromotionsId,
- promotionFullReduction,
- zeroCostFlag
- ) VALUES (
- #{orderID},
- #{shopOrderNo},
- #{orderNo},
- #{userID},
- #{shopID},
- #{itemCount},
- #{townID},
- #{productAmount},
- #{fee},
- #{discountAmount},
- #{accountAmount},
- #{totalAmount},
- #{payFlag},
- #{payTime},
- #{finishTime},
- #{status},
- #{refundStatus},
- #{needPayAmount},
- #{canRefundAmount},
- #{refundAmount},
- #{clubID},
- #{spID},
- #{mainSpID},
- #{orderBeanAmount},
- #{useBeanAmount},
- #{useBeanFlag},
- #{canRefundFlag},
- #{useBalanceFlag},
- #{canRefundBeans},
- #{freePostageFee},
- #{freePostageTicketID},
- #{brokerage},
- #{delFlag},
- #{refundsAmount},
- #{orderStatusFlag},
- #{buyStatus},
- #{orderSubmitType},
- #{orderType},
- #{orderTime},
- #{deliveryTimeMills},
- #{presentNum},
- #{preferential},
- #{discountFee},
- #{splitFlag},
- #{autoReceiveTimeMills},
- #{autoOverTimeMills},
- #{totalAddedValueTax},
- #{receiveGoodsTime},
- #{sendOutStatus},
- #{payStatus},
- #{costType},
- #{orderPromotionsId},
- #{promotionFullReduction},
- #{zeroCostFlag}
- )
- </insert>
- <select id="findByShopOrderID" resultType="newShopOrder">
- select <include refid="shopOrderColumns"/>
- from cm_shop_order a
- where a.shopOrderID = #{shopOrderID}
- </select>
- <select id="findList" resultType="newShopOrder">
- SELECT
- <include refid="shopOrderColumns"/>
- FROM cm_shop_order a
- <where>
- <if test="shopOrderNo != null and itemCount != ''" >
- AND a.shopOrderNo = #{shopOrderNo}
- </if>
- <if test="orderNo != null and itemCount != ''" >
- AND a.orderNo = #{orderNo}
- </if>
- <if test="orderID != null and itemCount != ''" >
- AND a.orderID = #{orderID}
- </if>
- <if test="userID != null and itemCount != ''" >
- AND a.userID = #{userID}
- </if>
- <if test="shopID != null and itemCount != ''" >
- AND a.shopID = #{shopID}
- </if>
- <if test="status != null and itemCount != ''" >
- AND a.status = #{status}
- </if>
- <if test="payFlag != null and itemCount != ''" >
- AND a.payFlag = #{payFlag}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findListByOrderID" resultType="newShopOrder">
- SELECT <include refid="shopOrderColumns"/>,
- b.name as shopName,
- b.commercialCode as commercialCode
- FROM cm_shop_order a left join shop b on a.shopID = b.shopID
- WHERE a.orderID = #{orderID} ORDER BY a.shopOrderNo DESC
- </select>
- <update id="update" parameterType="newShopOrder" >
- update cm_shop_order
- <set >
- <if test="shopOrderNo != null and shopOrderNo != ''" >
- shopOrderNo = #{shopOrderNo},
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''" >
- orderID = #{orderID},
- </if>
- <if test="orderNo != null and orderNo != ''" >
- orderNo = #{orderNo},
- </if>
- <if test="userID != null and userID != ''" >
- userID = #{userID},
- </if>
- <if test="shopID != null and shopID != ''" >
- shopID = #{shopID},
- </if>
- <if test="itemCount != null and itemCount != ''" >
- itemCount = #{itemCount},
- </if>
- <if test="townID != null and itemCount != ''" >
- townID = #{townID,jdbcType=INTEGER},
- </if>
- <if test="productAmount != null and productAmount != ''" >
- productAmount = #{productAmount},
- </if>
- <if test="fee != null and fee != ''" >
- fee = #{fee},
- </if>
- <if test="discountAmount != null and discountAmount != ''" >
- discountAmount = #{discountAmount},
- </if>
- <if test="accountAmount != null and accountAmount != ''" >
- accountAmount = #{accountAmount},
- </if>
- <if test="totalAmount != null and totalAmount != ''" >
- totalAmount = #{totalAmount},
- </if>
- <if test="payFlag != null and payFlag != ''" >
- payFlag = #{payFlag},
- </if>
- <if test="payTime != null and payTime != ''" >
- payTime = #{payTime},
- </if>
- <if test="finishTime != null and finishTime != ''" >
- finishTime = #{finishTime},
- </if>
- <if test="status != null and status != ''" >
- status = #{status},
- </if>
- <if test="refundStatus != null and refundStatus != ''" >
- refundStatus = #{refundStatus},
- </if>
- <if test="needPayAmount != null and needPayAmount != ''" >
- needPayAmount = #{needPayAmount},
- </if>
- <if test="canRefundAmount != null and canRefundAmount != ''" >
- canRefundAmount = #{canRefundAmount},
- </if>
- <if test="refundAmount != null and refundAmount != ''" >
- refundAmount = #{refundAmount},
- </if>
- <if test="clubID != null and clubID != ''" >
- clubID = #{clubID},
- </if>
- <if test="spID != null and itemCount != ''" >
- spID = #{spID,jdbcType=INTEGER},
- </if>
- <if test="mainSpID != null and mainSpID != ''" >
- mainSpID = #{mainSpID},
- </if>
- <if test="orderBeanAmount != null and orderBeanAmount != ''" >
- orderBeanAmount = #{orderBeanAmount},
- </if>
- <if test="useBeanAmount != null and useBeanAmount != ''" >
- useBeanAmount = #{useBeanAmount},
- </if>
- <if test="useBeanFlag != null and useBeanFlag != ''" >
- useBeanFlag = #{useBeanFlag},
- </if>
- <if test="canRefundFlag != null and canRefundFlag != ''" >
- canRefundFlag = #{canRefundFlag},
- </if>
- <if test="useBalanceFlag != null and useBalanceFlag != ''" >
- useBalanceFlag = #{useBalanceFlag},
- </if>
- <if test="canRefundBeans != null and canRefundBeans != ''" >
- canRefundBeans = #{canRefundBeans},
- </if>
- <if test="freePostageFee != null and freePostageFee != ''" >
- freePostageFee = #{freePostageFee},
- </if>
- <if test="freePostageTicketID != null and freePostageTicketID != ''" >
- freePostageTicketID = #{freePostageTicketID},
- </if>
- <if test="brokerage != null and brokerage != ''" >
- brokerage = #{brokerage},
- </if>
- <if test="delFlag != null and delFlag != ''" >
- delFlag = #{delFlag},
- </if>
- <if test="refundsAmount != null and refundsAmount != ''" >
- refundsAmount = #{refundsAmount},
- </if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''" >
- orderStatusFlag = #{orderStatusFlag},
- </if>
- <if test="buyStatus != null and buyStatus != ''" >
- buyStatus = #{buyStatus},
- </if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''" >
- deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderSubmitType != null and orderSubmitType != ''" >
- orderSubmitType = #{orderSubmitType},
- </if>
- <if test="orderType != null and orderType != ''" >
- orderType = #{orderType},
- </if>
- <if test="orderTime != null and orderTime != ''" >
- orderTime = #{orderTime},
- </if>
- <if test="presentNum != null and presentNum != ''" >
- presentNum = #{presentNum},
- </if>
- <if test="preferential != null and preferential != ''" >
- preferential = #{preferential},
- </if>
- <if test="outStoreNum != null and outStoreNum != ''" >
- outStoreNum = #{outStoreNum},
- </if>
- <if test="outStoreTimes != null and outStoreTimes != ''" >
- outStoreTimes = #{outStoreTimes},
- </if>
- <if test="discountFee != null and discountFee != ''" >
- discountFee = #{discountFee},
- </if>
- <if test="splitFlag != null and splitFlag != ''" >
- splitFlag = #{splitFlag},
- </if>
- <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''" >
- autoReceiveTimeMills = #{autoReceiveTimeMills},
- </if>
- <if test="autoOverTimeMills != null and autoOverTimeMills != ''" >
- autoOverTimeMills = #{autoOverTimeMills},
- </if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''" >
- receiveGoodsTime = #{receiveGoodsTime},
- </if>
- <if test="totalAddedValueTax != null and totalAddedValueTax != ''" >
- totalAddedValueTax = #{totalAddedValueTax},
- </if>
- <if test="note != null and note != ''" >
- note = #{note},
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''" >
- sendOutStatus = #{sendOutStatus},
- </if>
- <if test="paying != null and paying != ''" >
- paying = #{paying},
- </if>
- <if test="shopProductAmount != null" >
- shopProductAmount = #{shopProductAmount},
- </if>
- <if test="shopPostFee != null" >
- shopPostFee = #{shopPostFee},
- </if>
- <if test="shopTaxFee != null" >
- shopTaxFee = #{shopTaxFee},
- </if>
- <if test="shouldPayShopAmount != null" >
- shouldPayShopAmount = #{shouldPayShopAmount},
- </if>
- <if test="payedShopAmount != null" >
- payedShopAmount = #{payedShopAmount},
- </if>
- <if test="shopOtherFee != null" >
- shopOtherFee = #{shopOtherFee},
- </if>
- <if test="payStatus != null" >
- payStatus = #{payStatus},
- </if>
- <if test="costType != null" >
- costType = #{costType},
- </if>
- <if test="proportional != null" >
- proportional = #{proportional},
- </if>
- <if test="modifyShouldPayNote != null" >
- modifyShouldPayNote = #{modifyShouldPayNote},
- </if>
- <if test="modifyShouldPayUserID != null" >
- modifyShouldPayUserID = #{modifyShouldPayUserID},
- </if>
- <if test="modifyShouldPayDate != null" >
- modifyShouldPayDate = #{modifyShouldPayDate},
- </if>
- <if test="orderPromotionsId != null" >
- orderPromotionsId = #{orderPromotionsId},
- </if>
- <if test="promotionFullReduction != null" >
- promotionFullReduction = #{promotionFullReduction},
- </if>
- <if test="zeroCostFlag != null" >
- zeroCostFlag = #{zeroCostFlag}
- </if>
- </set>
- <where>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND shopOrderID = #{shopOrderID}
- </if>
- <if test="orderID != null and orderID != ''">
- AND orderID = #{orderID}
- </if>
- </where>
- </update>
- <delete id="delete">
- DELETE FROM cm_shop_order WHERE shopOrderID = #{shopOrderID}
- </delete>
- <update id="updateStatusByOrderID">
- update cm_shop_order set
- status = #{status} where orderID = #{orderID}
- </update>
- <update id="updateStatusByShopOrderID">
- update cm_shop_order set
- status = #{status} where shopOrderID = #{shopOrderID}
- </update>
- <insert id="shopOrderBak" parameterType="NewShopOrder" keyProperty="shopOrderBakID" useGeneratedKeys="true">
- INSERT INTO cm_shop_order_bak(
- orderID,
- shopOrderNo,
- orderNo,
- userID,
- shopID,
- itemCount,
- townID,
- productAmount,
- fee,
- discountAmount,
- accountAmount,
- totalAmount,
- payFlag,
- payTime,
- finishTime,
- status,
- refundStatus,
- needPayAmount,
- canRefundAmount,
- refundAmount,
- clubID,
- spID,
- mainSpID,
- orderBeanAmount,
- useBeanAmount,
- useBeanFlag,
- canRefundFlag,
- useBalanceFlag,
- canRefundBeans,
- freePostageFee,
- freePostageTicketID,
- brokerage,
- delFlag,
- refundsAmount,
- orderStatusFlag,
- buyStatus,
- orderSubmitType,
- orderType,
- orderTime,
- deliveryTimeMills,
- presentNum,
- preferential
- ) VALUES (
- #{orderID},
- #{shopOrderNo},
- #{orderNo},
- #{userID},
- #{shopID},
- #{itemCount},
- #{townID},
- #{productAmount},
- #{fee},
- #{discountAmount},
- #{accountAmount},
- #{totalAmount},
- #{payFlag},
- #{payTime},
- #{finishTime},
- #{status},
- #{refundStatus},
- #{needPayAmount},
- #{canRefundAmount},
- #{refundAmount},
- #{clubID},
- #{spID},
- #{mainSpID},
- #{orderBeanAmount},
- #{useBeanAmount},
- #{useBeanFlag},
- #{canRefundFlag},
- #{useBalanceFlag},
- #{canRefundBeans},
- #{freePostageFee},
- #{freePostageTicketID},
- #{brokerage},
- #{delFlag},
- #{refundsAmount},
- #{orderStatusFlag},
- #{buyStatus},
- #{orderSubmitType},
- #{orderType},
- #{orderTime},
- #{deliveryTimeMills},
- #{presentNum},
- #{preferential}
- )
- </insert>
- <update id="updateOrderStatus">
- UPDATE bp_order SET status = #{orderStatus} WHERE id = #{orderId}
- </update>
- <select id="findIDsByOrderID" resultType="int">
- select shopOrderID from cm_shop_order where orderID = #{orderID}
- </select>
- <update id="updateNote">
- UPDATE cm_shop_order SET note = #{note} WHERE shopOrderID = #{shopOrderID}
- </update>
- <select id="findShopOrderNum" resultType="int">
- select count(1) from cm_shop_order where orderID = #{orderID}
- </select>
- <update id="updateByShopOrderID" parameterType="newShopOrder">
- update cm_shop_order
- <set >
- <if test="shopOrderNo != null and shopOrderNo != ''" >
- shopOrderNo = #{shopOrderNo},
- </if>
- <if test="orderID != null and orderID != ''" >
- orderID = #{orderID},
- </if>
- <if test="orderNo != null and orderNo != ''" >
- orderNo = #{orderNo},
- </if>
- <if test="userID != null and userID != ''" >
- userID = #{userID},
- </if>
- <if test="shopID != null and shopID != ''" >
- shopID = #{shopID},
- </if>
- <if test="itemCount != null and itemCount != ''" >
- itemCount = #{itemCount},
- </if>
- <if test="townID != null and itemCount != ''" >
- townID = #{townID,jdbcType=INTEGER},
- </if>
- <if test="productAmount != null and productAmount != ''" >
- productAmount = #{productAmount},
- </if>
- <if test="fee != null and fee != ''" >
- fee = #{fee},
- </if>
- <if test="discountAmount != null and discountAmount != ''" >
- discountAmount = #{discountAmount},
- </if>
- <if test="accountAmount != null and accountAmount != ''" >
- accountAmount = #{accountAmount},
- </if>
- <if test="totalAmount != null and totalAmount != ''" >
- totalAmount = #{totalAmount},
- </if>
- <if test="payFlag != null and payFlag != ''" >
- payFlag = #{payFlag},
- </if>
- <if test="payTime != null and payTime != ''" >
- payTime = #{payTime},
- </if>
- <if test="finishTime != null and finishTime != ''" >
- finishTime = #{finishTime},
- </if>
- <if test="status != null and status != ''" >
- status = #{status},
- </if>
- <if test="refundStatus != null and refundStatus != ''" >
- refundStatus = #{refundStatus},
- </if>
- <if test="needPayAmount != null and needPayAmount != ''" >
- needPayAmount = #{needPayAmount},
- </if>
- <if test="canRefundAmount != null and canRefundAmount != ''" >
- canRefundAmount = #{canRefundAmount},
- </if>
- <if test="refundAmount != null and refundAmount != ''" >
- refundAmount = #{refundAmount},
- </if>
- <if test="clubID != null and clubID != ''" >
- clubID = #{clubID},
- </if>
- <if test="spID != null and itemCount != ''" >
- spID = #{spID,jdbcType=INTEGER},
- </if>
- <if test="mainSpID != null and mainSpID != ''" >
- mainSpID = #{mainSpID},
- </if>
- <if test="orderBeanAmount != null and orderBeanAmount != ''" >
- orderBeanAmount = #{orderBeanAmount},
- </if>
- <if test="useBeanAmount != null and useBeanAmount != ''" >
- useBeanAmount = #{useBeanAmount},
- </if>
- <if test="useBeanFlag != null and useBeanFlag != ''" >
- useBeanFlag = #{useBeanFlag},
- </if>
- <if test="canRefundFlag != null and canRefundFlag != ''" >
- canRefundFlag = #{canRefundFlag},
- </if>
- <if test="useBalanceFlag != null and useBalanceFlag != ''" >
- useBalanceFlag = #{useBalanceFlag},
- </if>
- <if test="canRefundBeans != null and canRefundBeans != ''" >
- canRefundBeans = #{canRefundBeans},
- </if>
- <if test="freePostageFee != null and freePostageFee != ''" >
- freePostageFee = #{freePostageFee},
- </if>
- <if test="freePostageTicketID != null and freePostageTicketID != ''" >
- freePostageTicketID = #{freePostageTicketID},
- </if>
- <if test="brokerage != null and brokerage != ''" >
- brokerage = #{brokerage},
- </if>
- <if test="delFlag != null and delFlag != ''" >
- delFlag = #{delFlag},
- </if>
- <if test="refundsAmount != null and refundsAmount != ''" >
- refundsAmount = #{refundsAmount},
- </if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''" >
- orderStatusFlag = #{orderStatusFlag},
- </if>
- <if test="buyStatus != null and buyStatus != ''" >
- buyStatus = #{buyStatus},
- </if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''" >
- deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderSubmitType != null and orderSubmitType != ''" >
- orderSubmitType = #{orderSubmitType},
- </if>
- <if test="orderType != null and orderType != ''" >
- orderType = #{orderType},
- </if>
- <if test="orderTime != null and orderTime != ''" >
- orderTime = #{orderTime},
- </if>
- <if test="presentNum != null and presentNum != ''" >
- presentNum = #{presentNum},
- </if>
- <if test="preferential != null and preferential != ''" >
- preferential = #{preferential},
- </if>
- <if test="outStoreNum != null and outStoreNum != ''" >
- outStoreNum = #{outStoreNum},
- </if>
- <if test="outStoreTimes != null and outStoreTimes != ''" >
- outStoreTimes = #{outStoreTimes},
- </if>
- <if test="discountFee != null and discountFee != ''" >
- discountFee = #{discountFee},
- </if>
- <if test="splitFlag != null and splitFlag != ''" >
- splitFlag = #{splitFlag},
- </if>
- <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''" >
- autoReceiveTimeMills = #{autoReceiveTimeMills},
- </if>
- <if test="autoOverTimeMills != null and autoOverTimeMills != ''" >
- autoOverTimeMills = #{autoOverTimeMills},
- </if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''" >
- receiveGoodsTime = #{receiveGoodsTime},
- </if>
- <if test="totalAddedValueTax != null and totalAddedValueTax != ''" >
- totalAddedValueTax = #{totalAddedValueTax},
- </if>
- <if test="note != null and note != ''" >
- note = #{note},
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''" >
- sendOutStatus = #{sendOutStatus}
- </if>
- </set>
- where shopOrderID = #{shopOrderID}
- </update>
- <select id="findPayOrderList" resultType="newShopOrder">
- select<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- co.status AS status,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="organizeID != null and organizeID != 9999">
- AND co.organizeID = #{organizeID}
- </if>
- <if test="organizeID == 9999 ">
- AND co.orderType = 2
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.payStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="buyer != null and buyer != ''">
- AND bou.name like concat('%', #{buyer} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- and (co.confirmFlag = '1' or co.confirmFlag = '2')
- <if test="operatingMode != null and operatingMode == '1'.toString()">
- and a.payStatus != 3 and co.status NOT IN (6,7)
- </if>
- <if test="operatingMode != null and operatingMode == '2'.toString()">
- and a.payStatus != 1 and co.status != 6
- </if>
- and co.delFlag = 0
- and a.delFlag = 0
- and a.shopOrderID not in (
- select cror.orderID from cm_receipt_order_relation cror
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- where cror.relationType = '1' and cror.delFlag = '0' AND cdr.receiptStatus = '2'
- and cror.orderID is not null
- )
- and a.shopID != 998
- and co.orderID not in (
- SELECT orderID FROM cm_order_product WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
- )
- </where>
- group by a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findPayOrderListByIDs" resultType="newShopOrder">
- select distinct <include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- <where>
- <if test="ids != null and ids != ''">
- and a.shopOrderID in
- <foreach collection="ids" open="(" close=")" item="id" separator=",">
- #{id}
- </foreach>
- </if>
- </where>
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findByRefundID" resultType="newShopOrder">
- select distinct <include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- where a.shopOrderID in
- (select crsr.shopOrderID
- from cm_refund_shop_record crsr
- left join cm_refund_shop crs on crsr.refundShopID = crs.id
- where crs.id = #{refundShopID} and crsr.shopOrderID is not null)
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="updatePayShopAmount">
- UPDATE cm_shop_order
- <set>
- <if test="shopProductAmount != null">
- shopProductAmount = #{shopProductAmount},
- </if>
- <if test="shopPostFee != null">
- shopPostFee = #{shopPostFee},
- </if>
- <if test="shopTaxFee != null">
- shopTaxFee = #{shopTaxFee},
- </if>
- <if test="shouldPayShopAmount != null">
- shouldPayShopAmount = #{shouldPayShopAmount},
- </if>
- <if test="shopOtherFee != null">
- shopOtherFee = #{shopOtherFee},
- </if>
- <if test="payStatus != null">
- payStatus = #{payStatus},
- </if>
- <if test="payedShopAmount != null">
- payedShopAmount = #{payedShopAmount}
- </if>
- </set>
- WHERE shopOrderID = #{shopOrderID}
- </select>
- <select id="findByShopOrderIDs" resultType="newShopOrder">
- select distinct <include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- left join club c on c.userID = a.userID
- where a.shopOrderID in
- <foreach collection="shopOrderIDs" separator="," item="shopOrderID" open="(" close=")">
- #{shopOrderID}
- </foreach>
- </select>
- <update id="updatePaying">
- update cm_shop_order set
- paying = #{paying}
- where shopOrderID = #{shopOrderID}
- </update>
- <update id="outPaying">
- update cm_shop_order set
- paying = '0' where shopOrderID in
- (select cpsr.shopOrderID from
- cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0' and cpsr.delFlag = '0' and cpsr.shopOrderID is not null)
- </update>
- <update id="inPaying">
- update cm_shop_order set
- paying = '1' where shopOrderID in
- (select cpsr.shopOrderID from
- cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0' and cpsr.delFlag = '0' and cpsr.shopOrderID is not null)
- </update>
- <update id="updatePayStatus">
- update cm_shop_order set payStatus = #{payStatus} where shopOrderID = #{shopOrderID}
- </update>
- <select id="findPayStatusByOrderID" resultType="string">
- select payStatus from cm_shop_order where orderID = #{orderID}
- </select>
- <select id="getPayingStatus" resultType="string">
- select ifnull(paying, '0') from cm_shop_order where shopOrderID in
- (select cpsr.shopOrderID from
- cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0' and cpsr.delFlag = '0' and cpsr.shopOrderID is not null)
- </select>
- <select id="findSiblingPostFeeOrder" resultType="newShopOrder">
- select <include refid="shopOrderColumns"/>
- from cm_shop_order a
- where a.orderID = #{orderID} and a.shopID = 998
- </select>
- <update id="updateByShopOtherFee">
- UPDATE cm_shop_order SET shopOtherFee = #{shopOtherFee} WHERE shopOrderID = #{shopOrderId}
- </update>
- <update id="updateByDifferencePrice">
- UPDATE cm_shop_order SET differenceType = #{type}, differencePrice = #{differencePrice} WHERE shopOrderID = #{shopOrderId}
- </update>
- </mapper>
|