| New file |
| | |
| | | <?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.example.erp.mapper.sd.DeliveryMapper"> |
| | | |
| | | <resultMap id="selectOrderInventory" type="com.example.erp.entity.sd.Order"> |
| | | |
| | | <result column="create_order" property="createOrder"/> |
| | | <result column="process_review" property="processReview"/> |
| | | <result column="order_review" property="orderReview"/> |
| | | <result column="production_order" property="productionOrder"/> |
| | | <result column="processing_card" property="processingCard"/> |
| | | <result column="warehousing" property="warehousing"/> |
| | | <result column="delivery" property="delivery"/> |
| | | <result column="order_id" property="orderId"/> |
| | | <result column="customer_id" property="customerId"/> |
| | | <result column="customer_name" property="customerName"/> |
| | | <result column="quantity" property="quantity"/> |
| | | <result column="project" property="project"/> |
| | | <result column="batch" property="batch"/> |
| | | <result column="money" property="money"/> |
| | | <result column="area" property="area"/> |
| | | <result column="create_time" property="createTime"/> |
| | | <result column="pack_type" property="packType"/> |
| | | <result column="order_type" property="orderType"/> |
| | | <result column="creator" property="creator"/> |
| | | <result column="quantity_available" property="finishedGoodsInventory.quantityAvailable"/> |
| | | </resultMap> |
| | | |
| | | |
| | | <delete id="deleteDelivery"> |
| | | delete from sd.delivery where delivery_id=#{deliveryId} |
| | | </delete> |
| | | <update id="updateDeliveryToExamine"> |
| | | update sd.delivery set delivery_state=#{deliveryState} where delivery_id=#{deliveryId} |
| | | </update> |
| | | |
| | | <update id="updatedelivery"> |
| | | update sd.delivery set area=#{area},quantity=#{quantity},money=#{money},other_money=#{otherMoney} where delivery_id=#{oddNumber} |
| | | </update> |
| | | |
| | | |
| | | <select id="getmaximum" > |
| | | select count(*) from sd.delivery where date(create_time)=CURDATE() |
| | | </select> |
| | | |
| | | <select id="getDeliveryConut" > |
| | | select count(*) from sd.delivery where delivery_id=#{deliveryId} |
| | | </select> |
| | | |
| | | |
| | | <insert id="insertDelivery" useGeneratedKeys="true" > |
| | | insert into sd.delivery(delivery_state,stock_state,payment_terms,delivery_id,order_id,project,customer_id,customer_name, |
| | | delivery_date,pay_method,pay_date,salesman_id,salesman,creator_id,creator,contacts,contact_number,delivery_address, |
| | | area,quantity,money,remarks,create_time) |
| | | values ( |
| | | 0,0,#{delivery.paymentTerms},#{number} ,#{orderId},#{delivery.project},#{delivery.customerId},#{delivery.customerName},#{delivery.deliveryDate},#{delivery.payMethod}, |
| | | #{delivery.payDate},#{delivery.salesmanId},#{delivery.salesman},#{delivery.creatorId},#{delivery.creator},#{delivery.contacts},#{delivery.contactNumber},#{delivery.deliveryAddress}, |
| | | 0,0,0,#{delivery.remarks},now() |
| | | ) |
| | | </insert> |
| | | |
| | | <select id="getSelectOrderInventory" resultMap="selectOrderInventory"> |
| | | select o.create_order, |
| | | o.process_review, |
| | | o.order_review, |
| | | o.production_order, |
| | | o.processing_card, |
| | | o.warehousing, |
| | | o.delivery, |
| | | o.order_id, |
| | | o.customer_id, |
| | | o.customer_name, |
| | | o.quantity, |
| | | sum(fgi.quantity_available) as quantity_available, |
| | | o.project, |
| | | o.batch, |
| | | o.money, |
| | | o.area, |
| | | o.create_time, |
| | | o.pack_type, |
| | | o.order_type, |
| | | o.creator |
| | | from sd.`order` o |
| | | left join mm.finished_goods_inventory fgi on o.order_id = fgi.order_id |
| | | <where> |
| | | fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate} |
| | | <if test="order.orderId != null and order.orderId != ''"> |
| | | and o.order_id REGEXP #{order.orderId} |
| | | </if> |
| | | <if test="order.customerId != null and order.customerId != ''"> |
| | | and o.customer_id REGEXP #{order.customerId} |
| | | </if> |
| | | <if test="order.customerName != null and order.customerName != ''"> |
| | | and o.customer_name REGEXP #{order.customerName} |
| | | </if> |
| | | <if test="order.quantity != null and order.quantity != ''"> |
| | | and o.quantity REGEXP #{order.quantity} |
| | | </if> |
| | | <if test="order.project != null and order.project != ''"> |
| | | and o.project REGEXP #{order.project} |
| | | </if> |
| | | <if test="order.batch != null and order.batch != ''"> |
| | | and o.batch REGEXP #{order.batch} |
| | | </if> |
| | | <if test="order.money != null and order.money != ''"> |
| | | and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','') |
| | | </if> |
| | | <if test="order.area != null and order.area != ''"> |
| | | and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','') |
| | | </if> |
| | | <if test="order.packType != null and order.packType != ''"> |
| | | and o.pack_type REGEXP #{order.packType} |
| | | </if> |
| | | <if test="order.orderType != null and order.orderType != ''"> |
| | | and o.order_type REGEXP #{order.orderType} |
| | | </if> |
| | | <if test="order.creator != null and order.creator != ''"> |
| | | and o.creator REGEXP #{order.creator} |
| | | </if> |
| | | <if test="order.createTime != null and order.createTime != ''"> |
| | | and o.create_time REGEXP #{order.createTime} |
| | | </if> |
| | | <if test="order.finishedGoodsInventory.quantityAvailable != null and order.finishedGoodsInventory.quantityAvailable != ''"> |
| | | and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable} |
| | | </if> |
| | | </where> |
| | | group by o.order_id order by o.id desc |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectOrderInventoryPageTotal" > |
| | | select CEILING(count(zu.order_id)/#{pageSize}) as 'pageTotal', |
| | | count(zu.order_id) as 'total' from |
| | | (select o.create_order,o.process_review,o.order_review,o.production_order, |
| | | o.processing_card,o.warehousing,o.delivery,o.order_id,o.customer_id, |
| | | o.customer_name,o.quantity,sum(fgi.quantity_available),o.project,o.batch, |
| | | o.money,o.area,o.create_time,o.pack_type,o.order_type,o.creator |
| | | from sd.`order` o left join mm.finished_goods_inventory fgi on o.order_id=fgi.order_id |
| | | <where> |
| | | fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate} |
| | | <if test="order.orderId != null and order.orderId != ''"> |
| | | and o.order_id REGEXP #{order.orderId} |
| | | </if> |
| | | <if test="order.customerId != null and order.customerId != ''"> |
| | | and o.customer_id REGEXP #{order.customerId} |
| | | </if> |
| | | <if test="order.customerName != null and order.customerName != ''"> |
| | | and o.customer_name REGEXP #{order.customerName} |
| | | </if> |
| | | <if test="order.quantity != null and order.quantity != ''"> |
| | | and o.quantity REGEXP #{order.quantity} |
| | | </if> |
| | | <if test="order.project != null and order.project != ''"> |
| | | and o.project REGEXP #{order.project} |
| | | </if> |
| | | <if test="order.batch != null and order.batch != ''"> |
| | | and o.batch REGEXP #{order.batch} |
| | | </if> |
| | | <if test="order.money != null and order.money != ''"> |
| | | and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','') |
| | | </if> |
| | | <if test="order.area != null and order.area != ''"> |
| | | and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','') |
| | | </if> |
| | | <if test="order.packType != null and order.packType != ''"> |
| | | and o.pack_type REGEXP #{order.packType} |
| | | </if> |
| | | <if test="order.orderType != null and order.orderType != ''"> |
| | | and o.order_type REGEXP #{order.orderType} |
| | | </if> |
| | | <if test="order.creator != null and order.creator != ''"> |
| | | and o.creator REGEXP #{order.creator} |
| | | </if> |
| | | <if test="order.createTime != null and order.createTime != ''"> |
| | | and o.create_time REGEXP #{order.createTime} |
| | | </if> |
| | | <if test="order.finishedGoodsInventory.quantityAvailable != null and order.finishedGoodsInventory.quantityAvailable != ''"> |
| | | and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable} |
| | | </if> |
| | | </where> |
| | | group by o.order_id limit #{offset},#{pageSize}) as zu; |
| | | |
| | | |
| | | |
| | | |
| | | </select> |
| | | |
| | | <select id="getSelectShippingOrderDetailDelivery" > |
| | | select |
| | | d.delivery_state,d.stock_state,d.payment_terms, |
| | | d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number, |
| | | d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id |
| | | from sd.delivery d |
| | | <where> |
| | | <if test="orderDetail.deliveryDetail.deliveryId != null and orderDetail.deliveryDetail.deliveryId != ''"> |
| | | and d.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId} |
| | | </if> |
| | | |
| | | </where> |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | <select id="getSelectShippingOrderDetailDeliveryPrinting" > |
| | | select |
| | | d.delivery_id,d.quantity,d.money,d.area,d.project, |
| | | d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number, |
| | | d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id |
| | | from sd.delivery d |
| | | <where> |
| | | <if test="deliveryDetail.deliveryId != null and deliveryDetail.deliveryId != ''"> |
| | | and d.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%') |
| | | </if> |
| | | |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <select id="getSelectShippingOrderDetailDeliverys" > |
| | | select customer_id,customer_name,project,salesman,salesman_id,contacts,contact_number,delivery_address from sd.`order` |
| | | <where> |
| | | <if test="orderDetail.orderId != null and orderDetail.orderId != ''"> |
| | | and order_id regexp #{orderDetail.orderId} |
| | | </if> |
| | | |
| | | </where> |
| | | limit 0,1 |
| | | </select> |
| | | |
| | | <select id="getSelectShippingOrder"> |
| | | select * from sd.delivery d |
| | | <where> |
| | | date(d.create_time)>=#{startDate} and date(d.create_time) <= #{endDate} |
| | | <if test="delivery.deliveryId != null and delivery.deliveryId != ''"> |
| | | and d.delivery_id regexp #{delivery.deliveryId} |
| | | </if> |
| | | <if test="delivery.creator != null and delivery.creator != ''"> |
| | | and d.creator regexp #{delivery.creator} |
| | | </if> |
| | | <if test="delivery.deliveryDate != null and delivery.deliveryDate != ''"> |
| | | and d.delivery_date regexp #{delivery.deliveryDate} |
| | | </if> |
| | | <if test="delivery.customerId != null and delivery.customerId != ''"> |
| | | and d.customer_id regexp #{delivery.customerId} |
| | | </if> |
| | | <if test="delivery.customerName != null and delivery.customerName != ''"> |
| | | and d.customer_name regexp #{delivery.customerName} |
| | | </if> |
| | | <if test="delivery.project != null and delivery.project != ''"> |
| | | and d.project regexp #{delivery.project} |
| | | </if> |
| | | <if test="delivery.orderId != null and delivery.orderId != ''"> |
| | | and d.order_id regexp #{delivery.orderId} |
| | | </if> |
| | | <if test="delivery.payMethod != null and delivery.payMethod != ''"> |
| | | and d.pay_method regexp #{delivery.payMethod} |
| | | </if> |
| | | <if test="delivery.quantity != null and delivery.quantity != ''"> |
| | | and d.quantity regexp #{delivery.quantity} |
| | | </if> |
| | | <if test="delivery.area != null and delivery.area != ''"> |
| | | and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','') |
| | | </if> |
| | | |
| | | </where> |
| | | order by d.id desc |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | |
| | | <select id="getSelectShippingOrderPageTotal"> |
| | | select |
| | | CEILING(count(id)/#{pageSize}) as 'pageTotal', |
| | | count(id) as 'total' |
| | | from sd.delivery d |
| | | <where> |
| | | date(d.create_time)>=#{startDate} and date(d.create_time) <= #{endDate} |
| | | <if test="delivery.deliveryId != null and delivery.deliveryId != ''"> |
| | | and d.delivery_id regexp #{delivery.deliveryId} |
| | | </if> |
| | | <if test="delivery.creator != null and delivery.creator != ''"> |
| | | and d.creator regexp #{delivery.creator} |
| | | </if> |
| | | <if test="delivery.deliveryDate != null and delivery.deliveryDate != ''"> |
| | | and d.delivery_date regexp #{delivery.deliveryDate} |
| | | </if> |
| | | <if test="delivery.customerId != null and delivery.customerId != ''"> |
| | | and d.customer_id regexp #{delivery.customerId} |
| | | </if> |
| | | <if test="delivery.customerName != null and delivery.customerName != ''"> |
| | | and d.customer_name regexp #{delivery.customerName} |
| | | </if> |
| | | <if test="delivery.project != null and delivery.project != ''"> |
| | | and d.project regexp #{delivery.project} |
| | | </if> |
| | | <if test="delivery.orderId != null and delivery.orderId != ''"> |
| | | and d.order_id regexp #{delivery.orderId} |
| | | </if> |
| | | <if test="delivery.payMethod != null and delivery.payMethod != ''"> |
| | | and d.pay_method regexp #{delivery.payMethod} |
| | | </if> |
| | | <if test="delivery.quantity != null and delivery.quantity != ''"> |
| | | and d.quantity regexp #{delivery.quantity} |
| | | </if> |
| | | <if test="delivery.area != null and delivery.area != ''"> |
| | | and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','') |
| | | </if> |
| | | </where> |
| | | limit #{offset},#{pageSize}; |
| | | </select> |
| | | </mapper> |