|
|
|
@ -2,206 +2,145 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
|
|
|
|
|
<mapper namespace="com.glxp.api.dao.thrsys.ThrOrderDao">
|
|
|
|
|
|
|
|
|
|
<select id="filterThrOrder" parameterType="com.glxp.api.req.thrsys.FilterThrOrderRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.thrsys.ThrOrderEntity">
|
|
|
|
|
SELECT thr_order.*,thr_bustype_origin.name billTypeName FROM thr_order
|
|
|
|
|
left join thr_bustype_origin on thr_order.billType = thr_bustype_origin.action
|
|
|
|
|
<where>
|
|
|
|
|
<if test="billNo != '' and billNo != null">
|
|
|
|
|
AND billNo = #{billNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="id != '' and id !=null">
|
|
|
|
|
AND thr_order.id = #{id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billAction != '' and billAction !=null">
|
|
|
|
|
AND billType = #{billAction}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="originType != '' and originType !=null">
|
|
|
|
|
AND originType = #{originType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type !=null">
|
|
|
|
|
AND thr_order.`type` = #{type}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billFlag != '' and billFlag !=null">
|
|
|
|
|
AND billFlag = #{billFlag}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitIdFk != '' and unitIdFk !=null">
|
|
|
|
|
AND unitIdFk = #{unitIdFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdSysFk != '' and thirdSysFk != null">
|
|
|
|
|
AND thirdSysFk = #{thirdSysFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="corpName != '' and corpName != null">
|
|
|
|
|
AND corpName like concat('%',#{corpName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate!=null and startDate!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d')>= DATE_FORMAT(#{startDate}, '%Y-%m-%d') ]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate!=null and endDate!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d') ]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="editStatus!= null">
|
|
|
|
|
AND editStatus = #{editStatus}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(thr_order.updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY thr_order.updateTime DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="filterReceiveOrder" parameterType="com.glxp.api.req.thrsys.FilterThrOrderRequest"
|
|
|
|
|
resultType="com.glxp.api.entity.thrsys.ThrOrderEntity">
|
|
|
|
|
SELECT thr_order.*,basic_bustype_change.originName billTypeName,s1.name as invWarehouseName,s2.name as fromSubInvName FROM thr_order
|
|
|
|
|
left join basic_bustype_change on thr_order.billType = basic_bustype_change.originAction
|
|
|
|
|
LEFT JOIN inv_warehouse_sub s1 ON thr_order.invWarehouseCode=s1.`code`
|
|
|
|
|
LEFT JOIN inv_warehouse_sub s2 ON thr_order.fromSubInvCode=s2.`code`
|
|
|
|
|
SELECT thr_order.*, thr_bustype_origin.name billTypeName
|
|
|
|
|
FROM thr_order
|
|
|
|
|
left join thr_bustype_origin on thr_order.billType = thr_bustype_origin.action
|
|
|
|
|
<where>
|
|
|
|
|
<if test="billNo != '' and billNo != null">
|
|
|
|
|
AND billNo = #{billNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="id != '' and id !=null">
|
|
|
|
|
<if test="id != '' and id != null">
|
|
|
|
|
AND thr_order.id = #{id}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billAction != '' and billAction !=null">
|
|
|
|
|
<if test="billAction != '' and billAction != null">
|
|
|
|
|
AND billType = #{billAction}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="originType != '' and originType !=null">
|
|
|
|
|
AND originType = #{originType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type !=null">
|
|
|
|
|
AND thr_order.`type` = #{type}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="billFlag != '' and billFlag !=null">
|
|
|
|
|
<if test="billFlag != '' and billFlag != null">
|
|
|
|
|
AND billFlag = #{billFlag}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitIdFk != '' and unitIdFk !=null">
|
|
|
|
|
AND unitIdFk = #{unitIdFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdSysFk != '' and thirdSysFk != null">
|
|
|
|
|
AND thirdSysFk = #{thirdSysFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="corpName != '' and corpName != null">
|
|
|
|
|
AND corpName like concat('%',#{corpName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="startDate!=null and startDate!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d')>= DATE_FORMAT(#{startDate}, '%Y-%m-%d') ]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="endDate!=null and endDate!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d') ]]>
|
|
|
|
|
AND corpName like concat('%', #{corpName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="editStatus!= null">
|
|
|
|
|
AND editStatus = #{editStatus}
|
|
|
|
|
<if test="startDate != null and startDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(billdate, '%Y-%m-%d') >= DATE_FORMAT(#{startDate}, '%Y-%m-%d')
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="thirdPartyDate!= null">
|
|
|
|
|
AND thirdPartyDate = #{thirdPartyDate}
|
|
|
|
|
<if test="endDate != null and endDate != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(billdate, '%Y-%m-%d') <= DATE_FORMAT(#{endDate}, '%Y-%m-%d')
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
|
|
|
|
<![CDATA[ and DATE_FORMAT(thr_order.updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="allocateStatus!= null">
|
|
|
|
|
AND allocateStatus = #{allocateStatus}
|
|
|
|
|
<if test="lastUpdateTime != null and lastUpdateTime != ''">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
and DATE_FORMAT(thr_order.updateTime, '%Y-%m-%d %H:%i:%S') >=
|
|
|
|
|
DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S')
|
|
|
|
|
]]>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
ORDER BY thr_order.updateTime DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="insertThrOrder" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrOrderEntity">
|
|
|
|
|
replace
|
|
|
|
|
INTO thr_order
|
|
|
|
|
(id,billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk,
|
|
|
|
|
startDate, endDate, createUser, reviewUser, address, linkMan, linkTel, remark, remark1, remark2,
|
|
|
|
|
remark3, locStorageCode,editStatus,invWarehouseCode,thirdPartyDate,fromSubInvCode,`type`,allocateStatus)
|
|
|
|
|
values (
|
|
|
|
|
#{id},
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{billdate},
|
|
|
|
|
#{corpId},
|
|
|
|
|
#{corpName},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{billFlag},
|
|
|
|
|
#{thirdSysFk},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{originType},
|
|
|
|
|
#{unitIdFk},
|
|
|
|
|
#{startDate},
|
|
|
|
|
#{endDate},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{reviewUser},
|
|
|
|
|
#{address},
|
|
|
|
|
#{linkMan},
|
|
|
|
|
#{linkTel},
|
|
|
|
|
#{remark},
|
|
|
|
|
#{remark1},
|
|
|
|
|
#{remark2},
|
|
|
|
|
#{remark3},
|
|
|
|
|
#{locStorageCode},
|
|
|
|
|
#{editStatus},
|
|
|
|
|
#{invWarehouseCode},
|
|
|
|
|
#{thirdPartyDate},
|
|
|
|
|
#{fromSubInvCode},
|
|
|
|
|
#{type},
|
|
|
|
|
#{allocateStatus}
|
|
|
|
|
)
|
|
|
|
|
INTO thr_order
|
|
|
|
|
(id, billFlag, billNo, billdate, billType, billTypeName, corpId, corpName, inoutType, deptCode, deptName,
|
|
|
|
|
invCode, invName, thirdSysFk, createUser, createTime, updateUser, updateTime, reviewUser, reviewTime, address,
|
|
|
|
|
linkMan, linkTel, remark)
|
|
|
|
|
values (#{id},
|
|
|
|
|
#{billFlag},
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{billdate},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{billTypeName},
|
|
|
|
|
#{corpId},
|
|
|
|
|
#{corpName},
|
|
|
|
|
#{inoutType},
|
|
|
|
|
#{deptCode},
|
|
|
|
|
#{deptName},
|
|
|
|
|
#{invCode},
|
|
|
|
|
#{invName},
|
|
|
|
|
#{thirdSysFk},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{createTime},
|
|
|
|
|
#{updateUser},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{reviewUser},
|
|
|
|
|
#{reviewTime},
|
|
|
|
|
#{address},
|
|
|
|
|
#{linkMan},
|
|
|
|
|
#{linkTel},
|
|
|
|
|
#{remark})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="importThrOrder" keyProperty="id" parameterType="com.glxp.api.entity.thrsys.ThrOrderEntity">
|
|
|
|
|
replace
|
|
|
|
|
INTO thr_order
|
|
|
|
|
(id,billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType,
|
|
|
|
|
startDate, endDate, createUser, reviewUser, address, linkMan, linkTel, remark, remark1, remark2,
|
|
|
|
|
remark3,invWarehouseCode,fromSubInvCode,`type`,allocateStatus)
|
|
|
|
|
values (
|
|
|
|
|
#{id},
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{billdate},
|
|
|
|
|
#{corpId},
|
|
|
|
|
#{corpName},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{billFlag},
|
|
|
|
|
#{thirdSysFk},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{originType},
|
|
|
|
|
#{startDate},
|
|
|
|
|
#{endDate},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{reviewUser},
|
|
|
|
|
#{address},
|
|
|
|
|
#{linkMan},
|
|
|
|
|
#{linkTel},
|
|
|
|
|
#{remark},
|
|
|
|
|
#{remark1},
|
|
|
|
|
#{remark2},
|
|
|
|
|
#{remark3},
|
|
|
|
|
#{invWarehouseCode},
|
|
|
|
|
#{fromSubInvCode},
|
|
|
|
|
#{type},
|
|
|
|
|
#{allocateStatus}
|
|
|
|
|
)
|
|
|
|
|
INTO thr_order
|
|
|
|
|
(id, billFlag, billNo, billdate, billType, billTypeName, corpId, corpName, inoutType, deptCode, deptName,
|
|
|
|
|
invCode, invName, thirdSysFk, createUser, createTime, updateUser, updateTime, reviewUser, reviewTime, address,
|
|
|
|
|
linkMan, linkTel, remark)
|
|
|
|
|
values (#{id},
|
|
|
|
|
#{billFlag},
|
|
|
|
|
#{billNo},
|
|
|
|
|
#{billdate},
|
|
|
|
|
#{billType},
|
|
|
|
|
#{billTypeName},
|
|
|
|
|
#{corpId},
|
|
|
|
|
#{corpName},
|
|
|
|
|
#{inoutType},
|
|
|
|
|
#{deptCode},
|
|
|
|
|
#{deptName},
|
|
|
|
|
#{invCode},
|
|
|
|
|
#{invName},
|
|
|
|
|
#{thirdSysFk},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{createTime},
|
|
|
|
|
#{updateUser},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{reviewUser},
|
|
|
|
|
#{reviewTime},
|
|
|
|
|
#{address},
|
|
|
|
|
#{linkMan},
|
|
|
|
|
#{linkTel},
|
|
|
|
|
#{remark})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertThrOrders" keyProperty="id" parameterType="java.util.List">
|
|
|
|
|
replace INTO thr_order
|
|
|
|
|
(billNo, billdate, corpId, corpName, billType, billFlag, thirdSysFk, updateTime, originType, unitIdFk,
|
|
|
|
|
startDate, endDate, createUser, reviewUser, address, linkMan, linkTel, remark, remark1, remark2,
|
|
|
|
|
remark3,locStorageCode,editStatus,invWarehouseCode,fromSubInvCode,`type`,allocateStatus)
|
|
|
|
|
(billFlag, billNo, billdate, billType, billTypeName, corpId, corpName, inoutType, deptCode, deptName,
|
|
|
|
|
invCode, invName, thirdSysFk, createUser, createTime, updateUser, updateTime, reviewUser, reviewTime, address,
|
|
|
|
|
linkMan, linkTel, remark)
|
|
|
|
|
values
|
|
|
|
|
<foreach collection="thrOrderEntities" item="item" index="index"
|
|
|
|
|
separator=",">
|
|
|
|
|
(#{item.billNo},
|
|
|
|
|
#{item.billdate},
|
|
|
|
|
#{item.corpId},
|
|
|
|
|
#{item.corpName},
|
|
|
|
|
#{item.billType},
|
|
|
|
|
#{item.billFlag},
|
|
|
|
|
#{item.thirdSysFk}, #{item.updateTime}, #{item.originType}, #{item.unitIdFk},
|
|
|
|
|
#{item.startDate}, #{item.endDate}, #{item.createUser}, #{item.reviewUser},
|
|
|
|
|
#{item.address}, #{item.linkMan}, #{item.linkTel}, #{item.remark}, #{item.remark1},
|
|
|
|
|
#{item.remark2},
|
|
|
|
|
#{item.remark3},#{item.locStorageCode},#{item.editStatus},#{item.invWarehouseCode},#{item.fromSubInvCode},#{item.type},#{item.allocateStatus}
|
|
|
|
|
)
|
|
|
|
|
(#{item.billFlag},
|
|
|
|
|
#{item.billNo},
|
|
|
|
|
#{item.billdate},
|
|
|
|
|
#{item.billType},
|
|
|
|
|
#{item.billTypeName},
|
|
|
|
|
#{item.corpId},
|
|
|
|
|
#{item.corpName},
|
|
|
|
|
#{item.inoutType},
|
|
|
|
|
#{item.deptCode},
|
|
|
|
|
#{item.deptName},
|
|
|
|
|
#{item.invCode},
|
|
|
|
|
#{item.invName},
|
|
|
|
|
#{item.thirdSysFk},
|
|
|
|
|
#{item.createUser},
|
|
|
|
|
#{item.createTime},
|
|
|
|
|
#{item.updateUser},
|
|
|
|
|
#{item.updateTime},
|
|
|
|
|
#{item.reviewUser},
|
|
|
|
|
#{item.reviewTime},
|
|
|
|
|
#{item.address},
|
|
|
|
|
#{item.linkMan},
|
|
|
|
|
#{item.linkTel},
|
|
|
|
|
#{item.remark})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -215,40 +154,4 @@
|
|
|
|
|
DELETE
|
|
|
|
|
FROM thr_order
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<update id="updateThrOrder" parameterType="com.glxp.api.entity.thrsys.ThrOrderEntity">
|
|
|
|
|
UPDATE thr_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="updateTime != null">updateTime=#{updateTime},</if>
|
|
|
|
|
<if test="originType != null">originType=#{originType},</if>
|
|
|
|
|
<if test="startDate != null">startDate=#{startDate},</if>
|
|
|
|
|
<if test="endDate != null">endDate=#{endDate},</if>
|
|
|
|
|
<if test="createUser != null">createUser=#{createUser},</if>
|
|
|
|
|
<if test="reviewUser != null">reviewUser=#{reviewUser},</if>
|
|
|
|
|
<if test="address != null">address=#{address},</if>
|
|
|
|
|
<if test="linkMan != null">linkMan=#{linkMan},</if>
|
|
|
|
|
<if test="linkTel != null">linkTel=#{linkTel},</if>
|
|
|
|
|
<if test="remark != null">remark=#{remark},</if>
|
|
|
|
|
<if test="remark1 != null">remark1=#{remark1},</if>
|
|
|
|
|
<if test="remark2 != null">remark2=#{remark2},</if>
|
|
|
|
|
<if test="remark3 != null">remark3=#{remark3},</if>
|
|
|
|
|
<if test="locStorageCode != null">locStorageCode=#{locStorageCode},</if>
|
|
|
|
|
<if test="editStatus != null">editStatus=#{editStatus},</if>
|
|
|
|
|
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
|
|
|
|
|
<if test="fromSubInvCode != null">fromSubInvCode=#{fromSubInvCode},</if>
|
|
|
|
|
<if test="type != null">`type`=#{type},</if>
|
|
|
|
|
<if test="allocateStatus != null">`allocateStatus`=#{allocateStatus},</if>
|
|
|
|
|
|
|
|
|
|
</trim>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|
|
|
|
|