123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591 |
- <?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.schedule.dao.QzOrderMapper">
- <select id="queryrderUnEvaluateList" resultType="map">
- SELECT
- a.id AS order_id,
- a.order_sn,
- c.goods_name,
- a.form_id,
- u.weixin_openid AS open_id
- FROM
- mall_order a
- LEFT JOIN mall_comment b ON a.id = b.order_id
- LEFT JOIN mall_order_goods c ON c.order_id = a.id
- LEFT JOIN mall_user u ON a.user_id = u.id
- WHERE
- b.id IS NULL
- AND a.confirm_time > date_add(now(), INTERVAL - 1 DAY)
- AND a.confirm_time IS NOT NULL
- </select>
- <select id="queryPastOrderList" resultType="map">
- SELECT
- b.product_id,
- b.number,
- c.stock_num,
- c.id AS storeRelaId,
- g.goods_number,
- g.id goods_id,
- g.goods_biz_type,
- a.store_id,
- g.merch_sn,
- g.sell_volume 'goods_sell_volume',
- c.sell_volume 'store_sell_volume',
- a.id 'orderId',
- mb.is_stock_share 'isStockShare',
- mb.third_party_merch_code,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler'
- FROM
- mall_order a
- LEFT JOIN mall_order_goods b ON a.id = b.order_id
- LEFT JOIN mall_product_store_rela c ON b.goods_id = c.goods_id
- AND c.store_id = a.store_id
- LEFT JOIN mall_goods g ON g.id = c.goods_id
- AND g.merch_sn = c.merch_sn
- LEFT JOIN third_merchant_biz mb2 ON mb2.third_party_merch_code = g.third_party_merch_code
- AND mb2.merch_sn = g.merch_sn
- LEFT JOIN mall_store s ON s.id = c.store_id
- LEFT JOIN third_merchant_biz mb ON mb.third_party_merch_code = s.third_party_merch_code
- AND mb.merch_sn = s.merch_sn
- WHERE
- 1 = 1
- AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
- AND a.order_status in (0,100) and a.order_type = 1 AND a.is_onffline_order = 0
- </select>
- <update id="unpayPastUpdate">
- UPDATE mall_order a
- SET order_status=101,shipping_status=0,pay_status=0
- WHERE 1 = 1
- AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
- AND a.order_status = 0 and a.order_type = 1 AND a.is_onffline_order = 0
- </update>
- <update id="updateStockNum" parameterType="map">
- update mall_product_store_rela a
- <set>
- <if test="stock_num != null">a.`stock_num` = #{stock_num},</if>
- <if test="sell_volume != null">a.`sell_volume` = #{sell_volume},</if>
- </set>
- where a.id = #{id}
- </update>
- <update id="updateGoodsStockNum" parameterType="map">
- update mall_goods a
- <set>
- <if test="goods_number != null">a.`goods_number` = #{goods_number},</if>
- <if test="sell_volume != null">a.`sell_volume` = #{sell_volume},</if>
- </set>
- where a.id = #{id}
- </update>
- <insert id="saveStoreMngChange" parameterType="com.kmall.schedule.entity.StoreMngChangeJobEntity">
- insert into mall_store_mng_change(
- `store_change_num`,
- `store_original_num`,
- `store_valid_num`,
- `merch_sn`,
- `store_id`,
- `goods_id`,
- `is_valid`,
- `change_type`,
- `change_reason`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`)
- values(
- #{storeChangeNum},
- #{storeOriginalNum},
- #{storeValidNum},
- #{merchSn},
- #{storeId},
- #{goodsId},
- #{isValid},
- #{changeType},
- #{changeReason},
- #{createrSn},
- #{createTime},
- #{moderSn},
- #{modTime},
- #{tstm})
- </insert>
- <insert id="saveMngChange" parameterType="com.kmall.schedule.entity.MngChangeJobEntity">
- insert into mall_mng_change(
- `change_num`,
- `original_num`,
- `valid_num`,
- `merch_sn`,
- `third_party_merch_code`,
- `goods_id`,
- `is_valid`,
- `change_type`,
- `change_reason`,
- `creater_sn`,
- `create_time`,
- `moder_sn`,
- `mod_time`,
- `tstm`)
- values(
- #{changeNum},
- #{originalNum},
- #{validNum},
- #{merchSn},
- #{thirdPartyMerchCode},
- #{goodsId},
- #{isValid},
- #{changeType},
- #{changeReason},
- #{createrSn},
- #{createTime},
- #{moderSn},
- #{modTime},
- #{tstm})
- </insert>
- <select id="queryRefundOrderList" resultType="map">
- SELECT
- a.pay_transaction_id,
- a.merch_order_sn,
- a.order_sn,
- a.order_status,
- a.pay_status,
- f.out_refund_no,
- f.refund_id,
- f.order_id 'orderId',
- f.id 'orderRefundId',
- a.is_onffline_order,
- a.order_sn_wx,
- a.pay_flag,
- a.store_id,
- a.merch_sn,
- g.goods_number,
- b.number,
- c.stock_num,
- c.id AS storeRelaId,
- g.id goods_id,
- g.goods_biz_type,
- g.sell_volume 'goods_sell_volume',
- c.sell_volume 'store_sell_volume',
- mb.is_stock_share 'isStockShare',
- mb.third_party_merch_code,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler'
- FROM
- mall_order a
- LEFT JOIN mall_order_goods b ON a.id = b.order_id
- INNER JOIN mall_order_refund f ON a.id = f.order_id
- LEFT JOIN mall_product_store_rela c ON b.goods_id = c.goods_id
- AND c.store_id = a.store_id
- left join mall_goods g on g.id=c.goods_id and g.merch_sn=c.merch_sn
- left join third_merchant_biz mb2 on mb2.third_party_merch_code=g.third_party_merch_code and mb2.merch_sn=g.merch_sn
- LEFT JOIN mall_store s ON s.id = c.store_id
- left join third_merchant_biz mb on mb.third_party_merch_code=s.third_party_merch_code and mb.merch_sn=s.merch_sn
- WHERE
- ( f.out_refund_no IS NULL OR f.refund_id IS NULL OR f.refund_time IS NULL OR f.wechat_refund_status_des IS NULL )
- AND a.order_status = '401'
- AND f.refund_status IN ( 2, 5 )
- </select>
- <select id="queryPayingOrderList" resultType="map">
- SELECT
- a.pay_transaction_id,
- a.order_sn,
- a.order_status,
- a.pay_status,
- a.id 'orderId',
- a.merch_order_sn,
- date_format( a.add_time, '%Y-%m-%d %H:%i:%s' ) AS add_time,
- b.product_id,
- b.number,
- c.stock_num,
- c.id AS storeRelaId,
- a.pay_flag,
- g.goods_number,
- g.id goods_id,
- g.goods_biz_type,
- a.store_id,
- g.merch_sn,
- mb.third_party_merch_code,
- g.sell_volume 'goods_sell_volume',
- c.sell_volume 'store_sell_volume',
- mb.is_stock_share 'isStockShare',
- mb.third_party_merch_code,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler'
- FROM
- mall_order a
- LEFT JOIN mall_order_goods b ON a.id = b.order_id
- LEFT JOIN mall_product_store_rela c ON b.goods_id = c.goods_id
- AND c.store_id = a.store_id
- LEFT JOIN mall_goods g ON g.id = c.goods_id
- AND g.merch_sn = c.merch_sn
- LEFT JOIN third_merchant_biz mb2 ON mb2.third_party_merch_code = g.third_party_merch_code
- AND mb2.merch_sn = g.merch_sn
- LEFT JOIN mall_store s ON s.id = c.store_id
- LEFT JOIN third_merchant_biz mb ON mb.third_party_merch_code = s.third_party_merch_code
- AND mb.merch_sn = s.merch_sn
- WHERE
- ( a.order_status IN ( '0', '100', '201' ) AND a.pay_status IN ( 0, 1, 2 ) )
- AND pay_id IS NOT NULL
- AND ( a.pay_transaction_id = '' OR a.pay_transaction_id IS NULL OR a.pay_time IS NULL OR a.pay_time = '' )
- AND a.is_onffline_order = 0
- AND a.pay_flag = 'weixin'
- </select>
- <select id="queryPinganPayingOrderList" resultType="map">
- SELECT
- a.pay_transaction_id,
- a.order_sn,
- a.order_status,
- a.pay_status,
- a.id 'orderId',
- a.merch_order_sn,
- date_format( a.add_time, '%Y-%m-%d %H:%i:%s' ) AS add_time,
- b.product_id,
- b.number,
- c.stock_num,
- c.id AS storeRelaId,
- a.pay_flag,
- g.goods_number,
- g.id goods_id,
- g.goods_biz_type,
- a.store_id,
- g.merch_sn,
- mb.third_party_merch_code,
- g.sell_volume 'goods_sell_volume',
- c.sell_volume 'store_sell_volume',
- mb.is_stock_share 'isStockShare',
- mb.third_party_merch_code,
- mb.is_supplier_goods 'isSupplierGoods',
- mb2.third_party_merch_code 'supplierThirdMerchCode',
- mb2.is_stock_share 'isStockShareBySuppler'
- FROM
- mall_order a
- LEFT JOIN mall_order_goods b ON a.id = b.order_id
- LEFT JOIN mall_product_store_rela c ON b.goods_id = c.goods_id
- AND c.store_id = a.store_id
- LEFT JOIN mall_goods g ON g.id = c.goods_id
- AND g.merch_sn = c.merch_sn
- LEFT JOIN third_merchant_biz mb2 ON mb2.third_party_merch_code = g.third_party_merch_code
- AND mb2.merch_sn = g.merch_sn
- LEFT JOIN mall_store s ON s.id = c.store_id
- LEFT JOIN third_merchant_biz mb ON mb.third_party_merch_code = s.third_party_merch_code
- AND mb.merch_sn = s.merch_sn
- WHERE
- ( a.order_status IN ( '0', '100', '201' ) AND a.pay_status IN ( 0, 1, 2 ) )
- AND pay_id IS NOT NULL
- AND ( a.pay_transaction_id = '' OR a.pay_transaction_id IS NULL OR a.pay_time IS NULL OR a.pay_time = '' )
- AND a.is_onffline_order = 0
- AND a.pay_flag = 'pingan'
- </select>
- <update id="updateOrderInfo" parameterType="map">
- UPDATE mall_order a
- <set>
- <if test="orderStatus != null">a.order_status = #{orderStatus},</if>
- <if test="payStatus != null">a.pay_status = #{payStatus},</if>
- <if test="payFlag != null">a.pay_flag = #{payFlag},</if>
- <if test="orderSnWx != null">a.order_sn_wx = #{orderSnWx},</if>
- <if test="payTransactionId != null">a.pay_transaction_id = #{payTransactionId},</if>
- <if test="payTime != null">a.pay_time = #{payTime},</if>
- <if test="totalFee != null">a.total_fee = #{totalFee},</if>
- <if test="feeType != null">a.fee_type = #{feeType},</if>
- <if test="cashFee != null">a.cash_fee = #{cashFee},</if>
- <if test="cashFeeType != null">a.cash_fee_type = #{cashFeeType},</if>
- <if test="rate != null">a.rate = #{rate},</if>
- </set>
- WHERE 1 = 1
- AND a.id = #{orderId}
- </update>
- <update id="updateOrderProcessRecord" parameterType="map">
- UPDATE mall_order_process_record a
- <set>
- <if test="payTime != null">a.pay_succ_time = #{payTime}</if>
- </set>
- WHERE 1 = 1
- AND a.order_sn = #{orderSn}
- </update>
- <update id="updateOrderRefund" parameterType="map">
- UPDATE mall_order_refund a
- <set>
- <if test="refundId != null">a.refund_id = #{refundId},</if>
- <if test="refundMoney != null">a.refund_money = #{refundMoney},</if>
- <if test="refundStatus != null">a.refund_status = #{refundStatus},</if>
- <if test="refundRecvAccout != null">a.refund_recv_accout = #{refundRecvAccout},</if>
- <if test="refundTime != null">a.refund_time = #{refundTime},</if>
- <if test="wechat_refund_status_des != null">a.wechat_refund_status_des = #{wechat_refund_status_des},</if>
- <if test="totalFee != null">a.total_fee = #{totalFee},</if>
- <if test="feeType != null">a.fee_type = #{feeType},</if>
- <if test="cashFee != null">a.cash_fee = #{cashFee},</if>
- <if test="cashFeeType != null">a.cash_fee_type = #{cashFeeType},</if>
- <if test="rate != null">a.rate = #{rate},</if>
- </set>
- WHERE 1 = 1
- AND a.out_refund_no = #{orderRefundId}
- </update>
- <select id="queryShipmentOrderList" resultType="map">
- SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.customs_succ_time,'%Y-%m-%d %H:%i:%s') as customs_succ_time
- FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300'
- and shipping_status ='1' and a.order_biz_type in(10,02) AND r.customs_succ_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -7 DAY) AND a.is_onffline_order = 0
- </select>
- <select id="queryShipmentBondedOrderList" resultType="map">
- SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.shipment_start_time,'%Y-%m-%d %H:%i:%s') as shipment_start_time
- FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300' and shipping_status ='1'
- and a.order_biz_type in(00,11) AND r.shipment_start_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -7 DAY) AND a.is_onffline_order = 0
- </select>
- <update id="updateShipmentOrder" parameterType="map">
- update mall_order set order_status ='301', shipping_status='2',confirm_time=now() where id=#{orderId}
- </update>
- <select id="queryReceiptOrderList" resultType="map">
- select o.user_id 'userId',o.id 'orderId',g.product_id'productId',g.goods_specification_name_value 'goodsSpecificationNameValue', g.goods_id 'goodsId',
- g.goods_name 'goodsName',confirm_time FROM `mall_order` o inner join mall_order_goods g on o.id = g.order_id
- where order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY) AND o.is_onffline_order = 0
- </select>
- <update id="updateReceiptOrderByCommentCount">
- update mall_order set comment_count = 1 where
- order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY)
- </update>
- <insert id="insertComment" parameterType="map">
- insert into mall_comment(
- `type_id`,
- `value_id`,
- `user_id`,
- `order_id`,
- `product_id`,
- `goods_specification_name_value`,
- `status`,
- `content`,
- `eval_level`,
- `value_name`,
- `goods_level`,
- `create_time`,
- add_time,
- `mod_time`)
- values(
- #{typeId},
- #{valueId},
- #{userId},
- #{orderId},
- #{productId},
- #{goodsSpecificationNameValue},
- #{status},
- #{content},
- #{evalLevel},
- #{valueName},
- #{goodsLevel},
- #{createTime},
- #{addTime},
- #{modTime})
- </insert>
- <insert id="insertPinganResponseDto" parameterType="map">
- insert into pingan_response(
- `id`,
- `out_no`,
- `req_interface`,
- `errcode`,
- `msg`,
- `data`,
- `sign`,
- `datajson`,
- `timestamp`,
- `create_time`,
- `tstm`)
- values(
- #{id},
- #{outNo},
- #{reqInterface},
- #{errcode},
- #{msg},
- #{data},
- #{sign},
- #{datajson},
- #{timestamp},
- #{createTime},
- #{tstm})
- </insert>
- <select id="queryOrder" resultType="map">
- select id,order_status
- from mall_order
- WHERE order_sn = #{orderSn}
- </select>
- <select id="queryWXPaySuccessRecords" resultType="map">
- select id,out_trade_no_wx
- from mall_order_wxpay_record
- WHERE out_trade_no = #{orderSn} AND trade_state='SUCCESS'
- </select>
- <update id="updatePayOrderByOutNo" parameterType="map">
- update pingan_pay_order
- <set>
- <if test="pmtName != null">`pmt_name` = #{pmtName}, </if>
- <if test="pmtTag != null">`pmt_tag` = #{pmtTag}, </if>
- <if test="ordMctId != null">`ord_mct_id` = #{ordMctId}, </if>
- <if test="ordShopId != null">`ord_currency` = #{ordShopId}, </if>
- <if test="ordCurrency != null">`ord_shop_id` = #{ordCurrency}, </if>
- <if test="currencySign != null">`currency_sign` = #{currencySign}, </if>
- <if test="ordNo != null">`ord_no` = #{ordNo}, </if>
- <if test="ordType != null">`ord_type` = #{ordType}, </if>
- <if test="originalAmount != null">`original_amount` = #{originalAmount}, </if>
- <if test="discountAmount != null">`discount_amount` = #{discountAmount}, </if>
- <if test="ignoreAmount != null">`ignore_amount` = #{ignoreAmount}, </if>
- <if test="tradeAccount != null">`trade_account` = #{tradeAccount}, </if>
- <if test="tradeNo != null">`trade_no` = #{tradeNo}, </if>
- <if test="tradeAmount != null">`trade_amount` = #{tradeAmount}, </if>
- <if test="tradeQrcode != null">`trade_qrcode` = #{tradeQrcode}, </if>
- <if test="amount != null">`amount` = #{amount}, </if>
- <if test="tradeTime != null">`trade_time` = #{tradeTime}, </if>
- <if test="tradePayTime != null">`trade_pay_time` = #{tradePayTime}, </if>
- <if test="payTime != null">`pay_time` = #{payTime}, </if>
- <if test="status != null">`status` = #{status}, </if>
- <if test="tradeResult != null">`trade_result` = #{tradeResult}, </if>
- <if test="jsapiPayUrl != null">`jsapi_pay_url` = #{jsapiPayUrl}, </if>
- <if test="randStr != null">`rand_str` = #{randStr}, </if>
- <if test="appid != null">`appId` = #{appid}, </if>
- <if test="noncestr != null">`nonceStr` = #{noncestr}, </if>
- <if test="signtype != null">`signType` = #{signtype}, </if>
- <if test="prepayId != null">`prepay_id` = #{prepayId}, </if>
- <if test="paysign != null">`paySign` = #{paysign}, </if>
- <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
- <if test="createTime != null">`create_time` = #{createTime}, </if>
- <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
- <if test="modTime != null">`mod_time` = #{modTime}, </if>
- <if test="tstm != null">`tstm` = #{tstm}</if>
- </set>
- where `out_no` = #{outNo}
- </update>
- <select id="queryReceiptOrderByDistList" resultType="map">
- SELECT
- o.user_id 'userId',
- o.id 'orderId',
- o.order_sn 'orderSn',
- g.goods_id 'goodsId',
- g.goods_name 'goodsName',
- o.store_id,
- g.retail_price 'goodsPrice' ,
- a.third_merch_sn 'thirdMerchSn',
- a.supplier_id 'supplierId',
- a.dist_id 'distId',
- a.dist_flag 'distFlag',
- a.dist_chnl_id 'distChnlId',
- a.alloc_type 'allocType',
- a.expend_dist_ids 'expendDistIds',
- a.expend_dist_lines 'expendDistLines',
- g.is_dist_sell_scan 'isDistSellScan',
- g.id 'orderGoodsId',
- o.store_id 'storeId',
- a.sell_alloc_history_id sell_alloc_history_id
- FROM
- `mall_order` o
- left JOIN mall_order_goods g ON o.id = g.order_id
- inner join mk_dist_sell_allocation sa on g.goods_id = sa.goods_id and o.store_id = sa.store_id
- inner join mk_dist_sell_allocation_history a on a.sell_alloc_history_id = sa.sell_alloc_history_id
- WHERE
- order_status = '301'
- AND shipping_status = '2'
- AND o.is_onffline_order = 0 AND g.is_dist_sell_scan = 0 order by sell_alloc_history_id
- </select>
- <select id="queryThirdMerchantBySn" resultType="map">
- select s.is_dist_sell_start from third_merchant_biz s where s.third_merch_sn = #{thirdMerchSn}
- </select>
- <select id="queryMkDistHierById" resultType="map" parameterType="map">
- select s.dist_id 'distId',s.dist_hier_name 'distHierName',s.hier_lvl 'hierLvl' from mk_dist_hier s
- where s.dist_id = #{distId} and s.dist_chnl_id = #{distChnlId}
- </select>
- <update id="updateOrderGoodsIsScan" parameterType="map">
- update mall_order_goods set is_dist_sell_scan = #{isDistSellScan} where id=#{orderGoodsId}
- </update>
- <select id="queryUserCouponByOrderId" resultType="map">
- select id 'couponId' from mall_user_coupon where order_id = #{orderId}
- </select>
- <update id="cancelUserCouponOrder" parameterType="map">
- update mall_user_coupon
- <set>
- `used_time` = null,
- `order_id` = 0,
- is_used= 0
- </set>
- where id = #{id}
- </update>
- <select id="queryUserCampByOrderId" resultType="map">
- select user_camp_id 'userCampId' from mall_user_camp_minus where order_id = #{orderId}
- </select>
- <update id="cancelUserCampOrder" parameterType="map">
- update mall_user_camp_minus
- <set>
- `used_time` = null,
- `order_id` = 0,
- is_used = 0
- </set>
- where user_camp_id = #{userCampId}
- </update>
- <select id="queryOrderIdByOrderGoodsList" resultType="map">
- SELECT
- order_id,p.id 'storeRelaId'
- FROM
- mall_order_goods g
- LEFT JOIN mall_order o ON o.id = g.order_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- LEFT JOIN mall_product_store_rela p ON p.store_id = o.store_id
- AND p.goods_id = gs.id where o.pay_status = 2
- AND is_onffline_order = 0
- </select>
- <select id="queryOrderCountByIdAndPayStatus" resultType="map">
- SELECT
- count(g.number) 'sellVolume'
- FROM
- mall_order_goods g
- LEFT JOIN mall_order o ON o.id = g.order_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- LEFT JOIN mall_product_store_rela p ON p.store_id = o.store_id
- AND p.goods_id = gs.id where o.pay_status = 2
- AND is_onffline_order = 0 and p.id= #{storeRelaId}
- </select>
- <select id="queryGoodsListByIsShareStock" resultType="map">
- SELECT g.id 'goodsId',g.goods_number 'goodsNumber',g.merch_sn 'merchSn' FROM mall_goods g where g.is_goods_share_stock = 0
- </select>
- <select id="queryStoreRelaListByGoodsId" resultType="map">
- SELECT p.id 'storeRelaId',p.stock_num 'stockNum',p.store_id 'storeId' FROM mall_product_store_rela p where p.goods_id = #{goodsId}
- </select>
- <update id="updateByGoodsShareStock" parameterType="map">
- update mall_goods
- <set>
- is_goods_share_stock = #{isGoodsShareStock}
- </set>
- where id = #{goodsId}
- </update>
- </mapper>
|