| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061 |
- <?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="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="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="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.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.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.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>
- </mapper>
|