|
|
|
<?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.glxp.sale.admin.dao.inout.StockOrderDetailDao">
|
|
|
|
|
|
|
|
<select id="filterStockOrderDetail" parameterType="com.glxp.sale.admin.req.inout.StockOrderDetailFilterRequest"
|
|
|
|
resultType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
select stock_order_detail.* from stock_order_detail
|
|
|
|
left join basic_udirel on stock_order_detail.relId = basic_udirel.id
|
|
|
|
<where>
|
|
|
|
<if test="orderIdFk != '' and orderIdFk!=null">
|
|
|
|
and orderIdFk = #{orderIdFk}
|
|
|
|
</if>
|
|
|
|
<if test="productId != '' and productId!=null">
|
|
|
|
and productId = #{productId}
|
|
|
|
</if>
|
|
|
|
<if test="batchNo != '' and batchNo!=null">
|
|
|
|
and batchNo = #{batchNo}
|
|
|
|
</if>
|
|
|
|
<if test="productDate != '' and productDate!=null">
|
|
|
|
and productDate = #{productDate}
|
|
|
|
</if>
|
|
|
|
<if test="expireDate != '' and expireDate!=null">
|
|
|
|
and expireDate = #{expireDate}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
group by stock_order_detail.id
|
|
|
|
ORDER BY id DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="filterStockOrderDetail2" parameterType="com.glxp.sale.admin.req.inout.StockOrderDetailFilterRequest"
|
|
|
|
resultType="com.glxp.sale.admin.res.inout.StockOrderDetailResponse">
|
|
|
|
select
|
|
|
|
stock_order_detail.id,stock_order_detail.orderIdFk,stock_order_detail.productId,
|
|
|
|
basic_products.cpmctymc,basic_products.ggxh,
|
|
|
|
stock_order_detail.batchNo,stock_order_detail.expireDate,stock_order_detail.productDate,
|
|
|
|
stock_order_detail.count,stock_order_detail.reCount,stock_order_detail.sweepCount,stock_order_detail.relId,
|
|
|
|
basic_products.ylqxzcrbarmc,basic_products.zczbhhzbapzbh,stock_order_detail.price
|
|
|
|
from stock_order_detail
|
|
|
|
right JOIN basic_products
|
|
|
|
ON stock_order_detail.productId = basic_products.uuid
|
|
|
|
<where>
|
|
|
|
<if test="orderIdFk != '' and orderIdFk!=null">
|
|
|
|
and orderIdFk = #{orderIdFk}
|
|
|
|
</if>
|
|
|
|
<if test="productId != '' and productId!=null">
|
|
|
|
and productId = #{productId}
|
|
|
|
</if>
|
|
|
|
<if test="batchNo != '' and batchNo!=null">
|
|
|
|
and stock_order_detail.batchNo = #{batchNo}
|
|
|
|
</if>
|
|
|
|
<if test="productDate != '' and productDate!=null">
|
|
|
|
and stock_order_detail.productDate = #{productDate}
|
|
|
|
</if>
|
|
|
|
<if test="expireDate != '' and expireDate!=null">
|
|
|
|
and stock_order_detail.expireDate = #{expireDate}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
group by stock_order_detail.id
|
|
|
|
ORDER BY id DESC
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertStockOrderDetail" keyProperty="id"
|
|
|
|
parameterType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
replace
|
|
|
|
INTO stock_order_detail(id,
|
|
|
|
orderIdFk,productId,productName,spec,batchNo,productDate,
|
|
|
|
expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId,
|
|
|
|
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate)
|
|
|
|
values(
|
|
|
|
#{id},
|
|
|
|
#{orderIdFk},
|
|
|
|
#{productId},
|
|
|
|
#{productName},
|
|
|
|
#{spec},
|
|
|
|
#{batchNo},
|
|
|
|
#{productDate},
|
|
|
|
#{expireDate},
|
|
|
|
#{count},
|
|
|
|
#{reCount},
|
|
|
|
#{sweepCount},
|
|
|
|
#{ylqxzcrbarmc},
|
|
|
|
#{zczbhhzbapzbh},
|
|
|
|
#{price},
|
|
|
|
#{relId},
|
|
|
|
#{manufactory},
|
|
|
|
#{firstSalesInvNo},
|
|
|
|
#{secSalesInvNo},
|
|
|
|
#{secSalesListNo},
|
|
|
|
#{invoiceDate}
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insertStockOrderDetails" keyProperty="id"
|
|
|
|
parameterType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
replace INTO stock_order_detail(id,
|
|
|
|
orderIdFk,productId,productName,spec,batchNo,productDate,
|
|
|
|
expireDate,count,reCount,sweepCount,ylqxzcrbarmc,zczbhhzbapzbh,price,relId,
|
|
|
|
manufactory,firstSalesInvNo,secSalesInvNo,secSalesListNo,invoiceDate)
|
|
|
|
values
|
|
|
|
<foreach collection="stockOrderDetailEntities" item="item" index="index"
|
|
|
|
separator=",">
|
|
|
|
(
|
|
|
|
#{item.id},
|
|
|
|
#{item.orderIdFk},
|
|
|
|
#{item.productId},
|
|
|
|
#{item.productName},
|
|
|
|
#{item.spec},
|
|
|
|
#{item.batchNo},
|
|
|
|
#{item.productDate},
|
|
|
|
#{item.expireDate},
|
|
|
|
#{item.count},
|
|
|
|
#{item.reCount},
|
|
|
|
#{item.sweepCount},
|
|
|
|
#{item.ylqxzcrbarmc},
|
|
|
|
#{item.zczbhhzbapzbh},#{item.price},#{item.relId},#{item.manufactory},#{item.firstSalesInvNo},#{item.secSalesInvNo},
|
|
|
|
#{item.secSalesListNo},#{item.invoiceDate}
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="updateById" parameterType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
UPDATE stock_order_detail
|
|
|
|
<set>
|
|
|
|
<if test="batchNo != null">batchNo=#{batchNo},</if>
|
|
|
|
<if test="productDate != null">productDate=#{productDate},</if>
|
|
|
|
<if test="expireDate != null">expireDate=#{expireDate},</if>
|
|
|
|
<if test="sweepCount != null">sweepCount=#{sweepCount},</if>
|
|
|
|
<if test="count != null">count=#{count},</if>
|
|
|
|
<if test="reCount != null">reCount=#{reCount},</if>
|
|
|
|
<if test="sweepCount != null">sweepCount=#{sweepCount},</if>
|
|
|
|
<if test="price != null">price=#{price},</if>
|
|
|
|
<if test="secSalesListNo != null ">secSalesListNo=#{secSalesListNo},</if>
|
|
|
|
<if test="firstSalesInvNo != null">firstSalesInvNo=#{firstSalesInvNo},</if>
|
|
|
|
<if test="secSalesInvNo != null">secSalesInvNo=#{secSalesInvNo},</if>
|
|
|
|
<if test="invoiceDate != null">invoiceDate=#{invoiceDate},</if>
|
|
|
|
<if test="relId != null">relId=#{relId},</if>
|
|
|
|
<if test="manufactory != null">manufactory=#{manufactory},</if>
|
|
|
|
</set>
|
|
|
|
WHERE id = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<delete id="deleteById" parameterType="Map">
|
|
|
|
DELETE
|
|
|
|
FROM stock_order_detail
|
|
|
|
WHERE id = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<delete id="deleteByOrderIdFk" parameterType="Map">
|
|
|
|
DELETE
|
|
|
|
FROM stock_order_detail
|
|
|
|
WHERE orderIdFk = #{id}
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="findOne" parameterType="Map"
|
|
|
|
resultType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
SELECT *
|
|
|
|
FROM stock_order_detail
|
|
|
|
WHERE id = #{id}
|
|
|
|
limit 1
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<delete id="deleteStockOrderDetail">
|
|
|
|
delete
|
|
|
|
from stock_order_detail
|
|
|
|
<where>
|
|
|
|
orderIdFk = (select id from stock_order where stock_order.orderIdFk = #{param1.orderIdFk})
|
|
|
|
<if test="param1.productId != null">
|
|
|
|
and productId = #{param1.productId}
|
|
|
|
</if>
|
|
|
|
<if test="param1.batchNo != null">
|
|
|
|
and batchNo = #{param1.batchNo}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
<select id="filterStockOrderDetail3" parameterType="com.glxp.sale.admin.req.inout.StockOrderDetailFilterRequest"
|
|
|
|
resultType="com.glxp.sale.admin.entity.inout.StockOrderDetailEntity">
|
|
|
|
select *
|
|
|
|
from stock_order_detail
|
|
|
|
<where>
|
|
|
|
<if test="productId != null and productId != ''">
|
|
|
|
AND productId = #{productId}
|
|
|
|
</if>
|
|
|
|
<if test="batchNo != null and batchNo != ''">
|
|
|
|
AND batchNo = #{batchNo}
|
|
|
|
</if>
|
|
|
|
<if test="orderIdFk != null and orderIdFk != ''">
|
|
|
|
AND orderIdFk = #{orderIdFk}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|