|
|
@@ -411,6 +411,148 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getCapacityByLike" resultType="java.util.Map">
|
|
|
+ select * from (
|
|
|
+ select * from (
|
|
|
+ SELECT DISTINCT
|
|
|
+ RCA .CAPACITY_ID "capacityId",
|
|
|
+ RCA .CAPACITY_ID "id",
|
|
|
+ RCA .CAPACITY_ID "value",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "label",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "text",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "remark1",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "capacityNumber",
|
|
|
+ (case
|
|
|
+ when oto.capacity_id is null then '空闲'
|
|
|
+ when oto.deleted != '2' and oto.capacity_id is not null then '已派'
|
|
|
+ end) "status",
|
|
|
+ 'capacityNumber' "prop"
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ ,NVL(T ."countNumber",0) "countNumber"
|
|
|
+ </if>
|
|
|
+ FROM
|
|
|
+ RMS_CAPACITY RCA
|
|
|
+ LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
|
|
|
+ LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
|
|
|
+ LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
|
|
|
+ left join oms_trans_order oto
|
|
|
+ on RCA.capacity_id = oto.capacity_id
|
|
|
+ and oto.deleted != 2
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT CAPACITY_ID "capacityId",
|
|
|
+ COUNT( CAPACITY_ID ) "countNumber"
|
|
|
+ FROM OMS_TRANS_ORDER
|
|
|
+ <where>
|
|
|
+ <if test="driverId!=null and driverId!=''">
|
|
|
+ AND (DRIVER_ID = #{driverId} OR DRIVER_ID2 = #{driverId})
|
|
|
+ </if>
|
|
|
+ <if test="driverId2!=null and driverId2!=''">
|
|
|
+ AND DRIVER_ID = #{driverId2} OR DRIVER_ID2 = #{driverId2}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY CAPACITY_ID
|
|
|
+ ) T ON T."capacityId" = RCA .CAPACITY_ID
|
|
|
+ </if>
|
|
|
+ WHERE RCA .DELETED = 0
|
|
|
+ <if test="orgCode!=null and orgCode !='' and roleCodes.contains('chengYunShang')">
|
|
|
+ AND RC.SSO_CODE = #{orgCode}
|
|
|
+ </if>
|
|
|
+ <if test="capacityType != null and capacityType != '' ">
|
|
|
+ AND RCT.CAPACITY_TYPE_NAME = #{capacityType}
|
|
|
+ </if>
|
|
|
+ <if test="capacityType == null">
|
|
|
+ AND RCT.CAPACITY_TYPE_NAME != '火车'
|
|
|
+ </if>
|
|
|
+ <if test="index!=null and index!=''">
|
|
|
+ AND REGEXP_LIKE(
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end, #{index}
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="capacityId!=null and capacityId!=''">
|
|
|
+ AND RCA .CAPACITY_ID = #{capacityId}
|
|
|
+ </if>
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ ORDER BY "countNumber" DESC
|
|
|
+ </if>
|
|
|
+ FETCH NEXT 10 ROWS ONLY
|
|
|
+ )
|
|
|
+ <if test="id!=null and id.size>0">
|
|
|
+ UNION
|
|
|
+ SELECT DISTINCT
|
|
|
+ RCA .CAPACITY_ID "capacityId",
|
|
|
+ RCA .CAPACITY_ID "id",
|
|
|
+ RCA .CAPACITY_ID "value",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "label",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "text",
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA.CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end "remark1",
|
|
|
+ RCA.CAPACITY_NUMBER "capacityNumber",
|
|
|
+ (case
|
|
|
+ when oto.capacity_id is null then '空闲'
|
|
|
+ when oto.deleted != '2' and oto.capacity_id is not null then '已派'
|
|
|
+ end) "status",
|
|
|
+ 'capacityNumber' "prop"
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ ,NVL(T ."countNumber",0) "countNumber"
|
|
|
+ </if>
|
|
|
+ FROM RMS_CAPACITY RCA
|
|
|
+ LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
|
|
|
+ LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
|
|
|
+ LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
|
|
|
+ left join oms_trans_order oto
|
|
|
+ on RCA.capacity_id = oto.capacity_id
|
|
|
+ and oto.deleted != 2
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT CAPACITY_ID "capacityId",
|
|
|
+ COUNT( CAPACITY_ID ) "countNumber"
|
|
|
+ FROM OMS_TRANS_ORDER
|
|
|
+ <where>
|
|
|
+ <if test="driverId!=null and driverId!=''">
|
|
|
+ AND (DRIVER_ID = #{driverId} OR DRIVER_ID2 = #{driverId})
|
|
|
+ </if>
|
|
|
+ <if test="driverId2!=null and driverId2!=''">
|
|
|
+ AND DRIVER_ID = #{driverId2} OR DRIVER_ID2 = #{driverId2}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY CAPACITY_ID
|
|
|
+ ) T ON T."capacityId" = RCA .CAPACITY_ID
|
|
|
+ </if>
|
|
|
+ WHERE RCA .CAPACITY_ID in
|
|
|
+ <foreach collection="id" item="item" open="(" close=")" separator="," >
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ <if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
+ ORDER BY "countNumber" DESC
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCapacityByLikeSc" resultType="java.util.Map">
|
|
|
select * from (
|
|
|
select * from (
|
|
|
SELECT DISTINCT
|
|
|
@@ -419,7 +561,13 @@
|
|
|
RCA .CAPACITY_ID "value",
|
|
|
RCA .CAPACITY_NUMBER "label",
|
|
|
RCA .CAPACITY_NUMBER "text",
|
|
|
+ RCA .REMARK1 "remark1",
|
|
|
RCA.CAPACITY_NUMBER "capacityNumber",
|
|
|
+ (case
|
|
|
+ when oto.capacity_id is null then '空闲'
|
|
|
+ when oto.deleted != '2' and oto.capacity_id is not null then '已派'
|
|
|
+ when oto.deleted = '2' and oto.capacity_id is not null then '空闲'
|
|
|
+ end) "status",
|
|
|
'capacityNumber' "prop"
|
|
|
<if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
,NVL(T ."countNumber",0) "countNumber"
|
|
|
@@ -429,6 +577,8 @@
|
|
|
LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
|
|
|
LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
|
|
|
LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
|
|
|
+ left join oms_trans_order oto
|
|
|
+ on RCA.capacity_id = oto.capacity_id
|
|
|
<if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
LEFT JOIN (
|
|
|
SELECT CAPACITY_ID "capacityId",
|
|
|
@@ -456,7 +606,12 @@
|
|
|
AND RCT.CAPACITY_TYPE_NAME != '火车'
|
|
|
</if>
|
|
|
<if test="index!=null and index!=''">
|
|
|
- AND REGEXP_LIKE(RCA .CAPACITY_NUMBER, #{index})
|
|
|
+ AND REGEXP_LIKE(
|
|
|
+ CASE WHEN RCA.REMARK1 is null
|
|
|
+ then RCA .CAPACITY_NUMBER
|
|
|
+ else RCA.REMARK1
|
|
|
+ end, #{index}
|
|
|
+ )
|
|
|
</if>
|
|
|
<if test="capacityId!=null and capacityId!=''">
|
|
|
AND RCA .CAPACITY_ID = #{capacityId}
|
|
|
@@ -472,9 +627,15 @@
|
|
|
RCA .CAPACITY_ID "capacityId",
|
|
|
RCA .CAPACITY_ID "id",
|
|
|
RCA .CAPACITY_ID "value",
|
|
|
- RCA .CAPACITY_NUMBER "label",
|
|
|
- RCA .CAPACITY_NUMBER "text",
|
|
|
+ RCA .REMARK1 "label",
|
|
|
+ RCA .REMARK1 "text",
|
|
|
+ RCA .REMARK1 "remark1",
|
|
|
RCA.CAPACITY_NUMBER "capacityNumber",
|
|
|
+ (case
|
|
|
+ when oto.capacity_id is null then '空闲'
|
|
|
+ when oto.deleted != '2' and oto.capacity_id is not null then '已派'
|
|
|
+ when oto.deleted = '2' and oto.capacity_id is not null then '空闲'
|
|
|
+ end) "status",
|
|
|
'capacityNumber' "prop"
|
|
|
<if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
,NVL(T ."countNumber",0) "countNumber"
|
|
|
@@ -483,6 +644,8 @@
|
|
|
LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
|
|
|
LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
|
|
|
LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
|
|
|
+ left join oms_trans_order oto
|
|
|
+ on RCA.capacity_id = oto.capacity_id
|
|
|
<if test="(driverId!=null and driverId!='') or (driverId2!=null and driverId2!='')">
|
|
|
LEFT JOIN (
|
|
|
SELECT CAPACITY_ID "capacityId",
|