You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spms-java/api-admin/src/main/resources/mybatis/mapper/inout/StockOrderDao.xml

245 lines
10 KiB
XML

<?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.StockOrderDao">
<select id="listStockOrder" parameterType="com.glxp.sale.admin.req.inout.StockOrderQueryRequest"
resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
SELECT *
FROM stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
where status = 'success'
</select>
<select id="listStockOrderNoDealWith" parameterType="com.glxp.sale.admin.req.inout.StockOrderQueryRequest"
resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
select *
from stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
where `status` = '101'
ORDER BY id DESC
</select>
<insert id="insertStockOrder" useGeneratedKeys="true" keyProperty="id"
parameterType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
insert INTO stock_order(id, billNo, billdate, corpId, corpName, billType, billFlag,
thirdSysFk, status, statusInfo, type, sourceType,
printStatus, unitIdFk, customerId, thirdOrderFk, orderIdFk,
totalPrice, locStorageCode, supplementNo, createUser, reviewUser)
values (#{id},
#{billNo},
#{billdate},
#{corpId},
#{corpName},
#{billType},
#{billFlag},
#{thirdSysFk},
#{status},
#{statusInfo},
#{type},
#{sourceType},
#{printStatus}, #{unitIdFk}, #{customerId}, #{thirdOrderFk}, #{orderIdFk}, #{totalPrice},
#{locStorageCode}, #{supplementNo}, #{createUser}, #{reviewUser})
</insert>
<update id="updateById" parameterType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
UPDATE stock_order
<trim prefix="set" suffixOverrides=",">
<if test="billNo != null">billNo=#{billNo},</if>
<if test="billdate != null">billdate=#{billdate},</if>
<if test="corpId != null">corpId=#{corpId},</if>
<if test="corpName != null">corpName=#{corpName},</if>
<if test="billType != null">billType=#{billType},</if>
<if test="billFlag != null">billFlag=#{billFlag},</if>
<if test="thirdSysFk != null">thirdSysFk=#{thirdSysFk},</if>
<if test="status != null">status=#{status},</if>
<if test="statusInfo != null">statusInfo=#{statusInfo},</if>
<if test="type != null">type=#{type},</if>
<if test="sourceType != null">sourceType=#{sourceType},</if>
<if test="printStatus != null">printStatus=#{printStatus},</if>
<if test="unitIdFk != null">unitIdFk=#{unitIdFk},</if>
<if test="customerId != null">customerId=#{customerId},</if>
<if test="thirdOrderFk != null">thirdOrderFk=#{thirdOrderFk},</if>
<if test="orderIdFk != null">orderIdFk=#{orderIdFk},</if>
<if test="totalPrice != null">totalPrice=#{totalPrice},</if>
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
<if test="supplementNo != null">supplementNo=#{supplementNo},</if>
<if test="createUser != null">createUser=#{createUser},</if>
<if test="reviewUser != null">reviewUser=#{reviewUser},</if>
</trim>
WHERE id = #{id}
</update>
<delete id="deleteByOrderId" parameterType="Map">
DELETE
FROM stock_order
WHERE id = #{orderId}
</delete>
<delete id="deleteById" parameterType="Map">
DELETE
FROM stock_order
WHERE id = #{id}
</delete>
<update id="updateByStatus" parameterType="Map">
UPDATE stock_order
SET `status` = #{status}
where id = #{orderId}
</update>
<update id="updateSupplementNoByBillNo">
update stock_order
set supplementNo = #{supplementOrderNo}
where billNo = #{billNo}
</update>
<select id="filterListOr" parameterType="com.glxp.sale.admin.req.inout.StockOrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
SELECT stock_order.* FROM stock_order
INNER JOIN inv_warehouse_user on stock_order.locStorageCode = inv_warehouse_user.`code`
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="billNo != '' and billNo!=null">
and billNo LIKE concat('%',#{billNo},'%')
</if>
<if test="billdate != '' and billdate!=null">
and billdate = #{billdate}
</if>
<if test="corpId != '' and corpId!=null">
and corpId = #{corpId}
</if>
<if test="corpName != '' and corpName!=null">
and corpName LIKE concat('%',#{corpName},'%')
</if>
<if test="billType != '' and billType!=null">
and billType = #{billType}
</if>
<if test="billFlag != '' and billFlag!=null">
and billFlag = #{billFlag}
</if>
<if test="thirdSysFk != '' and thirdSysFk!=null">
and thirdSysFk = #{thirdSysFk}
</if>
<if test="status != '' and status!=null">
and status = #{status}
</if>
<if test="statusInfo != '' and statusInfo!=null">
and statusInfo = #{statusInfo}
</if>
<if test="type != '' and type!=null">
and type = #{type}
</if>
<if test="sourceType != '' and sourceType!=null">
and sourceType = #{sourceType}
</if>
<if test="printStatus != '' and printStatus!=null">
and printStatus = #{printStatus}
</if>
<if test="unitIdFk != '' and unitIdFk!=null">
and unitIdFk = #{unitIdFk}
</if>
<if test="customerId != '' and customerId!=null">
and customerId = #{customerId}
</if>
<if test="thirdOrderFk != '' and thirdOrderFk!=null">
and thirdOrderFk = #{thirdOrderFk}
</if>
<if test="orderIdFk != '' and orderIdFk!=null">
and orderIdFk = #{orderIdFk}
</if>
<if test="totalPrice != '' and totalPrice!=null">
and totalPrice = #{totalPrice}
</if>
<if test="locStorageCode != '' and locStorageCode!=null">
and locStorageCode = #{locStorageCode}
</if>
<if test="createUser!=null">
and createUser = #{createUser}
</if>
<if test="reviewUser!=null">
and reviewUser = #{reviewUser}
</if>
<if test="startTime!=null and startTime!=''">
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d')>= DATE_FORMAT(#{startTime}, '%Y-%m-%d') ]]>
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
</if>
<if test="userId!=null">
and inv_warehouse_user.userId =#{userId}
</if>
</where>
ORDER BY id DESC
</select>
<select id="findOne" parameterType="com.glxp.sale.admin.req.inout.StockOrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
SELECT * FROM stock_order
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="corpId != '' and corpId !=null">
and corpId =#{corpId}
</if>
<if test="billNo != '' and billNo !=null">
and billNo =#{billNo}
</if>
<if test="billType != '' and billType !=null">
and billType =#{billType}
</if>
<if test="customerId != '' and customerId !=null">
and customerId =#{customerId}
</if>
<if test="thirdOrderFk != '' and thirdOrderFk !=null">
and thirdOrderFk =#{thirdOrderFk}
</if>
<if test="orderIdFk != '' and orderIdFk !=null">
and orderIdFk =#{orderIdFk}
</if>
<if test="createUser!=null">
and createUser = #{createUser}
</if>
<if test="reviewUser!=null">
and reviewUser = #{reviewUser}
</if>
</where>
limit 1
</select>
<select id="listOrderPrint" parameterType="com.glxp.sale.admin.req.inout.StockOrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.StockOrderPrintEntity">
SELECT stock_order.*, stock_order_detail.productId, stock_order_detail.productName, stock_order_detail.spec,
stock_order_detail.batchNo, stock_order_detail.productDate, stock_order_detail.expireDate,
stock_order_detail.count, stock_order_detail.sweepCount, stock_order_detail.ylqxzcrbarmc,
stock_order_detail.zczbhhzbapzbh,stock_order_detail.price FROM stock_order INNER JOIN stock_order_detail on
stock_order.id =
stock_order_detail.orderIdFk
<where>
<if test="id != '' and id!=null">
and stock_order.id =#{id}
</if>
<if test="corpId != '' and corpId !=null">
and stock_order.corpId =#{corpId}
</if>
<if test="billNo != '' and billNo !=null">
and stock_order.billNo =#{billNo}
</if>
<if test="customerId != '' and customerId !=null">
and stock_order.customerId =#{customerId}
</if>
</where>
</select>
<select id="selectSupplementOrderList" resultType="com.glxp.sale.admin.entity.inout.StockOrderEntity">
select billNo
from stock_order
where supplementNo is null
or supplementNo = ''
</select>
</mapper>