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/OrderDao.xml

340 lines
14 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.OrderDao">
<select id="listOrder" parameterType="com.glxp.sale.admin.req.inout.OrderQueryRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT *
FROM io_order
where status = 'success'
</select>
<select id="listOrderError" parameterType="com.glxp.sale.admin.req.inout.OrderQueryRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
select *
from io_order
where `status` <![CDATA[ <> ]]> 'success'
ORDER BY actDate DESC
</select>
<select id="listOrderRepeat" parameterType="com.glxp.sale.admin.req.inout.OrderQueryRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
select *
from io_order
where corpOrderId in (select corpOrderId from io_order group by corpOrderId HAVING COUNT(corpOrderId) > 1)
ORDER BY actDate DESC
</select>
<insert id="insertOrder" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.OrderEntity">
insert INTO io_order(id, action, corpOrderId, actDate, fromCorpId, actor, mainAction,
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, customerId, supId, exportFilePath,locStorageCode,supplementNo)
values (#{id},
#{action},
#{corpOrderId},
#{actDate},
#{fromCorpId},
#{actor},
#{mainAction},
#{fromCorp},
#{status},
#{remark},
#{exportStatus},
#{fromType},
#{contrastStatus},
#{signStatus},
#{receiveStatus},
#{erpFk},
#{stockCheckFk},
#{customerId}, #{supId}, #{exportFilePath},#{locStorageCode},#{supplementNo})
</insert>
<update id="updateOrder" parameterType="com.glxp.sale.admin.entity.inout.OrderEntity">
UPDATE io_order
<trim prefix="set" suffixOverrides=",">
<if test="action != null">action=#{action},</if>
<if test="corpOrderId != null">corpOrderId=#{corpOrderId},</if>
<if test="actDate != null">actDate=#{actDate},</if>
<if test="fromCorpId != null">fromCorpId=#{fromCorpId},</if>
<if test="actor != null">actor=#{actor},</if>
<if test="mainAction != null">mainAction=#{mainAction},</if>
<if test="fromCorp != null">fromCorp=#{fromCorp},</if>
<if test="status != null">status=#{status},</if>
<if test="remark != null">remark=#{remark},</if>
<if test="exportStatus != null">exportStatus=#{exportStatus},</if>
<if test="fromType != null">fromType=#{fromType},</if>
<if test="contrastStatus != null">contrastStatus=#{contrastStatus},</if>
<if test="erpFk != null">erpFk=#{erpFk},</if>
<if test="signStatus != null">signStatus=#{signStatus},</if>
<if test="receiveStatus != null">receiveStatus=#{receiveStatus},</if>
<if test="stockCheckFk != null">stockCheckFk=#{stockCheckFk},</if>
<if test="supId != null">supId=#{supId},</if>
<if test="exportFilePath != null">exportFilePath=#{exportFilePath},</if>
<if test="invStorageCode != null">invStorageCode=#{invStorageCode},</if>
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
<if test="supplementNo != null">supplementNo=#{supplementNo},</if>
</trim>
WHERE id = #{id}
</update>
<select id="listOrderByIds" resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
select * from io_order where id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteById" parameterType="Map">
DELETE
FROM io_order
WHERE id = #{id}
</delete>
<delete id="deleteByOrderId" parameterType="Map">
DELETE
FROM io_order
WHERE id = #{orderId}
</delete>
<insert id="updateUnit" keyProperty="id" parameterType="com.glxp.sale.admin.entity.inout.OrderEntity">
UPDATE io_order
SET fromCorpId = #{fromCorpId},
fromCorp = #{fromCorp}
where id = #{id}
</insert>
<update id="updateOrderStatus" parameterType="Map">
UPDATE io_order
SET `status` = #{status}
where id = #{orderId}
</update>
<update id="updateExportStatus" parameterType="Map">
UPDATE io_order
SET `exportStatus` = #{exportStatus}
where id = #{orderId}
</update>
<update id="updateContrastStatus" parameterType="Map">
UPDATE io_order
SET `contrastStatus` = #{contrastStatus}
where id = #{orderId}
</update>
<update id="updateSignStatus" parameterType="Map">
UPDATE io_order
SET `signStatus` = #{signStatus}
where id = #{orderId}
</update>
<update id="updateRemark" parameterType="Map">
UPDATE io_order
SET `remark` = #{remark}
where id = #{orderId}
</update>
<select id="filterListOr" parameterType="com.glxp.sale.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="mainAction != '' and mainAction!=null">
and mainAction =#{mainAction}
</if>
<if test="fromCorpId != '' and fromCorpId!=null">
and fromCorpId =#{fromCorpId}
</if>
<if test="action != '' and action!=null">
and action = #{action}
</if>
<if test="action==null or action == ''">
and `action` <![CDATA[ <> ]]> 'StockCheck'
</if>
<if test="status != '' and status!=null">
and (status = #{status}
<if test="statusOrOne != '' and statusOrOne!=null">
or status = #{statusOrOne}
</if>)
</if>
<if test="exportStatus != '' and exportStatus!=null">
and exportStatus = #{exportStatus}
</if>
<if test="unionCtrStatus != '' and unionCtrStatus!=null">
and (contrastStatus = 0 or contrastStatus = 2)
</if>
<if test="receiveStatus!=null">
and receiveStatus = #{receiveStatus}
</if>
<if test="signStatus != '' and signStatus!=null">
and signStatus = #{signStatus}
</if>
<if test="contrastStatus != '' and contrastStatus!=null">
and contrastStatus = #{contrastStatus}
</if>
<if test="stockCheckFk != '' and stockCheckFk!=null">
and stockCheckFk = #{stockCheckFk}
</if>
<if test="startTime!=null and startTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d')>= DATE_FORMAT(#{startTime}, '%Y-%m-%d') ]]>
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
</if>
<if test="customerId != '' and customerId!=null">
and customerId =#{customerId}
</if>
</where>
ORDER BY actDate DESC
</select>
<select id="filterList" parameterType="com.glxp.sale.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="mainAction != '' and mainAction!=null">
and mainAction =#{mainAction}
</if>
<if test="fromCorpId != '' and fromCorpId!=null">
and fromCorpId =#{fromCorpId}
</if>
<if test="action != '' and action!=null">
and action = #{action}
</if>
<if test="action==null or action == ''">
and `action` <![CDATA[ <> ]]> 'StockCheck'
</if>
<if test="status != '' and status!=null and status!=10">
and status = #{status}
</if>
<if test="status ==10">
and ( status = 1 or status=-1)
</if>
<if test="exportStatus != '' and exportStatus!=null">
and exportStatus = #{exportStatus}
</if>
<if test="signStatus != '' and signStatus!=null">
and signStatus = #{signStatus}
</if>
<if test="contrastStatus != '' and contrastStatus!=null">
and contrastStatus = #{contrastStatus}
</if>
<if test="stockCheckFk != '' and stockCheckFk!=null">
and stockCheckFk = #{stockCheckFk}
</if>
<if test="receiveStatus != '' and receiveStatus!=null">
and receiveStatus = #{receiveStatus}
</if>
<if test="startTime!=null and startTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d')>= DATE_FORMAT(#{startTime}, '%Y-%m-%d') ]]>
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
</if>
<if test="customerId != '' and customerId!=null">
and customerId =#{customerId}
</if>
</where>
ORDER BY actDate DESC
</select>
<select id="filterNoSort" parameterType="com.glxp.sale.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="mainAction != '' and mainAction!=null">
and mainAction =#{mainAction}
</if>
<if test="action != '' and action!=null">
and action = #{action}
</if>
<if test="action==null or action == ''">
and `action` <![CDATA[ <> ]]> 'StockCheck'
</if>
<if test="status != '' and status!=null">
and status = #{status}
</if>
<if test="exportStatus != '' and exportStatus!=null">
and exportStatus = #{exportStatus}
</if>
<if test="signStatus != '' and signStatus!=null">
and signStatus = #{signStatus}
</if>
<if test="contrastStatus != '' and contrastStatus!=null">
and contrastStatus = #{contrastStatus}
</if>
<if test="stockCheckFk != '' and stockCheckFk!=null">
and stockCheckFk = #{stockCheckFk}
</if>
<if test="fromCorpId != '' and fromCorpId!=null">
and fromCorpId =#{fromCorpId}
</if>
<if test="receiveStatus != '' and receiveStatus!=null">
and receiveStatus = #{receiveStatus}
</if>
<if test="startTime!=null and startTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d')>= DATE_FORMAT(#{startTime}, '%Y-%m-%d') ]]>
</if>
<if test="endTime!=null and endTime!=''">
<![CDATA[ and DATE_FORMAT(actDate, '%Y-%m-%d') <= DATE_FORMAT(#{endTime}, '%Y-%m-%d') ]]>
</if>
</where>
</select>
<select id="findOne" parameterType="com.glxp.sale.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order
<where>
<if test="id != '' and id!=null">
and id =#{id}
</if>
<if test="corpOrderId != '' and corpOrderId !=null">
and corpOrderId =#{corpOrderId}
</if>
<if test="fromCorpId != '' and fromCorpId!=null">
and fromCorpId =#{fromCorpId}
</if>
<if test="action != '' and action!=null">
and `action` =#{action}
</if>
<if test="fromCorpId != '' and fromCorpId!=null">
and `fromCorpId` =#{fromCorpId}
</if>
</where>
limit 1
</select>
<select id="filterListByCode" parameterType="java.util.List"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order WHERE id IN
<foreach collection="warehouseEntityList" item="item" open="(" separator="," close=")">
#{item.orderId}
</foreach>
</select>
<select id="filterListByOrder" parameterType="java.util.List"
resultType="com.glxp.sale.admin.entity.inout.OrderEntity">
SELECT * FROM io_order WHERE id IN
<foreach collection="orderList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>