| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269 |
- <?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.fs.live.mapper.LiveOrderMapper">
- <resultMap type="LiveOrder" id="LiveOrderResult">
- <result property="orderId" column="order_id" />
- <result property="liveId" column="live_id" />
- <result property="storeId" column="store_id" />
- <result property="orderCode" column="order_code" />
- <result property="userId" column="user_id" />
- <result property="userName" column="user_name" />
- <result property="userPhone" column="user_phone" />
- <result property="userAddress" column="user_address" />
- <result property="cartId" column="cart_id" />
- <result property="totalNum" column="total_num" />
- <result property="totalPrice" column="total_price" />
- <result property="payPrice" column="pay_price" />
- <result property="payMoney" column="pay_money" />
- <result property="isPay" column="is_pay" />
- <result property="payTime" column="pay_time" />
- <result property="payType" column="pay_type" />
- <result property="createTime" column="create_time" />
- <result property="updateTime" column="update_time" />
- <result property="status" column="status" />
- <result property="refundStatus" column="refund_status" />
- <result property="refundImg" column="refund_img" />
- <result property="refundExplain" column="refund_explain" />
- <result property="refundTime" column="refund_time" />
- <result property="refundReason" column="refund_reason" />
- <result property="refundMoney" column="refund_money" />
- <result property="deliveryCode" column="delivery_code" />
- <result property="deliveryName" column="delivery_name" />
- <result property="deliverySn" column="delivery_sn" />
- <result property="remark" column="remark" />
- <result property="isDel" column="is_del" />
- <result property="costPrice" column="cost_price" />
- <result property="verifyCode" column="verify_code" />
- <result property="shippingType" column="shipping_type" />
- <result property="isChannel" column="is_channel" />
- <result property="finishTime" column="finish_time" />
- <result property="deliveryTime" column="delivery_time" />
- <result property="tuiMoney" column="tui_money" />
- <result property="tuiMoneyStatus" column="tui_money_status" />
- <result property="tuiUserId" column="tui_user_id" />
- <result property="itemJson" column="item_json" />
- <result property="discountMoney" column="discount_money" />
- <result property="userCouponId" column="user_coupon_id" />
- <result property="companyId" column="company_id" />
- <result property="companyUserId" column="company_user_id" />
- <result property="storeHouseCode" column="store_house_code" />
- <result property="extendOrderId" column="extend_order_id" />
- <result property="payDelivery" column="pay_delivery" />
- <result property="payRemain" column="pay_remain" />
- <result property="deliveryStatus" column="delivery_status" />
- <result property="deliveryPayStatus" column="delivery_pay_status" />
- <result property="deliveryPayTime" column="delivery_pay_time" />
- <result property="deliveryType" column="delivery_type" />
- <result property="deliveryPayMoney" column="delivery_pay_money" />
- <result property="deliveryImportTime" column="delivery_import_time" />
- <result property="deliverySendTime" column="delivery_send_time" />
- <result property="isAfterSales" column="is_after_sales" />
- <result property="deptId" column="dept_id" />
- <result property="channel" column="channel" />
- <result property="source" column="source" />
- <result property="billPrice" column="bill_price" />
- <result property="totalPostage" column="total_postage" />
- <result property="payPostage" column="pay_postage" />
- <result property="gainIntegral" column="gain_integral" />
- <result property="useIntegral" column="use_integral" />
- <result property="payIntegral" column="pay_integral" />
- <result property="backIntegral" column="back_integral" />
- <result property="isEditMoney" column="is_edit_money" />
- <result property="orderName" column="order_name" />
- <result property="productIntroduce" column="product_introduce" />
- <result property="companyUserName" column="company_user_name" />
- <result property="companyName" column="company_name" />
- <result property="customerId" column="customer_id" />
- <result property="couponPrice" column="coupon_price" />
- </resultMap>
- <sql id="selectLiveOrderVo">
- SELECT
- a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
- a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
- a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
- a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
- a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
- a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
- a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,
- a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
- a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
- a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,a.coupon_price,
- a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id
- FROM
- live_order a LEFT JOIN fs_store_product_scrm b ON a.product_id = b.product_id
- </sql>
- <select id="selectLiveOrderList" parameterType="com.fs.live.domain.LiveOrder" resultMap="LiveOrderResult">
- SELECT
- c.company_name,cu.user_name as company_user_name,a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
- a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
- a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
- a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
- a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
- a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
- a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,
- a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
- a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
- a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,a.coupon_price,
- a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id
- FROM
- live_order a LEFT JOIN fs_store_product_scrm b ON a.product_id = b.product_id
- left join company_user cu on a.company_user_id = cu.user_id
- left join company c on a.company_id = c.company_id
- <where>
- <if test="finishTimeStart != null and finishTimeEnd != null">and finish_time between #{finishTimeStart} and #{finishTimeEnd}</if>
- <if test="payStartTime != null and payEndTime != null">and pay_time between #{payStartTime} and #{payEndTime}</if>
- <if test="liveId != null "> and live_id = #{liveId}</if>
- <if test="storeId != null "> and store_id = #{storeId}</if>
- <if test="orderCode != null and orderCode != ''"> and a.order_code = #{orderCode}</if>
- <if test="userId != null and userId != ''"> and a.user_id = #{userId}</if>
- <if test="realName != null and realName != ''"> and a.user_name like concat('%', #{realName}, '%')</if>
- <if test="userPhone != null and userPhone != ''"> and a.user_phone = #{userPhone}</if>
- <if test="userAddress != null and userAddress != ''"> and a.user_address = #{userAddress}</if>
- <if test="cartId != null and cartId != ''"> and cart_id = #{cartId}</if>
- <if test="totalNum != null and totalNum != ''"> and total_num = #{totalNum}</if>
- <if test="totalPrice != null "> and total_price = #{totalPrice}</if>
- <if test="payPrice != null "> and a.pay_price = #{payPrice}</if>
- <if test="payMoney != null "> and a.pay_money = #{payMoney}</if>
- <if test="isPay != null and isPay != ''"> and a.is_pay = #{isPay}</if>
- <if test="payTime != null "> and pay_time = #{payTime}</if>
- <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
- <if test="status != null "> and a.status = #{status}</if>
- <if test="refundStatus != null and refundStatus != ''"> and refund_status = #{refundStatus}</if>
- <if test="refundImg != null and refundImg != ''"> and refund_img = #{refundImg}</if>
- <if test="refundExplain != null and refundExplain != ''"> and refund_explain = #{refundExplain}</if>
- <if test="refundTime != null "> and refund_time = #{refundTime}</if>
- <if test="refundReason != null and refundReason != ''"> and refund_reason = #{refundReason}</if>
- <if test="refundMoney != null "> and refund_money = #{refundMoney}</if>
- <if test="deliveryCode != null and deliveryCode != ''"> and a.delivery_code = #{deliveryCode}</if>
- <if test="deliveryName != null and deliveryName != ''"> and a.delivery_name like concat('%', #{deliveryName}, '%')</if>
- <if test="deliverySn != null and deliverySn != ''"> and a.delivery_sn = #{deliverySn}</if>
- <if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
- <if test="costPrice != null "> and cost_price = #{costPrice}</if>
- <if test="verifyCode != null and verifyCode != ''"> and verify_code = #{verifyCode}</if>
- <if test="shippingType != null "> and shipping_type = #{shippingType}</if>
- <if test="isChannel != null and isChannel != ''"> and is_channel = #{isChannel}</if>
- <if test="finishTime != null ">and a.finish_time >= #{finishTime} and a.finish_time < date_add(#{finishTime}, interval 1 day)</if>
- <if test="deliveryTime != null and deliveryTime != ''"> and a.delivery_time = #{deliveryTime}</if>
- <if test="tuiMoney != null "> and tui_money = #{tuiMoney}</if>
- <if test="tuiMoneyStatus != null "> and tui_money_status = #{tuiMoneyStatus}</if>
- <if test="tuiUserId != null "> and tui_user_id = #{tuiUserId}</if>
- <if test="itemJson != null and itemJson != ''"> and item_json = #{itemJson}</if>
- <if test="discountMoney != null "> and discount_money = #{discountMoney}</if>
- <if test="userCouponId != null "> and user_coupon_id = #{userCouponId}</if>
- <if test="companyId != null "> and a.company_id = #{companyId}</if>
- <if test="companyUserId != null "> and a.company_user_id = #{companyUserId}</if>
- <if test="storeHouseCode != null and storeHouseCode != ''"> and store_house_code = #{storeHouseCode}</if>
- <if test="extendOrderId != null and extendOrderId != ''"> and extend_order_id = #{extendOrderId}</if>
- <if test="payDelivery != null "> and pay_delivery = #{payDelivery}</if>
- <if test="payRemain != null "> and pay_remain = #{payRemain}</if>
- <if test="deliveryStatus != null "> and delivery_status = #{deliveryStatus}</if>
- <if test="deliveryPayStatus != null "> and delivery_pay_status = #{deliveryPayStatus}</if>
- <if test="deliveryPayTime != null and deliveryPayTime != ''"> and delivery_pay_time = #{deliveryPayTime}</if>
- <if test="deliveryType != null and deliveryType != ''"> and delivery_type = #{deliveryType}</if>
- <if test="deliveryPayMoney != null "> and delivery_pay_money = #{deliveryPayMoney}</if>
- <if test="deliveryImportTime != null "> and delivery_import_time = #{deliveryImportTime}</if>
- <if test="deliverySendTime != null "> and delivery_send_time = #{deliverySendTime}</if>
- <if test="isAfterSales != null "> and is_after_sales = #{isAfterSales}</if>
- <if test="deptId != null "> and cu.dept_id = #{deptId}</if>
- <if test="channel != null and channel != ''"> and channel = #{channel}</if>
- <if test="source != null "> and source = #{source}</if>
- <if test="billPrice != null "> and bill_price = #{billPrice}</if>
- <if test="totalPostage != null "> and total_postage = #{totalPostage}</if>
- <if test="payPostage != null "> and pay_postage = #{payPostage}</if>
- <if test="gainIntegral != null "> and gain_integral = #{gainIntegral}</if>
- <if test="useIntegral != null "> and use_integral = #{useIntegral}</if>
- <if test="payIntegral != null "> and pay_integral = #{payIntegral}</if>
- <if test="backIntegral != null "> and back_integral = #{backIntegral}</if>
- <if test="isEditMoney != null "> and is_edit_money = #{isEditMoney}</if>
- <if test="orderName != null "> and order_name = #{orderName}</if>
- </where>
- order by a.create_time desc
- </select>
- <select id="selectLiveOrderByOrderId" parameterType="String" resultMap="LiveOrderResult">
- SELECT
- c.company_name,cu.user_name as company_user_name,a.order_id,a.live_id, a.product_id, a.order_name, a.store_id, a.order_code, a.user_id, a.user_name,
- a.user_phone, a.user_address, a.cart_id, a.total_num, a.total_price, a.pay_price, a.pay_money, a.is_pay,
- a.pay_time, a.pay_type, a.create_time, a.update_time, a.STATUS, a.refund_status, a.refund_img, a.refund_explain,
- a.refund_time, a.refund_reason, a.refund_money, a.delivery_code, a.delivery_name, a.delivery_sn,
- a.remark, a.is_del, a.cost_price, a.verify_code, a.shipping_type, a.is_channel, a.finish_time,
- a.delivery_time, a.tui_money, a.tui_money_status, a.tui_user_id, a.item_json, a.discount_money,
- a.user_coupon_id, a.company_id, a.company_user_id, a.store_house_code, a.extend_order_id, a.pay_delivery,
- a.pay_remain, a.delivery_status, a.delivery_pay_status, a.delivery_pay_time, a.delivery_type,
- a.delivery_pay_money, a.delivery_import_time, a.delivery_send_time, a.is_after_sales, a.dept_id,
- a.channel, a.source, a.bill_price, a.total_postage, a.pay_postage, a.gain_integral,a.coupon_price,
- a.use_integral, a.pay_integral, a.back_integral, a.is_edit_money, b.product_info as product_introduce,a.customer_id
- FROM
- live_order a LEFT JOIN fs_store_product_scrm b ON a.product_id = b.product_id
- left join company_user cu on a.company_user_id = cu.user_id
- left join company c on a.company_id = c.company_id
- where a.order_id = #{orderId}
- order by a.create_time desc
- </select>
- <insert id="insertLiveOrder" parameterType="LiveOrder" useGeneratedKeys="true" keyProperty="orderId">
- insert into live_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="liveId != null">live_id,</if>
- <if test="storeId != null">store_id,</if>
- <if test="orderCode != null and orderCode != ''">order_code,</if>
- <if test="userId != null and userId != ''">user_id,</if>
- <if test="realName != null">real_name,</if>
- <if test="userName != null">user_name,</if>
- <if test="userPhone != null">user_phone,</if>
- <if test="userAddress != null">user_address,</if>
- <if test="cartId != null">cart_id,</if>
- <if test="totalNum != null and totalNum != ''">total_num,</if>
- <if test="totalPrice != null">total_price,</if>
- <if test="payPrice != null">pay_price,</if>
- <if test="payMoney != null">pay_money,</if>
- <if test="isPay != null">is_pay,</if>
- <if test="payTime != null">pay_time,</if>
- <if test="payType != null">pay_type,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="status != null">status,</if>
- <if test="refundStatus != null">refund_status,</if>
- <if test="refundImg != null">refund_img,</if>
- <if test="refundExplain != null">refund_explain,</if>
- <if test="refundTime != null">refund_time,</if>
- <if test="refundReason != null">refund_reason,</if>
- <if test="refundMoney != null">refund_money,</if>
- <if test="deliveryCode != null">delivery_code,</if>
- <if test="deliveryName != null">delivery_name,</if>
- <if test="deliverySn != null">delivery_sn,</if>
- <if test="remark != null">remark,</if>
- <if test="isDel != null">is_del,</if>
- <if test="costPrice != null">cost_price,</if>
- <if test="verifyCode != null">verify_code,</if>
- <if test="shippingType != null">shipping_type,</if>
- <if test="isChannel != null">is_channel,</if>
- <if test="finishTime != null">finish_time,</if>
- <if test="deliveryTime != null">delivery_time,</if>
- <if test="tuiMoney != null">tui_money,</if>
- <if test="tuiMoneyStatus != null">tui_money_status,</if>
- <if test="tuiUserId != null">tui_user_id,</if>
- <if test="itemJson != null">item_json,</if>
- <if test="discountMoney != null">discount_money,</if>
- <if test="userCouponId != null">user_coupon_id,</if>
- <if test="companyId != null">company_id,</if>
- <if test="companyUserId != null">company_user_id,</if>
- <if test="storeHouseCode != null">store_house_code,</if>
- <if test="extendOrderId != null">extend_order_id,</if>
- <if test="payDelivery != null">pay_delivery,</if>
- <if test="payRemain != null">pay_remain,</if>
- <if test="deliveryStatus != null">delivery_status,</if>
- <if test="deliveryPayStatus != null">delivery_pay_status,</if>
- <if test="deliveryPayTime != null">delivery_pay_time,</if>
- <if test="deliveryType != null">delivery_type,</if>
- <if test="deliveryPayMoney != null">delivery_pay_money,</if>
- <if test="deliveryImportTime != null">delivery_import_time,</if>
- <if test="deliverySendTime != null">delivery_send_time,</if>
- <if test="isAfterSales != null">is_after_sales,</if>
- <if test="deptId != null">dept_id,</if>
- <if test="channel != null">channel,</if>
- <if test="source != null">source,</if>
- <if test="billPrice != null">bill_price,</if>
- <if test="totalPostage != null">total_postage,</if>
- <if test="payPostage != null">pay_postage,</if>
- <if test="gainIntegral != null">gain_integral,</if>
- <if test="useIntegral != null">use_integral,</if>
- <if test="payIntegral != null">pay_integral,</if>
- <if test="backIntegral != null">back_integral,</if>
- <if test="isEditMoney != null">is_edit_money,</if>
- <if test="productId != null">product_id,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="couponPrice != null">coupon_price,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="liveId != null">#{liveId},</if>
- <if test="storeId != null">#{storeId},</if>
- <if test="orderCode != null and orderCode != ''">#{orderCode},</if>
- <if test="userId != null and userId != ''">#{userId},</if>
- <if test="realName != null">#{realName},</if>
- <if test="userName != null">#{userName},</if>
- <if test="userPhone != null">#{userPhone},</if>
- <if test="userAddress != null">#{userAddress},</if>
- <if test="cartId != null">#{cartId},</if>
- <if test="totalNum != null and totalNum != ''">#{totalNum},</if>
- <if test="totalPrice != null">#{totalPrice},</if>
- <if test="payPrice != null">#{payPrice},</if>
- <if test="payMoney != null">#{payMoney},</if>
- <if test="isPay != null">#{isPay},</if>
- <if test="payTime != null">#{payTime},</if>
- <if test="payType != null">#{payType},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="status != null">#{status},</if>
- <if test="refundStatus != null">#{refundStatus},</if>
- <if test="refundImg != null">#{refundImg},</if>
- <if test="refundExplain != null">#{refundExplain},</if>
- <if test="refundTime != null">#{refundTime},</if>
- <if test="refundReason != null">#{refundReason},</if>
- <if test="refundMoney != null">#{refundMoney},</if>
- <if test="deliveryCode != null">#{deliveryCode},</if>
- <if test="deliveryName != null">#{deliveryName},</if>
- <if test="deliverySn != null">#{deliverySn},</if>
- <if test="remark != null">#{remark},</if>
- <if test="isDel != null">#{isDel},</if>
- <if test="costPrice != null">#{costPrice},</if>
- <if test="verifyCode != null">#{verifyCode},</if>
- <if test="shippingType != null">#{shippingType},</if>
- <if test="isChannel != null">#{isChannel},</if>
- <if test="finishTime != null">#{finishTime},</if>
- <if test="deliveryTime != null">#{deliveryTime},</if>
- <if test="tuiMoney != null">#{tuiMoney},</if>
- <if test="tuiMoneyStatus != null">#{tuiMoneyStatus},</if>
- <if test="tuiUserId != null">#{tuiUserId},</if>
- <if test="itemJson != null">#{itemJson},</if>
- <if test="discountMoney != null">#{discountMoney},</if>
- <if test="userCouponId != null">#{userCouponId},</if>
- <if test="companyId != null">#{companyId},</if>
- <if test="companyUserId != null">#{companyUserId},</if>
- <if test="storeHouseCode != null">#{storeHouseCode},</if>
- <if test="extendOrderId != null">#{extendOrderId},</if>
- <if test="payDelivery != null">#{payDelivery},</if>
- <if test="payRemain != null">#{payRemain},</if>
- <if test="deliveryStatus != null">#{deliveryStatus},</if>
- <if test="deliveryPayStatus != null">#{deliveryPayStatus},</if>
- <if test="deliveryPayTime != null">#{deliveryPayTime},</if>
- <if test="deliveryType != null">#{deliveryType},</if>
- <if test="deliveryPayMoney != null">#{deliveryPayMoney},</if>
- <if test="deliveryImportTime != null">#{deliveryImportTime},</if>
- <if test="deliverySendTime != null">#{deliverySendTime},</if>
- <if test="isAfterSales != null">#{isAfterSales},</if>
- <if test="deptId != null">#{deptId},</if>
- <if test="channel != null">#{channel},</if>
- <if test="source != null">#{source},</if>
- <if test="billPrice != null">#{billPrice},</if>
- <if test="totalPostage != null">#{totalPostage},</if>
- <if test="payPostage != null">#{payPostage},</if>
- <if test="gainIntegral != null">#{gainIntegral},</if>
- <if test="useIntegral != null">#{useIntegral},</if>
- <if test="payIntegral != null">#{payIntegral},</if>
- <if test="backIntegral != null">#{backIntegral},</if>
- <if test="isEditMoney != null">#{isEditMoney},</if>
- <if test="productId != null">#{productId},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="couponPrice != null">#{couponPrice},</if>
- </trim>
- </insert>
- <update id="updateLiveOrder" parameterType="LiveOrder">
- update live_order
- <trim prefix="SET" suffixOverrides=",">
- <if test="liveId != null">live_id = #{liveId},</if>
- <if test="storeId != null">store_id = #{storeId},</if>
- <if test="orderCode != null and orderCode != ''">order_code = #{orderCode},</if>
- <if test="userId != null and userId != ''">user_id = #{userId},</if>
- <if test="realName != null">real_name = #{realName},</if>
- <if test="userName != null">user_name = #{userName},</if>
- <if test="userPhone != null">user_phone = #{userPhone},</if>
- <if test="userAddress != null">user_address = #{userAddress},</if>
- <if test="cartId != null">cart_id = #{cartId},</if>
- <if test="totalNum != null and totalNum != ''">total_num = #{totalNum},</if>
- <if test="totalPrice != null">total_price = #{totalPrice},</if>
- <if test="payPrice != null">pay_price = #{payPrice},</if>
- <if test="payMoney != null">pay_money = #{payMoney},</if>
- <if test="isPay != null">is_pay = #{isPay},</if>
- <if test="payTime != null">pay_time = #{payTime},</if>
- <if test="payType != null">pay_type = #{payType},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="status != null">status = #{status},</if>
- <if test="refundStatus != null">refund_status = #{refundStatus},</if>
- <if test="refundImg != null">refund_img = #{refundImg},</if>
- <if test="refundExplain != null">refund_explain = #{refundExplain},</if>
- <if test="refundTime != null">refund_time = #{refundTime},</if>
- <if test="refundReason != null">refund_reason = #{refundReason},</if>
- <if test="refundMoney != null">refund_money = #{refundMoney},</if>
- <if test="deliveryCode != null">delivery_code = #{deliveryCode},</if>
- <if test="deliveryName != null">delivery_name = #{deliveryName},</if>
- <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
- <if test="remark != null">remark = #{remark},</if>
- <if test="isDel != null">is_del = #{isDel},</if>
- <if test="costPrice != null">cost_price = #{costPrice},</if>
- <if test="verifyCode != null">verify_code = #{verifyCode},</if>
- <if test="shippingType != null">shipping_type = #{shippingType},</if>
- <if test="isChannel != null">is_channel = #{isChannel},</if>
- <if test="finishTime != null">finish_time = #{finishTime},</if>
- <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
- <if test="tuiMoney != null">tui_money = #{tuiMoney},</if>
- <if test="tuiMoneyStatus != null">tui_money_status = #{tuiMoneyStatus},</if>
- <if test="tuiUserId != null">tui_user_id = #{tuiUserId},</if>
- <if test="itemJson != null">item_json = #{itemJson},</if>
- <if test="discountMoney != null">discount_money = #{discountMoney},</if>
- <if test="userCouponId != null">user_coupon_id = #{userCouponId},</if>
- <if test="companyId != null">company_id = #{companyId},</if>
- <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
- <if test="storeHouseCode != null">store_house_code = #{storeHouseCode},</if>
- <if test="extendOrderId != null">extend_order_id = #{extendOrderId},</if>
- <if test="payDelivery != null">pay_delivery = #{payDelivery},</if>
- <if test="payRemain != null">pay_remain = #{payRemain},</if>
- <if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
- <if test="deliveryPayStatus != null">delivery_pay_status = #{deliveryPayStatus},</if>
- <if test="deliveryPayTime != null">delivery_pay_time = #{deliveryPayTime},</if>
- <if test="deliveryType != null">delivery_type = #{deliveryType},</if>
- <if test="deliveryPayMoney != null">delivery_pay_money = #{deliveryPayMoney},</if>
- <if test="deliveryImportTime != null">delivery_import_time = #{deliveryImportTime},</if>
- <if test="deliverySendTime != null">delivery_send_time = #{deliverySendTime},</if>
- <if test="isAfterSales != null">is_after_sales = #{isAfterSales},</if>
- <if test="deptId != null">dept_id = #{deptId},</if>
- <if test="channel != null">channel = #{channel},</if>
- <if test="source != null">source = #{source},</if>
- <if test="billPrice != null">bill_price = #{billPrice},</if>
- <if test="totalPostage != null">total_postage = #{totalPostage},</if>
- <if test="payPostage != null">pay_postage = #{payPostage},</if>
- <if test="gainIntegral != null">gain_integral = #{gainIntegral},</if>
- <if test="useIntegral != null">use_integral = #{useIntegral},</if>
- <if test="payIntegral != null">pay_integral = #{payIntegral},</if>
- <if test="backIntegral != null">back_integral = #{backIntegral},</if>
- <if test="isEditMoney != null">is_edit_money = #{isEditMoney},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="couponPrice != null">coupon_price = #{couponPrice},</if>
- </trim>
- where order_id = #{orderId}
- </update>
- <delete id="deleteLiveOrderByOrderId" parameterType="String">
- delete from live_order where order_id = #{orderId}
- </delete>
- <delete id="deleteLiveOrderByOrderIds" parameterType="String">
- delete from live_order where order_id in
- <foreach item="orderId" collection="array" open="(" separator="," close=")">
- #{orderId}
- </foreach>
- </delete>
- <select id="getLiveOrderTimeGranularity" parameterType="com.fs.live.vo.LiveOrderTimeVo" resultMap="LiveOrderResult">
- <include refid="selectLiveOrderVo"/>
- where 1=1
- <if test="timeOptions != 'all'">and a.create_time >= #{createTime}</if>
- <if test="liveId != null">and a.live_id = #{liveId}</if>
- order by a.create_time desc
- </select>
- <select id="selectFsOutDateOrder" resultType="com.fs.live.domain.LiveOrder">
- <![CDATA[
- SELECT *
- FROM live_order
- WHERE status = 1
- AND create_time < DATE_SUB(NOW(), INTERVAL 1800 MINUTE)
- ]]>
- </select>
- <update id="batchUpdateErpByOrderIds">
- UPDATE live_order
- SET erp_phone =
- <trim prefix="CASE order_id" suffix="END">
- <foreach collection="maps" item="map">
- WHEN #{map.orderId} THEN #{map.erpPhone}
- </foreach>
- </trim>
- WHERE order_id IN
- <foreach collection="maps" item="map" open="(" separator="," close=")">
- #{map.orderId}
- </foreach>
- </update>
- <select id="selectLiveOrderInId" resultType="com.fs.live.domain.LiveOrder">
- <include refid="selectLiveOrderVo"/>
- where order_id IN <foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="selectLiveOrderListVO" resultType="com.fs.live.vo.LiveOrderVO">
- select o.*,u.phone,u.register_code,u.register_date,u.source, c.company_name ,cu.nick_name as company_user_nick_name ,cu.phonenumber as company_usere_phonenumber
- , csc.name miniProgramName
- from live_order o
- left join fs_user u on o.user_id=u.user_id
- left join company c on c.company_id=o.company_id
- left join company_user cu on cu.user_id=o.company_user_id
- <if test="maps.erpAccount != null and maps.erpAccount != ''">
- LEFT JOIN live_order_df df on df.order_id=o.order_id
- </if>
- <if test = "maps.productName != null and maps.productName != '' ">
- left join live_order_item oi on o.order_id = oi.order_id
- left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
- </if>
- LEFT JOIN (
- SELECT
- sp.*,
- ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
- FROM live_order_payment sp
- WHERE sp.business_code IS NOT NULL
- ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
- <where>
- <if test="maps.coursePlaySourceConfigId != null">
- and csc.id = #{maps.coursePlaySourceConfigId}
- </if>
- <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
- and o.order_code in
- <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
- #{orderCode}
- </foreach>
- </if>
- <if test="maps.orderCode != null and maps.orderCode !=''">
- and o.order_code like CONCAT('%',#{maps.orderCode},'%')
- </if>
- <if test="maps.isPayRemain != null">
- and o.is_pay_remain =#{maps.isPayRemain}
- </if>
- <if test="maps.userId != null">
- and o.user_id =#{maps.userId}
- </if>
- <if test="maps.deliveryId != null and maps.deliveryId !=''">
- and o.delivery_id =#{maps.deliveryId}
- </if>
- <if test="maps.nickname != null and maps.nickname !=''">
- and u.nickname like CONCAT('%',#{maps.nickname},'%')
- </if>
- <if test="maps.realName != null and maps.realName !=''">
- and o.user_name like CONCAT('%',#{maps.realName},'%')
- </if>
- <if test="maps.userName != null and maps.userName !=''">
- and o.user_name like CONCAT('%',#{maps.userName},'%')
- </if>
- <if test="maps.phone != null and maps.phone !=''">
- and u.phone like CONCAT('%',#{maps.phone},'%')
- </if>
- <if test="maps.userPhone != null and maps.userPhone !=''">
- and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
- </if>
- <if test="maps.status != null and maps.status != 6">
- and o.status = #{maps.status}
- </if>
- <if test="maps.status == 6">
- and o.`status`= 1
- and (o.extend_order_id is null or o.extend_order_id like '')
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 0 ">
- and o.certificates is null
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 1 ">
- and o.certificates is not null
- </if>
- <if test="maps.deliveryStatus != null ">
- and o.delivery_status =#{maps.deliveryStatus}
- </if>
- <if test="maps.deliveryPayStatus != null ">
- and o.delivery_pay_status =#{maps.deliveryPayStatus}
- </if>
- <if test="maps.companyId != null ">
- and o.company_id =#{maps.companyId}
- </if>
- <if test="maps.isHealth != null and maps.isHealth != '' ">
- and o.company_id is null
- </if>
- <if test="maps.notHealth != null ">
- and o.company_id is not null
- </if>
- <if test="maps.companyUserId != null ">
- and o.company_user_id =#{maps.companyUserId}
- </if>
- <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
- and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
- </if>
- <if test="maps.productName != null and maps.productName != '' ">
- and fsp.product_name like concat('%', #{maps.productName}, '%')
- </if>
- <if test="maps.orderType != null ">
- and o.order_type =#{maps.orderType}
- </if>
- <if test="maps.payType != null ">
- and o.pay_type =#{maps.payType}
- </if>
- <if test="maps.scheduleId != null ">
- and o.schedule_id =#{maps.scheduleId}
- </if>
- <if test="maps.createTimeList != null ">
- AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
- AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliverySendTimeList != null ">
- AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.paidStatus != null ">
- and o.paid =#{maps.paidStatus}
- </if>
- <if test="maps.payTimeList != null ">
- AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
- AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliveryImportTimeList != null ">
- AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deptId != null ">
- AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
- </if>
- <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
- and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
- </if>
- <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
- and df.login_account like #{maps.erpAccount}
- </if>
- <if test="maps.erpAccount == '未分拣'">
- and ( df.login_account is null or df.login_account like '')
- </if>
- </where>
- ${maps.params.dataScope}
- <if test="maps.productName != null and maps.productName != '' ">
- group by o.order_id
- </if>
- order by
- <if test="maps.sortField == 'companyUserName'">
- cu.nick_name
- </if>
- <if test="maps.sortField == 'packageName'">
- o.package_name
- </if>
- <if test="maps.sortField == 'payPrice'">
- o.pay_price
- </if>
- <if test="maps.sortField == 'payMoney'">
- o.pay_money
- </if>
- <if test="maps.sortOrder != null and maps.sortOrder != ''">
- ${maps.sortOrder}
- </if>
- <if test="maps.sortField == null or maps.sortField == ''">
- o.order_id desc
- </if>
- </select>
- <select id="selectLiveOrderStatistics" resultType="java.util.Map">
- select sum(o.pay_price) pay_price,sum(o.pay_money) pay_money,sum(o.pay_delivery) pay_remain
- FROM live_order o
- left join fs_user u on o.user_id=u.user_id
- left join company c on c.company_id=o.company_id
- left join company_user cu on cu.user_id=o.company_user_id
- <if test="maps.erpAccount != null or maps.erpAccount != ''">
- LEFT JOIN live_order_df df on df.order_id=o.order_id
- </if>
- <if test = "maps.productName != null and maps.productName != '' ">
- left join live_order_item oi on o.order_id = oi.order_id
- left join fs_store_product_scrm fsp on fsp.product_id = oi.product_id
- </if>
- <if test="maps.coursePlaySourceConfigId != null">
- LEFT JOIN (
- SELECT
- sp.*,
- ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
- FROM live_order_payment sp
- WHERE sp.business_code IS NOT NULL
- ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
- </if>
- <where>
- <if test="maps.coursePlaySourceConfigId != null">
- and csc.id = #{maps.coursePlaySourceConfigId}
- </if>
- <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
- and o.order_code in
- <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
- #{orderCode}
- </foreach>
- </if>
- <if test="maps.orderCode != null and maps.orderCode !=''">
- and o.order_code like CONCAT('%',#{maps.orderCode},'%')
- </if>
- <if test="maps.isPayRemain != null">
- and o.is_pay_remain =#{maps.isPayRemain}
- </if>
- <if test="maps.userId != null">
- and o.user_id =#{maps.userId}
- </if>
- <if test="maps.deliveryId != null and maps.deliveryId !=''">
- and o.delivery_id =#{maps.deliveryId}
- </if>
- <if test="maps.nickname != null and maps.nickname !=''">
- and u.nickname like CONCAT('%',#{maps.nickname},'%')
- </if>
- <if test="maps.realName != null and maps.realName !=''">
- and o.user_name like CONCAT('%',#{maps.realName},'%')
- </if>
- <if test="maps.userName != null and maps.userName !=''">
- and o.user_name like CONCAT('%',#{maps.userName},'%')
- </if>
- <if test="maps.phone != null and maps.phone !=''">
- and u.phone like CONCAT('%',#{maps.phone},'%')
- </if>
- <if test="maps.userPhone != null and maps.userPhone !=''">
- and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
- </if>
- <if test="maps.status != null and maps.status != 6">
- and o.status = #{maps.status}
- </if>
- <if test="maps.status == 6">
- and o.`status`= 1
- and (o.extend_order_id is null or o.extend_order_id like '')
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 0 ">
- and o.certificates is null
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 1 ">
- and o.certificates is not null
- </if>
- <if test="maps.deliveryStatus != null ">
- and o.delivery_status =#{maps.deliveryStatus}
- </if>
- <if test="maps.deliveryPayStatus != null ">
- and o.delivery_pay_status =#{maps.deliveryPayStatus}
- </if>
- <if test="maps.companyId != null ">
- and o.company_id =#{maps.companyId}
- </if>
- <if test="maps.isHealth != null and maps.isHealth != '' ">
- and o.company_id is null
- </if>
- <if test="maps.notHealth != null ">
- and o.company_id is not null
- </if>
- <if test="maps.companyUserId != null ">
- and o.company_user_id =#{maps.companyUserId}
- </if>
- <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
- and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
- </if>
- <if test="maps.productName != null and maps.productName != '' ">
- and fsp.product_name like concat('%', #{maps.productName}, '%')
- </if>
- <if test="maps.orderType != null ">
- and o.order_type =#{maps.orderType}
- </if>
- <if test="maps.payType != null ">
- and o.pay_type =#{maps.payType}
- </if>
- <if test="maps.scheduleId != null ">
- and o.schedule_id =#{maps.scheduleId}
- </if>
- <if test="maps.createTimeList != null ">
- AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
- AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliverySendTimeList != null ">
- AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.paidStatus != null ">
- and o.paid =#{maps.paidStatus}
- </if>
- <if test="maps.payTimeList != null ">
- AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
- AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliveryImportTimeList != null ">
- AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deptId != null ">
- AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
- </if>
- <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
- and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
- </if>
- <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
- and df.login_account like #{maps.erpAccount}
- </if>
- <if test="maps.erpAccount == '未分拣'">
- and ( df.login_account is null or df.login_account like '')
- </if>
- </where>
- ${maps.params.dataScope}
- </select>
- <select id="selectLiveOrderProductStatistics" resultType="java.lang.String">
- SELECT GROUP_CONCAT(
- CONCAT(product_name, ':', product_num)
- ORDER BY product_name
- SEPARATOR ' '
- ) AS product_num_list
- FROM (
- SELECT sp.product_name,SUM(IF(soi.num IS NULL,0,soi.num)) product_num
- FROM fs_store_product_scrm sp
- INNER JOIN live_order_item soi ON soi.product_id = sp.product_id
- INNER JOIN live_order o ON soi.order_id = o.order_id
- LEFT JOIN fs_user us ON us.user_id=o.user_id
- LEFT JOIN company_user cu on cu.user_id=o.company_user_id
- LEFT JOIN live_order_df df on df.order_id=o.order_id
- <if test="maps.coursePlaySourceConfigId != null">
- LEFT JOIN (
- SELECT
- sp.*,
- ROW_NUMBER() OVER (PARTITION BY sp.business_code ORDER BY sp.create_time DESC) as rn
- FROM live_order_payment sp
- WHERE sp.business_code IS NOT NULL
- ) sp_latest ON sp_latest.business_code = o.order_code AND sp_latest.rn = 1
- LEFT JOIN fs_course_play_source_config csc ON csc.appid = sp_latest.app_id
- </if>
- <where>
- <if test="maps.coursePlaySourceConfigId != null">
- and csc.id = #{maps.coursePlaySourceConfigId}
- </if>
- <if test="maps.orderCodes != null and maps.orderCodes.size > 0">
- and o.order_code in
- <foreach collection="maps.orderCodes" item="orderCode" open="(" close=")" separator=",">
- #{orderCode}
- </foreach>
- </if>
- <if test="maps.orderCode != null and maps.orderCode !=''">
- and o.order_code like CONCAT('%',#{maps.orderCode},'%')
- </if>
- <if test="maps.isPayRemain != null">
- and o.is_pay_remain =#{maps.isPayRemain}
- </if>
- <if test="maps.userId != null">
- and o.user_id =#{maps.userId}
- </if>
- <if test="maps.deliveryId != null and maps.deliveryId !=''">
- and o.delivery_id =#{maps.deliveryId}
- </if>
- <if test="maps.nickname != null and maps.nickname !=''">
- and u.nickname like CONCAT('%',#{maps.nickname},'%')
- </if>
- <if test="maps.realName != null and maps.realName !=''">
- and o.user_name like CONCAT('%',#{maps.realName},'%')
- </if>
- <if test="maps.userName != null and maps.userName !=''">
- and o.user_name like CONCAT('%',#{maps.userName},'%')
- </if>
- <if test="maps.phone != null and maps.phone !=''">
- and u.phone like CONCAT('%',#{maps.phone},'%')
- </if>
- <if test="maps.userPhone != null and maps.userPhone !=''">
- and o.user_phone like CONCAT('%',#{maps.userPhone},'%')
- </if>
- <if test="maps.status != null and maps.status != 6">
- and o.status = #{maps.status}
- </if>
- <if test="maps.status == 6">
- and o.`status`= 1
- and (o.extend_order_id is null or o.extend_order_id like '')
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 0 ">
- and o.certificates is null
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 1 ">
- and o.certificates is not null
- </if>
- <if test="maps.deliveryStatus != null ">
- and o.delivery_status =#{maps.deliveryStatus}
- </if>
- <if test="maps.deliveryPayStatus != null ">
- and o.delivery_pay_status =#{maps.deliveryPayStatus}
- </if>
- <if test="maps.companyId != null ">
- and o.company_id =#{maps.companyId}
- </if>
- <if test="maps.isHealth != null and maps.isHealth != '' ">
- and o.company_id is null
- </if>
- <if test="maps.notHealth != null ">
- and o.company_id is not null
- </if>
- <if test="maps.companyUserId != null ">
- and o.company_user_id =#{maps.companyUserId}
- </if>
- <if test="maps.companyUserNickName != null and maps.companyUserNickName != '' ">
- and cu.nick_name like concat('%', #{maps.companyUserNickName}, '%')
- </if>
- <if test="maps.productName != null and maps.productName != '' ">
- and fsp.product_name like concat('%', #{maps.productName}, '%')
- </if>
- <if test="maps.orderType != null ">
- and o.order_type =#{maps.orderType}
- </if>
- <if test="maps.payType != null ">
- and o.pay_type =#{maps.payType}
- </if>
- <if test="maps.scheduleId != null ">
- and o.schedule_id =#{maps.scheduleId}
- </if>
- <if test="maps.createTimeList != null ">
- AND date_format(o.create_time,'%y%m%d') >= date_format(#{maps.createTimeList[0]},'%y%m%d')
- AND date_format(o.create_time,'%y%m%d') <= date_format(#{maps.createTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliverySendTimeList != null ">
- AND date_format(o.delivery_send_time,'%y%m%d') >= date_format(#{maps.deliverySendTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_send_time,'%y%m%d') <= date_format(#{maps.deliverySendTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.paidStatus != null ">
- and o.paid =#{maps.paidStatus}
- </if>
- <if test="maps.payTimeList != null ">
- AND date_format(o.pay_time,'%y%m%d') >= date_format(#{maps.payTimeList[0]},'%y%m%d')
- AND date_format(o.pay_time,'%y%m%d') <= date_format(#{maps.payTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deliveryImportTimeList != null ">
- AND date_format(o.delivery_import_time,'%y%m%d') >= date_format(#{maps.deliveryImportTimeList[0]},'%y%m%d')
- AND date_format(o.delivery_import_time,'%y%m%d') <= date_format(#{maps.deliveryImportTimeList[1]},'%y%m%d')
- </if>
- <if test="maps.deptId != null ">
- AND (o.dept_id = #{maps.deptId} OR o.dept_id IN ( SELECT t.dept_id FROM company_dept t WHERE find_in_set(#{maps.deptId}, ancestors) ))
- </if>
- <if test="maps.erpPhoneNumber != null and maps.erpPhoneNumber != ''">
- and o.erp_phone like concat(#{maps.erpPhoneNumber},'%')
- </if>
- <if test="maps.erpAccount != null and maps.erpAccount != '未分拣' and maps.erpAccount != ''">
- and df.login_account like #{maps.erpAccount}
- </if>
- <if test="maps.erpAccount == '未分拣'">
- and ( df.login_account is null or df.login_account like '')
- </if>
- </where>
- ${maps.params.dataScope} GROUP BY sp.product_id
- ) AS t
- </select>
- <!-- 查询订单列表Zm -->
- <select id="selectLiveOrderListZm" parameterType="LiveOrder" resultType="com.fs.live.vo.LiveOrderVoZm">
- SELECT
- o.order_id,
- o.live_id,
- o.store_id,
- o.order_code,
- o.user_id,
- o.user_name,
- o.user_phone,
- o.user_address,
- o.cart_id,
- o.total_num,
- o.total_price,
- o.pay_price,
- o.pay_money,
- o.is_pay,
- o.pay_time,
- o.pay_type,
- o.create_time,
- o.update_time,
- o.status,
- o.refund_status,
- o.refund_img,
- o.refund_explain,
- o.refund_time,
- o.refund_reason,
- o.refund_money,
- o.delivery_code,
- o.delivery_name,
- o.delivery_sn,
- o.remark,
- o.is_del,
- o.cost_price,
- o.company_id,
- o.company_user_id,
- o.product_id,
- o.customer_id,
- o.coupon_price,
- o.cancel_reason,
- <!-- 销售信息 -->
- cu.nick_name AS companyUserNickName,
- cu.phonenumber AS companyUserPhone,
- cu.create_time AS companyUserCreateTime,
- <!-- 客户信息 -->
- u.user_code AS userCode,
- u.level AS userLevel,
- u.nick_name AS nickName,
- u.phone AS userBindPhone,
- u.order_count AS totalOrderCount,
- u.total_amount AS totalOrderAmount,
- u.status AS userStatus,
- u.update_time AS latestBindTime,
- <!-- 商品信息 -->
- p.product_name AS productName,
- p.cost AS costPrice,
- p.price AS price,
- p.cost AS cost,
- p.prescribe_spec AS productSpec,
- p.prescribe_factory AS supplierName,
- <!-- 门店信息 -->
- s.store_name AS storeName,
- s.store_id AS storeId
- FROM
- live_order o
- LEFT JOIN fs_user u ON o.user_id = u.user_id
- LEFT JOIN company_user cu ON o.company_user_id = cu.user_id
- LEFT JOIN fs_store_product_scrm p ON o.product_id = p.product_id
- LEFT JOIN fs_store_scrm s ON p.store_id = s.store_id
- <where>
- o.is_del = 0
- <if test="orderId != null">
- AND o.order_id = #{orderId}
- </if>
- <if test="liveId != null">
- AND o.live_id = #{liveId}
- </if>
- <if test="storeId != null">
- AND o.store_id = #{storeId}
- </if>
- <if test="orderCode != null and orderCode != ''">
- AND o.order_code LIKE CONCAT('%', #{orderCode}, '%')
- </if>
- <if test="userId != null and userId != ''">
- AND o.user_id = #{userId}
- </if>
- <if test="status != null">
- AND o.status = #{status}
- </if>
- <if test="companyId != null">
- AND o.company_id = #{companyId}
- </if>
- <if test="totalNum != null">
- AND o.total_num = #{totalNum}
- </if>
- <if test="price != null">
- AND p.price = #{price}
- </if>
- <if test="cost != null">
- AND p.cost = #{cost}
- </if>
- <if test="companyUserId != null">
- AND o.company_user_id = #{companyUserId}
- </if>
- <if test="productId != null">
- AND o.product_id = #{productId}
- </if>
- <!-- 新增筛选条件 -->
- <if test="productName != null and productName != ''">
- AND p.product_name LIKE CONCAT('%', #{productName}, '%')
- </if>
- <if test="productSpec != null and productSpec != ''">
- AND p.prescribe_spec LIKE CONCAT('%', #{productSpec}, '%')
- </if>
- <if test="storeId != null and storeId != ''">
- AND p.store_id #{storeId}
- </if>
- <if test="userAddress != null and userAddress != ''">
- AND o.user_address LIKE CONCAT('%', #{userAddress}, '%')
- </if>
- <if test="createTimeStart != null and createTimeStart != ''">
- AND o.create_time >= #{createTimeStart}
- </if>
- <if test="createTimeEnd != null and createTimeEnd != ''">
- AND o.create_time <= #{createTimeEnd}
- </if>
- <if test="payStartTime != null and payStartTime != ''">
- AND o.pay_time >= #{payStartTime}
- </if>
- <if test="payEndTime != null and payEndTime != ''">
- AND o.pay_time <= #{payEndTime}
- </if>
- </where>
- ORDER BY o.create_time DESC
- </select>
- <select id="getUnsettledOrder" resultType="com.fs.live.domain.LiveOrder">
- SELECT
- sos.*,
- sps.bank_transaction_id
- FROM
- live_order sos
- INNER JOIN live_order_payment sps ON sos.id = sps.order_id
- WHERE
- sos.is_del = 0 and
- sos.is_pay = 1
- AND sps.business_type = 2
- AND sos.`status` = 2
- AND sps.`status`=1
- AND DATEDIFF(
- NOW(),
- sos.delivery_send_time
- ) >= 3
- </select>
- <select id="getDeliveryNote" resultType="com.fs.live.vo.LiveOrderDeliveryNoteExportVO">
- SELECT
- CONCAT('AC', o.id) AS orderNumber,
- o.user_name AS recipient,
- o.user_phone AS recipientPhone,
- o.user_address AS recipientAddress,
- GROUP_CONCAT(
- DISTINCT IFNULL(
- CASE WHEN LENGTH(sps.product_name) > 0
- THEN CONCAT(sps.product_name, '*', sois.num)
- END, ''
- )
- SEPARATOR '+'
- ) AS nameAndNumber,
- sps.keyword
- FROM
- live_order o
- LEFT JOIN live_order_item sois
- ON sois.order_id = o.order_id
- LEFT JOIN fs_store_product_scrm sps
- ON sps.product_id = sois.product_id
- LEFT JOIN fs_user u
- ON o.user_id = u.user_id
- LEFT JOIN company c
- ON c.company_id = o.company_id
- LEFT JOIN company_user cu
- ON cu.user_id = o.company_user_id
- LEFT JOIN (
- SELECT DISTINCT order_id
- FROM live_order_payment
- WHERE is_pay_remain != 0 AND STATUS != 0
- ) fp
- ON o.id = fp.order_id
- WHERE
- o.is_del = 0 and
- 1 = 1
- <if test="maps.orderCode != null and maps.orderCode != ''">
- AND o.order_code LIKE CONCAT('%', #{maps.orderCode}, '%')
- </if>
- <if test="maps.userId != null">
- AND o.user_id = #{maps.userId}
- </if>
- <if test="maps.deliveryId != null and maps.deliveryId != ''">
- AND o.delivery_id = #{maps.deliveryId}
- </if>
- <if test="maps.nickname != null and maps.nickname != ''">
- AND u.nickname LIKE CONCAT('%', #{maps.nickname}, '%')
- </if>
- <if test="maps.realName != null and maps.realName != ''">
- AND o.user_name LIKE CONCAT('%', #{maps.realName}, '%')
- </if>
- <if test="maps.phone != null and maps.phone != ''">
- AND u.phone LIKE CONCAT('%', #{maps.phone}, '%')
- </if>
- <if test="maps.userPhone != null and maps.userPhone != ''">
- AND o.user_phone LIKE CONCAT('%', #{maps.userPhone}, '%')
- </if>
- <if test="maps.status == null">
- AND o.status = 1
- </if>
- <if test="maps.status != null">
- AND o.status = #{maps.status}
- </if>
- <if test="maps.deliveryStatus != null">
- AND o.delivery_status = #{maps.deliveryStatus}
- </if>
- <if test="maps.deliveryPayStatus != null">
- AND o.delivery_pay_status = #{maps.deliveryPayStatus}
- </if>
- <if test="maps.companyId != null">
- AND o.company_id = #{maps.companyId}
- </if>
- <if test="maps.isHealth != null and maps.isHealth != ''">
- AND o.company_id IS NULL
- </if>
- <if test="maps.notHealth != null and maps.notHealth != ''">
- AND o.company_id IS NOT NULL
- </if>
- <if test="maps.companyUserId != null">
- AND o.company_user_id = #{maps.companyUserId}
- </if>
- <if test="maps.companyUserNickName != null and maps.companyUserNickName != ''">
- AND cu.nick_name LIKE CONCAT('%', #{maps.companyUserNickName}, '%')
- </if>
- <if test="maps.orderType != null">
- AND o.order_type = #{maps.orderType}
- </if>
- <if test="maps.payType != null">
- AND o.pay_type = #{maps.payType}
- </if>
- <if test="maps.createTimeList != null">
- AND o.create_time >= STR_TO_DATE(#{maps.createTimeList[0]}, '%Y%m%d')
- AND o.create_time < DATE_ADD(STR_TO_DATE(#{maps.createTimeList[1]}, '%Y%m%d'), INTERVAL 1 DAY)
- </if>
- <if test="maps.payTimeList != null">
- AND o.pay_time >= STR_TO_DATE(#{maps.payTimeList[0]}, '%Y%m%d')
- AND o.pay_time < DATE_ADD(STR_TO_DATE(#{maps.payTimeList[1]}, '%Y%m%d'), INTERVAL 1 DAY)
- </if>
- <if test="maps.deliverySendTimeList != null">
- AND o.delivery_send_time >= STR_TO_DATE(#{maps.deliverySendTimeList[0]}, '%Y%m%d')
- AND o.delivery_send_time < DATE_ADD(STR_TO_DATE(#{maps.deliverySendTimeList[1]}, '%Y%m%d'), INTERVAL 1 DAY)
- </if>
- <if test="maps.deliveryImportTimeList != null">
- AND o.delivery_import_time >= STR_TO_DATE(#{maps.deliveryImportTimeList[0]}, '%Y%m%d')
- AND o.delivery_import_time < DATE_ADD(STR_TO_DATE(#{maps.deliveryImportTimeList[1]}, '%Y%m%d'), INTERVAL 1 DAY)
- </if>
- <if test="maps.deptId != null">
- AND (o.dept_id = #{maps.deptId}
- OR o.dept_id IN (SELECT t.dept_id FROM company_dept t WHERE FIND_IN_SET(#{maps.deptId}, t.ancestors)))
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 0">
- AND o.certificates IS NULL
- </if>
- <if test="maps.scheduleId != null">
- AND o.schedule_id = #{maps.scheduleId}
- </if>
- <if test="maps.isUpload != null and maps.isUpload == 1">
- AND o.certificates IS NOT NULL
- </if>
- ${maps.params.dataScope}
- AND o.paid = 1
- GROUP BY o.id
- LIMIT 10000;
- </select>
- <select id="selectLiveOrderCodeOpenIdInOrderCode" resultType="com.fs.live.vo.LiveOrderCodeOpenIdVo">
- SELECT
- os.order_id as id,
- fu.phone,
- fu.ma_open_id openId,
- ois.json_info,
- lop.bank_transaction_id outTransId
- FROM
- live_order os
- INNER JOIN fs_user fu ON os.user_id = fu.user_id
- INNER JOIN live_order_item ois ON ois.order_id = os.order_id
- INNER JOIN live_order_payment lop ON os.order_id = lop.business_id
- WHERE os.is_del = 0 and os.order_code IN
- <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- AND lop.`status` = 1
- </select>
- <update id="batchUpdateInOrderCode">
- UPDATE live_order
- <set>
- delivery_sn = CASE
- <foreach collection="list" item="item">
- WHEN order_code = #{item.orderNumber} THEN #{item.deliverySn}
- </foreach>
- ELSE delivery_sn
- END,
- delivery_name = CASE
- <foreach collection="list" item="item">
- WHEN order_code = #{item.orderNumber} THEN #{item.logisticsCompany}
- </foreach>
- ELSE delivery_name
- END,
- delivery_id = CASE
- <foreach collection="list" item="item">
- WHEN order_code = #{item.orderNumber} THEN #{item.deliveryId}
- </foreach>
- ELSE delivery_id
- END,
- status = CASE
- WHEN status = 1 THEN 2
- ELSE status
- END,
- delivery_send_time = NOW()
- </set>
- WHERE order_code IN
- <foreach collection="list" item="item" open="(" separator="," close=")">
- #{item.orderNumber}
- </foreach>
- </update>
- </mapper>
|