123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107 |
- <?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.kmall.admin.dao.OrderDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.kmall.admin.entity.OrderEntity" id="orderMap">
- <result property="id" column="id"/>
- <result property="merchOrderSn" column="merch_order_sn"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderStatus" column="order_status"/>
- <result property="shippingStatus" column="shipping_status"/>
- <result property="payStatus" column="pay_status"/>
- <result property="consignee" column="consignee"/>
- <result property="country" column="country"/>
- <result property="province" column="province"/>
- <result property="city" column="city"/>
- <result property="district" column="district"/>
- <result property="address" column="address"/>
- <result property="mobile" column="mobile"/>
- <result property="postscript" column="postscript"/>
- <result property="shippingId" column="shipping_id"/>
- <result property="shippingName" column="shipping_name"/>
- <result property="shippingCode" column="shipping_code"/>
- <result property="shippingNo" column="shipping_no"/>
- <result property="payId" column="pay_id"/>
- <result property="payName" column="pay_name"/>
- <result property="shippingFee" column="shipping_fee"/>
- <result property="actualPrice" column="actual_price"/>
- <result property="integral" column="integral"/>
- <result property="integralMoney" column="integral_money"/>
- <result property="orderPrice" column="order_price"/>
- <result property="goodsPrice" column="goods_price"/>
- <result property="addTime" column="add_time"/>
- <result property="confirmTime" column="confirm_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="freightPrice" column="freight_price"/>
- <result property="couponId" column="coupon_id"/>
- <result property="couponPrice" column="coupon_price"/>
- <result property="callbackStatus" column="callback_status"/>
- <result property="orderType" column="order_type"/>
- <result property="storeId" column="store_id"/>
- <result property="userName" column="username"/>
- <result property="orderType" column="order_type"/>
- <result property="activityId" column="activity_id"/>
- <result property="deliveryDate" column="delivery_date"/>
- <result property="deliveryRemark" column="delivery_remark"/>
- <result property="predictTime" column="predict_time"/>
- <result property="orderBizType" column="order_biz_type"/>
- <result property="isPaymentSend" column="is_payment_send"/>
- <result property="isEleOrderSend" column="is_ele_order_send"/>
- <result property="isCustomsSend" column="is_customs_send"/>
- <result property="payFlag" column="pay_flag"/>
- <result column="buyer_pay_check" property="buyerPayCheck"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="sku" column="sku"/>
- <result property="createTime" column="create_time"/>
- <result property="modTime" column="mod_time"/>
- <result property="isOnfflineOrder" column="is_onffline_order"/>
- <result property="orderSnWx" column="order_sn_wx"/>
- <result property="isMergePay" column="is_merge_pay"/>
- <result property="payTransactionId" column="pay_transaction_id"/>
- <result property="storeName" column="store_name"/>
- <result property="moderSn" column="moder_sn"/>
- <result property="unitCode" column="unit_code"/>
- <result property="ciqProdModel" column="ciq_prod_model"/>
- <result property="oriCntCode" column="ori_cnt_code"/>
- <result property="brand" column="brand"/>
- <result column="gross_weight" property="grossWeight" />
- <result column="net_weight" property="netWeight" />
- <result property="fullCutPrice" column="full_cut_price"/>
- <result property="campMinusId" column="camp_minus_id"/>
- <result property="campName" column="camp_name"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join mall_user u on o.user_id = u.id
- where o.id = #{value}
- </select>
- <select id="queryObjectBySysUser" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join sys_user u on o.user_id = u.user_id
- where o.id = #{value}
- </select>
- <select id="queryObjectByActivityId" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join mall_user u on o.user_id = u.id
- where o.activity_id = #{activityId}
- </select>
- <select id="getTotalActualPrice" resultType="java.lang.Double">
- select sum(a.actual_price) 'totalActualPrice' from mall_order a where merch_order_sn = #{merchOrderSn}
- </select>
- <select id="queryObjectByMerchOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
- select * from mall_order a where merch_order_sn = #{merchOrderSn}
- </select>
- <select id="queryObjectByOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
- select * from mall_order a where order_sn = #{orderSn}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT DISTINCT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.pay_status,
- o.shipping_status,
- o.is_merge_pay,
- o.buyer_pay_check,
- o.order_price,
- o.moder_sn,
- o.id,
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- s.store_name,
- o.full_cut_price,
- o.camp_minus_id,
- o.camp_name
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryExportList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.pay_transaction_id,
- u.id_no 'idNo',
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- g.sku,
- g.goods_name,
- g.number,
- g.retail_price,
- s.store_name,
- nc.NAME ori_cnt_code,
- good.ciq_prod_model,
- good.brand,
- uc.NAME unit_code,
- good.gross_weight * g.number gross_weight,
- good.net_weight * g.number net_weight,
- t2.third_party_merch_name 'supplierThirdPartyMerchName'
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_store s ON o.store_id = s.id
- LEFT JOIN mall_goods good ON good.id = g.goods_id
- LEFT JOIN sys_cus_nation_code nc ON nc.CODE = good.ori_cnt_code
- LEFT JOIN sys_cus_unit_code uc ON uc.CODE = good.unit_code
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN third_merchant_biz t2 ON t2.third_merch_sn = r.supplier_third_id
- WHERE
- 1 =1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND good.sku = #{sku}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(DISTINCT o.id) FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- </select>
- <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- o.*,
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send
- FROM
- mall_order o
- LEFT JOIN sys_user u ON o.user_id = u.user_id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.admin.entity.OrderEntity" useGeneratedKeys="true" keyProperty="id">
- insert into mall_order
- (
- `order_sn`,
- `user_id`,
- `order_status`,
- `shipping_status`,
- `pay_status`,
- `consignee`,
- `country`,
- `province`,
- `city`,
- `district`,
- `address`,
- `mobile`,
- `postscript`,
- `shipping_id`,
- `shipping_name`,
- `shipping_code`,
- `shipping_no`,
- `pay_id`,
- `pay_name`,
- `shipping_fee`,
- `actual_price`,
- `integral`,
- `integral_money`,
- `order_price`,
- `goods_price`,
- `add_time`,
- `confirm_time`,
- `pay_time`,
- `freight_price`,
- `coupon_id`,
- `coupon_price`,
- full_cut_price,
- camp_minus_id,
- camp_name,
- `callback_status`,
- `order_type`,
- `store_id`,
- `order_biz_type`,
- `is_onffline_order`,
- `order_sn_wx`,
- `pay_flag`,
- `merch_sn`,
- `create_time`,
- `mod_time`
- )
- values
- (
- #{orderSn},
- #{userId},
- #{orderStatus},
- #{shippingStatus},
- #{payStatus},
- #{consignee},
- #{country},
- #{province},
- #{city},
- #{district},
- #{address},
- #{mobile},
- #{postscript},
- #{shippingId},
- #{shippingName},
- #{shippingCode},
- #{shippingNo},
- #{payId},
- #{payName},
- #{shippingFee},
- #{actualPrice},
- #{integral},
- #{integralMoney},
- #{orderPrice},
- #{goodsPrice},
- #{addTime},
- #{confirmTime},
- #{payTime},
- #{freightPrice},
- #{couponId},
- #{couponPrice},
- #{fullCutPrice},
- #{campMinusId},
- #{campName},
- #{callbackStatus},
- #{orderType},
- #{storeId},
- #{orderBizType},
- #{isOnfflineOrder},
- #{orderSnWx},
- #{payFlag},
- #{merchSn},
- #{createTime},
- #{modTime}
- )
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.OrderEntity">
- update mall_order
- <set>
- <if test="orderSn != null">`order_sn` = #{orderSn},</if>
- <if test="userId != null">`user_id` = #{userId},</if>
- <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
- <if test="shippingStatus != null">`shipping_status` = #{shippingStatus},</if>
- <if test="payStatus != null">`pay_status` = #{payStatus},</if>
- <if test="consignee != null">`consignee` = #{consignee},</if>
- <if test="country != null">`country` = #{country},</if>
- <if test="province != null">`province` = #{province},</if>
- <if test="city != null">`city` = #{city},</if>
- <if test="district != null">`district` = #{district},</if>
- <if test="address != null">`address` = #{address},</if>
- <if test="mobile != null">`mobile` = #{mobile},</if>
- <if test="postscript != null">`postscript` = #{postscript},</if>
- <if test="shippingId != null">`shipping_id` = #{shippingId},</if>
- <if test="shippingName != null">`shipping_name` = #{shippingName},</if>
- <if test="shippingCode != null">`shipping_code` = #{shippingCode},</if>
- <if test="shippingNo != null">`shipping_no` = #{shippingNo},</if>
- <if test="payId != null">`pay_id` = #{payId},</if>
- <if test="payName != null">`pay_name` = #{payName},</if>
- <if test="shippingFee != null">`shipping_fee` = #{shippingFee},</if>
- <if test="actualPrice != null">`actual_price` = #{actualPrice},</if>
- <if test="integral != null">`integral` = #{integral},</if>
- <if test="integralMoney != null">`integral_money` = #{integralMoney},</if>
- <if test="orderPrice != null">`order_price` = #{orderPrice},</if>
- <if test="goodsPrice != null">`goods_price` = #{goodsPrice},</if>
- <if test="addTime != null">`add_time` = #{addTime},</if>
- <if test="confirmTime != null">`confirm_time` = #{confirmTime},</if>
- <if test="payTime != null">`pay_time` = #{payTime},</if>
- <if test="freightPrice != null">`freight_price` = #{freightPrice},</if>
- <if test="couponId != null">`coupon_id` = #{couponId},</if>
- <if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
- <if test="fullCutPrice != null">`full_cut_price` = #{fullCutPrice},</if>
- <if test="campMinusId != null">`camp_minus_id` = #{campMinusId},</if>
- <if test="campName != null">`camp_name` = #{campName},</if>
- <if test="callbackStatus != null">`callback_status` = #{callbackStatus},</if>
- <if test="orderType != null">`order_type` = #{orderType},</if>
- <if test="storeId != null">`store_id` = #{storeId},</if>
- <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
- <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
- <if test="orderBizType != null">`order_biz_type` = #{orderBizType},</if>
- <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
- <if test="createTime != null">`create_time` = #{createTime},</if>
- <if test="modTime != null">`mod_time` = #{modTime},</if>
- <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
- <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_order where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_order where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <update id="riderOrderUpdate" parameterType="com.kmall.admin.entity.OrderEntity">
- update mall_order
- <set>
- `order_status` = #{orderStatus},
- `shipping_status` = #{shippingStatus},
- `shipping_id` = #{shippingId},
- `shipping_name` = #{shippingName},
- `shipping_fee` = #{shippingFee},
- `shipping_no` = #{shippingNo},
- `shipping_mobile` = #{shippingMobile}
- </set>
- where id = #{id}
- </update>
- <select id="getYfkOrderUserSum" resultType="int">
- select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
- inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
- left join mall_store s on o.store_id = s.id
- where pay_status = 2
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- group by o.user_id) u
- </select>
- <select id="getOderUserSum" resultType="int">
- select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
- inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
- left join mall_store s on o.store_id = s.id
- where 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- group by o.user_id) u
- </select>
- <select id="getTodayUserOrder" resultType="int">
- select count(1) from mall_order o
- left join mall_store s on o.store_id = s.id
- where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getTodayUserSales" resultType="int">
- select ifnull(sum(o.actual_price),0) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.pay_time > date_format(sysdate(), '%Y-%m-%d')
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getIncomeSum" resultType="int">
- select ifnull(sum(actual_price),0) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getPayedOrderCount" resultType="int">
- select count(1) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.is_onffline_order = 0
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="promOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.prom_id,
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- o.freight_price,
- o.activity_id,
- o.order_status,
- o.pay_status,
- store.store_name storeName,
- u.userName userName,
- o.buyer_pay_check,
- o.order_price,
- o.coupon_name couponName,
- o.add_time,
- o.shipping_status,
- (select count(1) from mall_order_goods where order_id = o.id) orderDetailCount,
- g.goods_id goodsId
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryPromOrderTotal" resultType="int">
- SELECT
- count(*)
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <select id="promOrderListExport" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.prom_id,
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- g.goods_name,
- g.number,
- g.retail_price,
- o.freight_price,
- o.activity_id,
- o.order_status,
- o.pay_status,
- store.store_name storeName,
- u.userName userName,
- o.buyer_pay_check,
- o.order_price,
- o.add_time,
- o.shipping_status,
- g.goods_id goodsId
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <select id="getActualPriceByOutProm" parameterType="map" resultType="java.lang.Double">
- SELECT
- o.actual_price - ( o.actual_price - g.retail_price * g.number ) promActualPrice
- FROM
- mk_store_prom_order_real r
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- WHERE 1=1
- AND g.goods_id = #{goodsId}
- AND r.order_id = #{orderId}
- <if test="statusList != null">
- AND o.order_status IN
- <foreach item="statusList" collection="statusList" open="(" separator="," close=")">
- #{statusList}
- </foreach>
- </if>
- </select>
- <select id="storeTopicOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.title 'storeTopicName',
- pt.prom_type_name 'storeTopicType',
- ss.store_name 'storeName',
- s.id 'storeTopicId',
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- o.freight_price,
- o.activity_id,
- o.coupon_id,
- o.coupon_name,
- o.camp_minus_id,
- o.camp_name,
- o.order_status,
- o.pay_status,
- u.userName userName,
- o.order_price,
- o.add_time,
- o.shipping_status
- FROM
- mall_order o
- INNER JOIN mall_store_topic s ON o.activity_id = s.id
- LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
- LEFT JOIN mall_store ss ON o.store_id = ss.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- 1=1
- <if test="storeTopicId != null and storeTopicId != ''">
- AND s.id = #{storeTopicId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND ss.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- order by o.id DESC
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryStoreTopicOrderTotal" resultType="int">
- SELECT
- count(*)
- FROM
- mall_order o
- INNER JOIN mall_store_topic s ON o.activity_id = s.id
- LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
- LEFT JOIN mall_store ss ON o.store_id = ss.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE 1=1
- <if test="storeTopicId != null and storeTopicId != ''">
- AND s.id = #{storeTopicId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND ss.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- </mapper>
|