|
@@ -3,7 +3,7 @@
|
|
|
<mapper namespace="com.steerinfo.dil.mapper.AmsDispatchSaleOrderMapper">
|
|
|
<resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsDispatchSaleOrder">
|
|
|
<id column="DISPATCH_ID" jdbcType="DECIMAL" property="dispatchId"/>
|
|
|
- <result column="SALE_ORDER_ID" jdbcType="DECIMAL" property="saleOrderId"/>
|
|
|
+ <result column="SALE_ORDER_MATERIAL_ID" jdbcType="DECIMAL" property="saleOrderMaterialId"/>
|
|
|
<result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId"/>
|
|
|
<result column="DISPATCH_TIME" jdbcType="TIMESTAMP" property="dispatchTime"/>
|
|
|
<result column="DISPATCH_DEAL_TIME" jdbcType="TIMESTAMP" property="dispatchDealTime"/>
|
|
@@ -12,14 +12,18 @@
|
|
|
<result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
|
|
|
<result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
<result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
|
|
|
+ <result column="DISPATCH_TYPE" jdbcType="DECIMAL" property="dispatchType"/>
|
|
|
+ <result column="DISPATCH_STATUS" jdbcType="DECIMAL" property="dispatchStatus"/>
|
|
|
</resultMap>
|
|
|
<sql id="columns">
|
|
|
- DISPATCH_ID, SALE_ORDER_ID, CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME, INSERT_USERNAME,
|
|
|
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
|
|
|
+ DISPATCH_ID, SALE_ORDER_MATERIAL_ID, CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME,
|
|
|
+ INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
|
|
|
+ DISPATCH_TYPE, DISPATCH_STATUS
|
|
|
</sql>
|
|
|
<sql id="columns_alias">
|
|
|
- t.DISPATCH_ID, t.SALE_ORDER_ID, t.CARRIER_ID, t.DISPATCH_TIME, t.DISPATCH_DEAL_TIME,
|
|
|
- t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
|
|
|
+ t.DISPATCH_ID, t.SALE_ORDER_MATERIAL_ID, t.CARRIER_ID, t.DISPATCH_TIME, t.DISPATCH_DEAL_TIME,
|
|
|
+ t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
|
|
|
+ t.DISPATCH_TYPE, t.DISPATCH_STATUS
|
|
|
</sql>
|
|
|
<sql id="select">
|
|
|
SELECT
|
|
@@ -36,8 +40,8 @@
|
|
|
<if test="dispatchId != null">
|
|
|
and DISPATCH_ID = #{dispatchId}
|
|
|
</if>
|
|
|
- <if test="saleOrderId != null">
|
|
|
- and SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ and SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
and CARRIER_ID = #{carrierId}
|
|
@@ -63,6 +67,12 @@
|
|
|
<if test="insertUpdateRemark != null and insertUpdateRemark != ''">
|
|
|
and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ and DISPATCH_TYPE = #{dispatchType}
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ and DISPATCH_STATUS = #{dispatchStatus}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<sql id="whereLike">
|
|
@@ -70,8 +80,8 @@
|
|
|
<if test="dispatchId != null">
|
|
|
and DISPATCH_ID = #{dispatchId}
|
|
|
</if>
|
|
|
- <if test="saleOrderId != null">
|
|
|
- and SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ and SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
and CARRIER_ID = #{carrierId}
|
|
@@ -97,6 +107,12 @@
|
|
|
<if test="insertUpdateRemark != null and insertUpdateRemark != ''">
|
|
|
and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ and DISPATCH_TYPE = #{dispatchType}
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ and DISPATCH_STATUS = #{dispatchStatus}
|
|
|
+ </if>
|
|
|
</where>
|
|
|
</sql>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
|
|
@@ -107,8 +123,8 @@
|
|
|
<delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
|
|
|
delete from AMS_DISPATCH_SALE_ORDER
|
|
|
where 1!=1
|
|
|
- <if test="saleOrderId != null">
|
|
|
- or SALE_ORDER_ID = #{saleOrderId}
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ or SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId}
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
or CARRIER_ID = #{carrierId}
|
|
@@ -134,17 +150,27 @@
|
|
|
<if test="insertUpdateRemark != null and insertUpdateRemark != ''">
|
|
|
or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ or DISPATCH_TYPE = #{dispatchType}
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ or DISPATCH_STATUS = #{dispatchStatus}
|
|
|
+ </if>
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
|
|
|
- insert into AMS_DISPATCH_SALE_ORDER (DISPATCH_ID, SALE_ORDER_ID, CARRIER_ID,
|
|
|
- DISPATCH_TIME, DISPATCH_DEAL_TIME, INSERT_USERNAME,
|
|
|
- INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
|
|
|
- INSERT_UPDATE_REMARK)
|
|
|
- values (#{dispatchId,jdbcType=DECIMAL}, #{saleOrderId,jdbcType=DECIMAL}, #{carrierId,jdbcType=DECIMAL},
|
|
|
- #{dispatchTime,jdbcType=TIMESTAMP}, #{dispatchDealTime,jdbcType=TIMESTAMP},
|
|
|
- #{insertUsername,jdbcType=VARCHAR},
|
|
|
- #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
|
|
- #{insertUpdateRemark,jdbcType=VARCHAR})
|
|
|
+ insert into AMS_DISPATCH_SALE_ORDER (DISPATCH_ID, SALE_ORDER_MATERIAL_ID,
|
|
|
+ CARRIER_ID, DISPATCH_TIME, DISPATCH_DEAL_TIME,
|
|
|
+ INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
|
|
|
+ UPDATE_TIME, INSERT_UPDATE_REMARK, DISPATCH_TYPE,
|
|
|
+ DISPATCH_STATUS)
|
|
|
+ values (#{dispatchId,jdbcType=DECIMAL}, #{saleOrderMaterialId,jdbcType=DECIMAL},
|
|
|
+ #{carrierId,jdbcType=DECIMAL}, #{dispatchTime,jdbcType=TIMESTAMP},
|
|
|
+ #{dispatchDealTime,jdbcType=TIMESTAMP},
|
|
|
+ #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
|
|
|
+ #{updateUsername,jdbcType=VARCHAR},
|
|
|
+ #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
|
|
|
+ #{dispatchType,jdbcType=DECIMAL},
|
|
|
+ #{dispatchStatus,jdbcType=DECIMAL})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
|
|
|
insert into AMS_DISPATCH_SALE_ORDER
|
|
@@ -152,8 +178,8 @@
|
|
|
<if test="dispatchId != null">
|
|
|
DISPATCH_ID,
|
|
|
</if>
|
|
|
- <if test="saleOrderId != null">
|
|
|
- SALE_ORDER_ID,
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ SALE_ORDER_MATERIAL_ID,
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
CARRIER_ID,
|
|
@@ -179,13 +205,19 @@
|
|
|
<if test="insertUpdateRemark != null">
|
|
|
INSERT_UPDATE_REMARK,
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ DISPATCH_TYPE,
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ DISPATCH_STATUS,
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="dispatchId != null">
|
|
|
#{dispatchId,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
- <if test="saleOrderId != null">
|
|
|
- #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ #{saleOrderMaterialId,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
#{carrierId,jdbcType=DECIMAL},
|
|
@@ -211,26 +243,34 @@
|
|
|
<if test="insertUpdateRemark != null">
|
|
|
#{insertUpdateRemark,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ #{dispatchType,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ #{dispatchStatus,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
|
|
|
update AMS_DISPATCH_SALE_ORDER
|
|
|
- set SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
|
|
|
- CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
|
|
|
- DISPATCH_TIME = #{dispatchTime,jdbcType=TIMESTAMP},
|
|
|
- DISPATCH_DEAL_TIME = #{dispatchDealTime,jdbcType=TIMESTAMP},
|
|
|
- INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
|
|
|
- INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
|
|
|
- UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
|
|
|
- UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
- INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
|
|
|
+ set SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId,jdbcType=DECIMAL},
|
|
|
+ CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
|
|
|
+ DISPATCH_TIME = #{dispatchTime,jdbcType=TIMESTAMP},
|
|
|
+ DISPATCH_DEAL_TIME = #{dispatchDealTime,jdbcType=TIMESTAMP},
|
|
|
+ INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
|
|
|
+ INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
|
|
|
+ UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
|
|
|
+ UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
|
|
|
+ INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
|
|
|
+ DISPATCH_TYPE = #{dispatchType,jdbcType=DECIMAL},
|
|
|
+ DISPATCH_STATUS = #{dispatchStatus,jdbcType=DECIMAL}
|
|
|
where DISPATCH_ID = #{dispatchId,jdbcType=DECIMAL}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsDispatchSaleOrder">
|
|
|
update AMS_DISPATCH_SALE_ORDER
|
|
|
<set>
|
|
|
- <if test="saleOrderId != null">
|
|
|
- SALE_ORDER_ID = #{saleOrderId,jdbcType=DECIMAL},
|
|
|
+ <if test="saleOrderMaterialId != null">
|
|
|
+ SALE_ORDER_MATERIAL_ID = #{saleOrderMaterialId,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="carrierId != null">
|
|
|
CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
|
|
@@ -256,6 +296,12 @@
|
|
|
<if test="insertUpdateRemark != null">
|
|
|
INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
+ <if test="dispatchType != null">
|
|
|
+ DISPATCH_TYPE = #{dispatchType,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
+ <if test="dispatchStatus != null">
|
|
|
+ DISPATCH_STATUS = #{dispatchStatus,jdbcType=DECIMAL},
|
|
|
+ </if>
|
|
|
</set>
|
|
|
where DISPATCH_ID = #{dispatchId,jdbcType=DECIMAL}
|
|
|
</update>
|
|
@@ -274,20 +320,21 @@
|
|
|
<insert id="batchInsert" parameterType="java.util.List">
|
|
|
insert into AMS_DISPATCH_SALE_ORDER
|
|
|
(DISPATCH_ID,
|
|
|
- SALE_ORDER_ID, CARRIER_ID, DISPATCH_TIME,
|
|
|
- DISPATCH_DEAL_TIME, INSERT_USERNAME,
|
|
|
- INSERT_TIME, UPDATE_USERNAME,
|
|
|
- UPDATE_TIME, INSERT_UPDATE_REMARK
|
|
|
- )
|
|
|
+ SALE_ORDER_MATERIAL_ID, CARRIER_ID,
|
|
|
+ DISPATCH_TIME, DISPATCH_DEAL_TIME,
|
|
|
+ INSERT_USERNAME, INSERT_TIME,
|
|
|
+ UPDATE_USERNAME, UPDATE_TIME,
|
|
|
+ INSERT_UPDATE_REMARK, DISPATCH_TYPE,
|
|
|
+ DISPATCH_STATUS)
|
|
|
( <foreach collection="list" item="item" separator="union all">
|
|
|
select
|
|
|
#{item.dispatchId,jdbcType=DECIMAL},
|
|
|
- #{item.saleOrderId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL},
|
|
|
- #{item.dispatchTime,jdbcType=TIMESTAMP},
|
|
|
- #{item.dispatchDealTime,jdbcType=TIMESTAMP}, #{item.insertUsername,jdbcType=VARCHAR},
|
|
|
- #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR},
|
|
|
- #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
|
|
|
- from dual
|
|
|
+ #{item.saleOrderMaterialId,jdbcType=DECIMAL}, #{item.carrierId,jdbcType=DECIMAL},
|
|
|
+ #{item.dispatchTime,jdbcType=TIMESTAMP}, #{item.dispatchDealTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.dispatchType,jdbcType=DECIMAL},
|
|
|
+ #{item.dispatchStatus,jdbcType=DECIMAL} from dual
|
|
|
</foreach> )
|
|
|
</insert>
|
|
|
<update id="batchUpdate" parameterType="java.util.List">
|
|
@@ -297,9 +344,9 @@
|
|
|
<foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
|
when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchId,jdbcType=DECIMAL}
|
|
|
</foreach>
|
|
|
- ,SALE_ORDER_ID=
|
|
|
+ ,SALE_ORDER_MATERIAL_ID=
|
|
|
<foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
|
- when #{item.dispatchId,jdbcType=DECIMAL} then #{item.saleOrderId,jdbcType=DECIMAL}
|
|
|
+ when #{item.dispatchId,jdbcType=DECIMAL} then #{item.saleOrderMaterialId,jdbcType=DECIMAL}
|
|
|
</foreach>
|
|
|
,CARRIER_ID=
|
|
|
<foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
@@ -333,6 +380,14 @@
|
|
|
<foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
|
when #{item.dispatchId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
|
|
|
</foreach>
|
|
|
+ ,DISPATCH_TYPE=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
|
+ when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchType,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
+ ,DISPATCH_STATUS=
|
|
|
+ <foreach collection="list" item="item" index="index" separator=" " open="case DISPATCH_ID" close="end">
|
|
|
+ when #{item.dispatchId,jdbcType=DECIMAL} then #{item.dispatchStatus,jdbcType=DECIMAL}
|
|
|
+ </foreach>
|
|
|
where DISPATCH_ID in
|
|
|
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
|
|
|
#{item.dispatchId,jdbcType=DECIMAL}
|
|
@@ -401,4 +456,33 @@
|
|
|
ON RM.MATERIAL_ID = ASTM.MATERIAL_ID
|
|
|
WHERE ADSO.DISPATCH_ID = #{dispatchId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <!-- 查询app端已抢的销售订单 -->
|
|
|
+ <select id="getLockDispatchSaleOrderList" parameterType="DECIMAL" resultType="java.util.Map">
|
|
|
+ SELECT ADSO.DISPATCH_ID AS "dispatchId",
|
|
|
+ ASOM.SALE_ORDER_MATERIAL_TRUCK_NO AS "saleOrderMaterialTruckNo",
|
|
|
+ ASO.SALE_NUMBER AS "saleNumber",
|
|
|
+ ADSO.DISPATCH_DEAL_TIME AS "dispatchDealTime",
|
|
|
+ RSH.SHIPPER_NAME AS "shipperName",
|
|
|
+ RC.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
|
|
|
+ RRA.ADDRESS_DELIVERY_ADDRESS AS "addressDeliveryAddress",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE AS "saleOrderConsignee",
|
|
|
+ ASOM.SALE_ORDER_CONSIGNEE_TEL AS "saleOrderConsigneeTel",
|
|
|
+ RCA.CARRIER_NAME AS "carrierName"
|
|
|
+ FROM AMS_DISPATCH_SALE_ORDER ADSO
|
|
|
+ LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
|
|
|
+ ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
|
|
|
+ LEFT JOIN AMS_SALE_ORDER ASO
|
|
|
+ ON ASO.SALE_ORDER_ID = ASOM.SALE_ORDER_ID
|
|
|
+ LEFT JOIN RMS_SHIPPER RSH
|
|
|
+ ON RSH.SHIPPER_ID = ASO.SHIPPER_ID
|
|
|
+ LEFT JOIN RMS_CONSIGNEE RC
|
|
|
+ ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
|
|
|
+ LEFT JOIN RMS_RECEIVE_ADDRESS RRA
|
|
|
+ ON ASOM.SALE_SHIPPING_ADDRESS_ID = RRA.ADDRESS_ID
|
|
|
+ LEFT JOIN RMS_CARRIER RCA
|
|
|
+ ON RCA.CARRIER_ID = ADSO.CARRIER_ID
|
|
|
+ WHERE ADSO.DISPATCH_STATUS = 1
|
|
|
+ AND ADSO.CARRIER_ID = #{carrierId}
|
|
|
+ </select>
|
|
|
</mapper>
|