144 lines
6.6 KiB
XML
144 lines
6.6 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.mhd.oms.domain.executeOrder.repository.mapper.ExecuteOrderMapper">
|
|
|
|
<resultMap type="com.mhd.oms.domain.executeOrder.repository.po.ExecuteOrderPO" id="ExecuteOrderResult">
|
|
<result property="id" column="ID" />
|
|
<result property="realCreateBy" column="REAL_CREATE_BY" />
|
|
<result property="realCreateName" column="REAL_CREATE_NAME" />
|
|
<result property="createBy" column="CREATE_BY" />
|
|
<result property="createCompanyId" column="CREATE_COMPANY_ID" />
|
|
<result property="createTime" column="CREATE_TIME" />
|
|
<result property="updateBy" column="UPDATE_BY" />
|
|
<result property="updateTime" column="UPDATE_TIME" />
|
|
<result property="delFlag" column="DEL_FLAG" />
|
|
<result property="goodsNumber" column="GOODS_NUMBER" />
|
|
<result property="orgName" column="ORG_NAME" />
|
|
<result property="organizationId" column="ORGANIZATION_ID" />
|
|
<result property="businessDocumentId" column="BUSINESS_DOCUMENT_ID" />
|
|
<result property="businessDocumentNumber" column="BUSINESS_DOCUMENT_NUMBER" />
|
|
<result property="organizationName" column="ORGANIZATION_NAME" />
|
|
<result property="topOrganizationId" column="TOP_ORGANIZATION_ID" />
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectExecuteOrderPo">
|
|
SELECT
|
|
eo.*,
|
|
bdo.main_order_num,
|
|
bdo.RECIPIENT_NAME,
|
|
bdo.train_no,
|
|
NVL(tr.ROUTE_NAME, bdo.route) AS routeName
|
|
FROM
|
|
execute_order eo
|
|
LEFT JOIN
|
|
BUSINESS_DOCUMENT_ORDER bdo
|
|
ON
|
|
eo.BUSINESS_DOCUMENT_NUMBER = bdo.goods_number
|
|
left join NGWL_TEST_WLHY.tms_route tr on tr.id = bdo.route
|
|
</sql>
|
|
|
|
<sql id="selectExecuteOrderPo1">
|
|
<where>
|
|
<!-- 默认只查正常单(del_flag=1); 反审/删除的归档行需显式传delFlag=2(已反审tab) -->
|
|
<choose>
|
|
<when test="delFlag != null">and eo.DEL_FLAG = #{delFlag}</when>
|
|
<otherwise>and eo.DEL_FLAG = 1</otherwise>
|
|
</choose>
|
|
<if test="createStartTime != null">
|
|
and eo.CREATE_TIME >= #{createStartTime}
|
|
</if>
|
|
<if test="invoiceStatus != null">
|
|
and eo.INVOICE_STATUS = #{invoiceStatus}
|
|
</if>
|
|
<if test="invoiceNumber != null and invoiceNumber != ''">
|
|
and eo.INVOICE_NUMBER like concat('%', #{invoiceNumber}, '%')
|
|
</if>
|
|
<if test="createEndTime != null">
|
|
and eo.CREATE_TIME <= #{createEndTime} + 1 - 1/86400
|
|
</if>
|
|
<if test="issueStartTime != null">
|
|
and eo.ISSUE_TIME >= #{issueStartTime}
|
|
</if>
|
|
<if test="issueEndTime != null">
|
|
and eo.ISSUE_TIME <= #{issueEndTime} + 1 - 1/86400
|
|
</if>
|
|
<if test="goodsNumber != null and goodsNumber != ''">
|
|
and eo.GOODS_NUMBER like concat('%', #{goodsNumber}, '%')
|
|
</if>
|
|
<if test="invoiceStartTime != null">
|
|
and eo.INVOICE_DATE >= #{invoiceStartTime,jdbcType=DATE}
|
|
</if>
|
|
<if test="invoiceEndTime != null">
|
|
and eo.INVOICE_DATE <![CDATA[ < ]]> DATEADD(DAY, 1, #{invoiceEndTime,jdbcType=DATE})
|
|
</if>
|
|
<if test="documentStartTime != null">
|
|
and eo.DOCUMENT_DATE >= #{documentStartTime,jdbcType=DATE}
|
|
</if>
|
|
<if test="documentEndTime != null">
|
|
and eo.DOCUMENT_DATE <![CDATA[ < ]]> DATEADD(DAY, 1, #{documentEndTime,jdbcType=DATE})
|
|
</if>
|
|
<!-- <if test="invoiceStartTime != null">-->
|
|
<!-- and eo.INVOICE_DATE >= #{invoiceStartTime}-->
|
|
<!-- </if>-->
|
|
<!-- <if test="invoiceEndTime != null">-->
|
|
<!-- -- and eo.INVOICE_DATE <= #{invoiceEndTime}-->
|
|
<!-- and eo.INVOICE_DATE <![CDATA[ < ]]> DATEADD(DAY, 1, #{invoiceEndTime})-->
|
|
<!-- </if>-->
|
|
|
|
<if test="businessUnit != null and businessUnit != ''">
|
|
and eo.BUSINESS_UNIT like concat('%', #{businessUnit}, '%')
|
|
</if>
|
|
<if test="orgName != null and orgName != ''">
|
|
and eo.ORG_NAME like concat('%', #{orgName}, '%')
|
|
</if>
|
|
<if test="organizationId != null ">
|
|
and eo.ORGANIZATION_ID = #{organizationId}
|
|
</if>
|
|
<if test="businessDocumentId != null ">
|
|
and eo.BUSINESS_DOCUMENT_ID = #{businessDocumentId}
|
|
</if>
|
|
|
|
<!-- 已修复:支持 单据号 OR 主订单号 模糊查询 -->
|
|
<if test="businessDocumentNumber != null and businessDocumentNumber != ''">
|
|
and (
|
|
eo.BUSINESS_DOCUMENT_NUMBER like concat('%', #{businessDocumentNumber}, '%')
|
|
or bdo.main_order_num like concat('%', #{businessDocumentNumber}, '%')
|
|
)
|
|
</if>
|
|
|
|
<if test="appointShipper != null and appointShipper != ''">
|
|
and eo.appoint_shipper like concat('%', #{appointShipper}, '%')
|
|
</if>
|
|
<if test="orderStatus != null and orderStatus != ''">
|
|
and eo.order_status = #{orderStatus}
|
|
</if>
|
|
<if test="organizationName != null and organizationName != ''">
|
|
and eo.ORGANIZATION_NAME like concat('%', #{organizationName}, '%')
|
|
</if>
|
|
|
|
</where>
|
|
</sql>
|
|
<update id="updateTmsOrderImage">
|
|
UPDATE NGWL_TEST_WLHY.TMS_TRANSPORT_NOTE
|
|
SET UNLOAD_IMAGE = #{pictureUrl},
|
|
UNLOAD_TIME = NOW(),
|
|
RECEIPT_TIME = NOW()
|
|
WHERE TRANSPORTATION_NUMBER IN (
|
|
SELECT GOODS_NUMBER
|
|
FROM NGWL_TEST_WLHY.TMS_ORDER
|
|
WHERE EXECUTE_ORDER_NUMBER = #{executeOrderNumber}
|
|
)
|
|
</update>
|
|
|
|
<select id="queryList" parameterType="com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO" resultMap="ExecuteOrderResult">
|
|
<include refid="selectExecuteOrderPo"/>
|
|
<include refid="selectExecuteOrderPo1"/>
|
|
order by lay_date desc, CREATE_TIME desc
|
|
</select>
|
|
<select id="getOrgNameByOrgId" resultType="java.lang.String">
|
|
select ORGANIZATION_NAME from NGWL_TEST_PRODUCT.SYS_ORGANIZATION where ORGANIZATION_ID=#{organizationId}
|
|
</select>
|
|
</mapper> |