UniversalMapper.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.steerinfo.dil.mapper.UniversalMapper">
  4. <sql id="orderBy">
  5. <if test="orderField != null and orderField != ''">
  6. order by "${orderField}"
  7. <if test="orderType != null and orderType != ''">
  8. ${orderType}
  9. </if>
  10. </if>
  11. </sql>
  12. <!-- 查询所有的汽车衡 -->
  13. <select id="getColumnNoRoutList" resultType="java.lang.String" parameterType="map">
  14. select DTCR.COLUMN_NAME from DIL_TABLE_COLUMN_ROLE DTCR
  15. left join DIL_ROLE_ORGCODE_TABLE DROT
  16. ON DTCR.PRIMARY_ID = DROT.COLUMN_ID
  17. WHERE
  18. DTCR.TABLE_NAME = #{tableName}
  19. <if test="orgCode != null">
  20. and DROT.ORG_CODE = #{orgCode}
  21. </if>
  22. </select>
  23. <select id="getColumnShowData" resultType="java.util.Map" parameterType="map">
  24. SELECT DTCR.COLUMN_NAME "key",
  25. DTCR.COLUMN_NAME "label"
  26. FROM DIL_TABLE_COLUMN_ROLE DTCR
  27. LEFT JOIN DIL_ROLE_ORGCODE_TABLE DROT on DTCR.PRIMARY_ID = DROT.COLUMN_ID
  28. WHERE
  29. DTCR.TABLE_NAME = #{tableName}
  30. <if test="userName != null">
  31. AND nvl(DROT.USER_NAME,'0') != #{userName}
  32. </if>
  33. <if test="schemeName != null">
  34. AND nvl(DROT.PRIMARY_NAME,'0') != #{schemeName}
  35. </if>
  36. </select>
  37. <select id="getColumnHiddenData" resultType="string" parameterType="map">
  38. SELECT DTCR.COLUMN_NAME FROM DIL_ROLE_ORGCODE_TABLE DROT
  39. LEFT JOIN DIL_TABLE_COLUMN_ROLE DTCR on DTCR.PRIMARY_ID = DROT.COLUMN_ID
  40. WHERE
  41. DTCR.TABLE_NAME = #{tableName}
  42. <if test="userName != null">
  43. AND DROT.USER_NAME = #{userName}
  44. </if>
  45. <if test="orgCode != null">
  46. AND DROT.ORG_CODE = #{orgCode}
  47. </if>
  48. <if test="schemeName != null">
  49. AND nvl(DROT.PRIMARY_NAME,'0') = #{schemeName}
  50. </if>
  51. </select>
  52. <select id="getColumnAllData" resultType="java.util.Map" parameterType="map">
  53. SELECT DTCR.COLUMN_NAME "key",
  54. DTCR.COLUMN_NAME "label"
  55. FROM DIL_TABLE_COLUMN_ROLE DTCR
  56. WHERE DTCR.TABLE_NAME = #{tableName}
  57. </select>
  58. <select id="getColumnAllScheme" resultType="java.util.LinkedHashMap" parameterType="map">
  59. SELECT distinct DROT.PRIMARY_NAME "schemeName",
  60. DROT.ENABLE_STATUS "enableStatus",
  61. DROT.USER_NAME "userName",
  62. DROT.ORG_CODE "orgCode",
  63. DTCR.TABLE_NAME "tableName"
  64. FROM DIL_ROLE_ORGCODE_TABLE DROT
  65. LEFT JOIN DIL_TABLE_COLUMN_ROLE DTCR on DROT.COLUMN_ID = DTCR.PRIMARY_ID
  66. WHERE DROT.USER_NAME = #{userName}
  67. AND DROT.ORG_CODE = #{orgCode}
  68. AND DTCR.TABLE_NAME = #{tableName}
  69. AND NVL(DROT.PRIMARY_NAME, '') != '默认方案'
  70. </select>
  71. <select id="getWlUrl" resultType="java.lang.String">
  72. SELECT DL.VERSION_VALUE
  73. FROM DIL_VERSION DL
  74. WHERE DL.VERSION_ID = 11
  75. </select>
  76. <!-- 边输边查公司 -->
  77. <select id="getCompanyMesByLike" resultType="java.util.Map">
  78. select * from(
  79. select
  80. RC.COMPANY_ID "companyId",
  81. RC.COMPANY_NAME "companyName",
  82. RC.COMPANY_TYPE "companyType",
  83. RC.SSO_ID "ssoId",
  84. RC.SSO_CODE "ssoCode",
  85. RC.COMPANY_ID "id",
  86. RC.COMPANY_ID "value",
  87. <if test="companyType==null">
  88. RC.COMPANY_TYPE || '-' ||
  89. </if>
  90. RC.COMPANY_NAME "label",
  91. RC.COMPANY_NAME "text"
  92. from RMS_COMPANY RC
  93. where DELETED = 0 )
  94. <where>
  95. <if test="companyType!=null and companyType!=''">
  96. AND "companyType" = #{companyType}
  97. </if>
  98. <if test="index!=null and index!=''">
  99. AND REGEXP_LIKE("label", #{index})
  100. </if>
  101. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  102. AND "id" in
  103. <foreach collection="id" item="item" open="(" close=")" separator="," >
  104. #{item}
  105. </foreach>
  106. </if>
  107. </where>
  108. FETCH NEXT 10 ROWS ONLY
  109. </select>
  110. <select id="getMaterialTypeByLike" resultType="java.util.Map">
  111. select * from(
  112. select
  113. MATERIAL_TYPE_ID "materialTypeId",
  114. MATERIAL_TYPE_NAME "materialTypeName",
  115. MATERIAL_TYPE_ID "id",
  116. MATERIAL_TYPE_ID "value",
  117. MATERIAL_TYPE_NAME "label",
  118. MATERIAL_TYPE_NAME "text",
  119. REMARK "remark"
  120. from RMS_MATERIAL_TYPE
  121. where DELETED = 0
  122. )
  123. <where>
  124. <if test="index!=null and index!=''">
  125. AND REGEXP_LIKE("label", #{index})
  126. </if>
  127. <if test="remark!=null and remark!=''">
  128. AND REGEXP_LIKE("remark", #{remark})
  129. </if>
  130. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  131. AND "id" in
  132. <foreach collection="id" item="item" open="(" close=")" separator="," >
  133. #{item}
  134. </foreach>
  135. </if>
  136. </where>
  137. FETCH NEXT 10 ROWS ONLY
  138. </select>
  139. <select id="getEmissionStandardByLike" resultType="java.util.Map">
  140. select * from (
  141. select
  142. EMISSION_STANDARD_ID "emissionStandardId",
  143. EMISSION_STANDARD_NAME "emissionStandardName",
  144. EMISSION_STANDARD_ID "id",
  145. EMISSION_STANDARD_ID "value",
  146. EMISSION_STANDARD_NAME "label",
  147. EMISSION_STANDARD_NAME "text"
  148. from RMS_EMISSION_STANDARD
  149. where DELETED = 0
  150. )
  151. <where>
  152. <if test="index!=null and index!=''">
  153. AND REGEXP_LIKE("label", #{index})
  154. </if>
  155. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  156. AND "id" in
  157. <foreach collection="id" item="item" open="(" close=")" separator="," >
  158. #{item}
  159. </foreach>
  160. </if>
  161. </where>
  162. FETCH NEXT 10 ROWS ONLY
  163. </select>
  164. <select id="getOperationPointByLike" resultType="java.util.Map">
  165. SELECT * FROM (
  166. select * from (
  167. select
  168. OPERATION_POINT_ID "operationPointId",
  169. OPERATION_POINT_NAME "operationPointName",
  170. OPERATION_POINT_TYPE "operationPointType",
  171. OPERATION_POINT_ID "id",
  172. OPERATION_POINT_ID "value",
  173. OPERATION_POINT_NAME "label",
  174. OPERATION_POINT_NAME "text"
  175. from RMS_OPERATION_POINT
  176. where DELETED = 0
  177. )
  178. <where>
  179. <if test="operationPointType!=null and operationPointType!=''">
  180. AND REGEXP_LIKE("operationPointType", #{operationPointType})
  181. </if>
  182. <if test="index!=null and index!=''">
  183. AND REGEXP_LIKE("label", #{index})
  184. </if>
  185. </where>
  186. FETCH NEXT 10 ROWS ONLY
  187. )
  188. <if test="id!=null and id.size>0">
  189. UNION select
  190. OPERATION_POINT_ID "operationPointId",
  191. OPERATION_POINT_NAME "operationPointName",
  192. OPERATION_POINT_TYPE "operationPointType",
  193. OPERATION_POINT_ID "id",
  194. OPERATION_POINT_ID "value",
  195. OPERATION_POINT_NAME "label",
  196. OPERATION_POINT_NAME "text"
  197. from RMS_OPERATION_POINT
  198. where OPERATION_POINT_ID in
  199. <foreach collection="id" item="item" open="(" close=")" separator="," >
  200. #{item}
  201. </foreach>
  202. </if>
  203. </select>
  204. <select id="getPersonnelByLike" resultType="java.util.Map">
  205. select * from (
  206. select
  207. PERSONNEL_ID "personnelId",
  208. PERSONNEL_NAME "personnelName",
  209. PERSONNEL_POST "personnelPost",
  210. PERSONNEL_ID "id",
  211. PERSONNEL_ID "value",
  212. PERSONNEL_NAME "label",
  213. PERSONNEL_NAME "text"
  214. from RMS_PERSONNEL
  215. where DELETED = 0
  216. )
  217. <where>
  218. <if test="personnelPost!=null and personnelPost!=''">
  219. AND "personnelPost" = #{personnelPost}
  220. </if>
  221. <if test="index!=null and index!=''">
  222. AND REGEXP_LIKE("label", #{index})
  223. </if>
  224. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  225. AND "id" in
  226. <foreach collection="id" item="item" open="(" close=")" separator="," >
  227. #{item}
  228. </foreach>
  229. </if>
  230. </where>
  231. FETCH NEXT 10 ROWS ONLY
  232. </select>
  233. <select id="getCapacityByLike" resultType="java.util.Map">
  234. select * from (
  235. SELECT DISTINCT
  236. RCA .CAPACITY_ID "capacityId",
  237. RCA .CAPACITY_ID "id",
  238. RCA .CAPACITY_ID "value",
  239. RCA .CAPACITY_NUMBER "label",
  240. RCA .CAPACITY_NUMBER "text"
  241. FROM RMS_CAPACITY RCA
  242. LEFT JOIN RMS_CAPACITY_CARRIER RCC ON RCA .CAPACITY_ID = RCC .CAPACITY_ID
  243. LEFT JOIN RMS_COMPANY RC ON RC .COMPANY_ID = RCC .COMPANY_ID
  244. LEFT JOIN RMS_CAPACITY_TYPE RCT ON RCA.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
  245. WHERE RCA .DELETED = 0
  246. <if test="orgCode!=null and orgCode !='' and roleCodes.contains('chengyunshang')">
  247. AND RC.SSO_CODE = #{orgCode}
  248. </if>
  249. <if test="capacityType != null and capacityType != '' ">
  250. AND RCT.CAPACITY_TYPE_NAME = #{capacityType}
  251. </if>
  252. <if test="capacityType == null">
  253. AND RCT.CAPACITY_TYPE_NAME != '火车'
  254. </if>
  255. )
  256. <where>
  257. <if test="index!=null and index!=''">
  258. AND REGEXP_LIKE("label", #{index})
  259. </if>
  260. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  261. AND "id" in
  262. <foreach collection="id" item="item" open="(" close=")" separator="," >
  263. #{item}
  264. </foreach>
  265. </if>
  266. </where>
  267. FETCH NEXT 10 ROWS ONLY
  268. </select>
  269. <select id="getrmsrmsjobinfosBylike" resultType="java.util.Map">
  270. select * from(
  271. select
  272. RC.JOB_ID "jboId",
  273. RC.JOB_NAME "jobName",
  274. RC.JOB_ID "id",
  275. RC.JOB_ID "value",
  276. RC.JOB_NAME "label",
  277. RC.JOB_NAME "text"
  278. from RMS_JOB_INFO RC
  279. where DELETED = 0
  280. )
  281. <where>
  282. <if test="index!=null and index!=''">
  283. AND REGEXP_LIKE("label", #{index})
  284. </if>
  285. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  286. AND "id" in
  287. <foreach collection="id" item="item" open="(" close=")" separator="," >
  288. #{item}
  289. </foreach>
  290. </if>
  291. </where>
  292. FETCH NEXT 10 ROWS ONLY
  293. </select>
  294. <select id="getTransRangeByLike" resultType="java.util.Map">
  295. select * from(
  296. select
  297. RC.TRANS_RANGE_ID "transrangeId",
  298. RC.TRANS_RANGE_NAME "transrangeName",
  299. RC.TRANS_RANGE_ID "id",
  300. RC.TRANS_RANGE_ID "value",
  301. RC.TRANS_RANGE_NAME "label",
  302. RC.TRANS_RANGE_NAME "text",
  303. rc.START_POINT_ID "shippingPointId",
  304. rc.END_POINT_ID "receivingPointId"
  305. from RMS_TRANS_RANGE RC
  306. where DELETED = 0
  307. )
  308. <where>
  309. <if test="index!=null and index!=''">
  310. AND REGEXP_LIKE("label", #{index})
  311. </if>
  312. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  313. AND "id" in
  314. <foreach collection="id" item="item" open="(" close=")" separator="," >
  315. #{item}
  316. </foreach>
  317. </if>
  318. </where>
  319. FETCH NEXT 10 ROWS ONLY
  320. </select>
  321. <select id="getCategoryCodeByLike" resultType="java.util.Map">
  322. select * from(
  323. select
  324. RC.RULES_ID "rulesId",
  325. RC.RULES_CODE "rulesCode",
  326. RC.RULES_ID "id",
  327. RC.RULES_ID "value",
  328. RC.RULES_CODE "label",
  329. RC.RULES_CODE "text"
  330. from RMS_DEMAND_RULES RC
  331. where DELETED = 0
  332. )
  333. <where>
  334. <if test="index!=null and index!=''">
  335. AND REGEXP_LIKE("label", #{index})
  336. </if>
  337. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  338. AND "id" in
  339. <foreach collection="id" item="item" open="(" close=")" separator="," >
  340. #{item}
  341. </foreach>
  342. </if>
  343. </where>
  344. FETCH NEXT 10 ROWS ONLY
  345. </select>
  346. <select id="getCapacityTypeByLike" resultType="java.util.Map">
  347. select DISTINCT * from(
  348. select
  349. RCT.CAPACITY_TYPE_ID "capacityTypeId",
  350. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  351. RCT.CAPACITY_TYPE_ID "id",
  352. RCT.CAPACITY_TYPE_ID "value",
  353. RCT.CAPACITY_TYPE_NAME "label",
  354. RCT.CAPACITY_TYPE_NAME "text"
  355. RCT .CAPACITY_MAX_LOAD "capacityMaxLoad",
  356. '[' || listagg (RCFT .FUEL_TYPE_ID, ',') WITHIN GROUP (ORDER BY RCT .CAPACITY_TYPE_ID) || ']' "fuelTypeIds",
  357. listagg (RFT .FUEL_TYPE_NAME, '/') WITHIN GROUP (ORDER BY RCT .CAPACITY_TYPE_ID) "fuelTypes"
  358. from RMS_CAPACITY_TYPE RCT
  359. LEFT JOIN RMS_CAPACITY_FUEL_TYPE RCFT ON RCFT.CAPACITY_TYPE_ID = RCT .CAPACITY_TYPE_ID
  360. LEFT JOIN RMS_FUEL_TYPE RFT ON RFT .FUEL_TYPE_ID = RCFT.FUEL_TYPE_ID
  361. where RCT.DELETED=0
  362. GROUP BY RCT .CAPACITY_TYPE_ID,RCT.CAPACITY_TYPE_NAME,RCT .CAPACITY_MAX_LOAD
  363. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  364. UNION
  365. select
  366. RCT.CAPACITY_TYPE_ID "capacityTypeId",
  367. RCT.CAPACITY_TYPE_NAME "capacityTypeName",
  368. RCT.CAPACITY_TYPE_ID "id",
  369. RCT.CAPACITY_TYPE_ID "value",
  370. RCT.CAPACITY_TYPE_NAME "label",
  371. RCT.CAPACITY_TYPE_NAME "text"
  372. RCT .CAPACITY_MAX_LOAD "capacityMaxLoad",
  373. '[' || listagg (RCFT .FUEL_TYPE_ID, ',') WITHIN GROUP (ORDER BY RCT .CAPACITY_TYPE_ID) || ']' "fuelTypeIds",
  374. listagg (RFT .FUEL_TYPE_NAME, '/') WITHIN GROUP (ORDER BY RCT .CAPACITY_TYPE_ID) "fuelTypes"
  375. from RMS_CAPACITY_TYPE RCT
  376. LEFT JOIN RMS_CAPACITY_FUEL_TYPE RCFT ON RCFT.CAPACITY_TYPE_ID = RCT .CAPACITY_TYPE_ID
  377. LEFT JOIN RMS_FUEL_TYPE RFT ON RFT .FUEL_TYPE_ID = RCFT.FUEL_TYPE_ID
  378. where RCT.DELETED=0
  379. GROUP BY RCT .CAPACITY_TYPE_ID,RCT.CAPACITY_TYPE_NAME,RCT .CAPACITY_MAX_LOAD
  380. WHERE "id" in
  381. <foreach collection="id" item="item" open="(" close=")" separator="," >
  382. #{item}
  383. </foreach>
  384. </if>
  385. )
  386. <where>
  387. <if test="index!=null and index!=''">
  388. AND REGEXP_LIKE("label", #{index})
  389. </if>
  390. </where>
  391. FETCH NEXT 10 ROWS ONLY
  392. </select>
  393. <select id="getLineByLike" resultType="java.util.Map">
  394. select * from(
  395. select
  396. RL.LINE_ID "lineId",
  397. RL.LINE_NAME "lineName",
  398. RL.LINE_ID "id",
  399. RL.LINE_ID "value",
  400. RL.LINE_NAME "label",
  401. RL.LINE_NAME "text",
  402. NVL(RL_TEMP."points",'无') "points",
  403. RL.LINE_TYPE "lineType"
  404. from RMS_LINE RL
  405. LEFT JOIN
  406. (
  407. SELECT
  408. RLS .LINE_ID "lineId",
  409. listagg (DISTINCT ROP .OPERATION_POINT_NAME, ',') WITHIN GROUP (ORDER BY RLS .LINE_ID) "points"
  410. FROM
  411. RMS_LINE_STEP RLS
  412. LEFT JOIN RMS_STEP_POINT RSP
  413. ON RLS .STEP_ID = RSP .STEP_ID
  414. LEFT JOIN RMS_OPERATION_POINT ROP
  415. ON RSP .OPERATION_POINT_ID = ROP .OPERATION_POINT_ID
  416. GROUP BY RLS .LINE_ID
  417. ) RL_TEMP ON RL_TEMP ."lineId" = RL .LINE_ID
  418. where DELETED = 0
  419. )
  420. <where>
  421. <if test="index!=null and index!=''">
  422. AND REGEXP_LIKE("label" || "points", #{index})
  423. </if>
  424. <if test="lineType!=null and lineType!=''">
  425. AND REGEXP_LIKE("lineType" , #{lineType})
  426. </if>
  427. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  428. AND "id" in
  429. <foreach collection="id" item="item" open="(" close=")" separator="," >
  430. #{item}
  431. </foreach>
  432. </if>
  433. </where>
  434. FETCH NEXT 10 ROWS ONLY
  435. </select>
  436. <select id="getMaterialByLike" resultType="java.util.Map">
  437. select * from(
  438. select
  439. RC.MATERIAL_ID "materialId",
  440. RC.MATERIAL_NAME "materialName",
  441. RC.MATERIAL_ID "id",
  442. RC.MATERIAL_ID "value",
  443. RC.MATERIAL_NAME "label",
  444. RC.MATERIAL_NAME "text"
  445. from RMS_MATERIAL RC
  446. where DELETED = 0
  447. )
  448. <where>
  449. <if test="index!=null and index!=''">
  450. AND REGEXP_LIKE("label", #{index})
  451. </if>
  452. <if test="id!=null and id.size>0 and !(index!=null and index!='')">
  453. AND "id" in
  454. <foreach collection="id" item="item" open="(" close=")" separator="," >
  455. #{item}
  456. </foreach>
  457. </if>
  458. </where>
  459. FETCH NEXT 10 ROWS ONLY
  460. </select>
  461. <select id="countTrainLoad" resultType="java.lang.Integer">
  462. SELECT COUNT(*)
  463. FROM TMS_LOAD_RESULT TLR
  464. LEFT JOIN OMS_TRANS_ORDER OTO ON TLR .TRANS_ORDER_ID =OTO .TRANS_ORDER_ID
  465. LEFT JOIN OMS_ORDER_CHILD OOC ON OOC .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
  466. LEFT JOIN AMS_PLAN_CHILD APC ON APC.PLAN_CHILD_ID = OOC.PLAN_CHILD_ID
  467. LEFT JOIN AMS_REQUIREMENT_CHILD ARC ON ARC.REQUIREMENT_CHILD_ID = APC.REQUIREMENT_CHILD_ID
  468. LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
  469. <where>
  470. OTO.DELETED != 1
  471. AND ATR.SERIAL_NUMBER =#{requirementNumber}
  472. AND TLR.LOAD_START_TIME = to_date(#{loadTime}, 'yyyymmdd')
  473. AND OTO.CAPACITY_ID IN
  474. <foreach collection="list" item="item" open="(" close=")" separator="," >
  475. #{item.车号}
  476. </foreach>
  477. </where>
  478. </select>
  479. <select id="getBusinessTypeLike" resultType="java.util.Map">
  480. select * from(
  481. select
  482. DBT.BUSINESS_TYPE_ID "businessTypeId",
  483. DBT.BUSINESS_TYPE_ID "id",
  484. DBT.BUSINESS_TYPE_ID "value",
  485. DBT.BUSINESS_TYPE_NAME "text",
  486. DBT.BUSINESS_TYPE_NAME "businessTypeName",
  487. DBT.BUSINESS_SCENE "businessScene",
  488. DBT.BUSINESS_TYPE_NAME "label",
  489. DBT.ALTERNATE_FIELDS1 "transportType",
  490. DBT.ALTERNATE_FIELDS2 "materialTypeName"
  491. from DIL_BUSINESS_TYPE DBT
  492. )
  493. <where>
  494. <if test="index!=null and index!=''">
  495. AND REGEXP_LIKE("label", #{index})
  496. </if>
  497. <if test="businessType!=null and businessType!=''">
  498. AND "businessTypeId" = #{businessType}
  499. </if>
  500. <if test="businessScene!=null and businessScene!=''">
  501. AND "businessScene" = #{businessScene}
  502. </if>
  503. <if test="transportType!=null and transportType!=''">
  504. AND REGEXP_LIKE("transportType", #{transportType})
  505. </if>
  506. <if test="materialTypeName!=null and materialTypeName!=''">
  507. AND REGEXP_LIKE("materialTypeName", #{materialTypeName})
  508. </if>
  509. <if test="id!=null and id.size > 0 and !(index!=null and index!='')">
  510. AND "id" in
  511. <foreach collection="id" item="item" open="(" close=")" separator="," >
  512. #{item}
  513. </foreach>
  514. </if>
  515. </where>
  516. FETCH NEXT 10 ROWS ONLY
  517. </select>
  518. <select id="findTrainWeight" resultType="java.util.Map">
  519. <foreach collection="list" item="item" separator=" UNION " >
  520. SELECT OTO .TRANS_ORDER_ID "transOrderId",
  521. TWR .RESULT_ID "resultId",
  522. #{item.车号} "capacityId",
  523. #{item.净重} "netWeight",
  524. #{item.皮重} "tareWeight",
  525. #{item.毛重} "grossWeight"
  526. FROM OMS_TRANS_ORDER OTO
  527. LEFT JOIN TMS_WEIGHT_RESULT TWR
  528. ON TWR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TWR.NET_WEIGHT_TIME = to_date(#{weightTime}, 'yyyymmdd')
  529. LEFT JOIN OMS_ORDER_CHILD OOC ON OOC .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
  530. LEFT JOIN AMS_PLAN_CHILD APC ON APC.PLAN_CHILD_ID = OOC.PLAN_CHILD_ID
  531. LEFT JOIN AMS_REQUIREMENT_CHILD ARC ON ARC.REQUIREMENT_CHILD_ID = APC.REQUIREMENT_CHILD_ID
  532. LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
  533. <where>
  534. OTO.DELETED != 1
  535. AND ATR.SERIAL_NUMBER =#{requirementNumber}
  536. AND OTO.CAPACITY_ID = #{item.车号}
  537. </where>
  538. </foreach>
  539. </select>
  540. <select id="findTrainUnload" resultType="java.util.Map">
  541. <foreach collection="list" item="item" separator=" UNION " >
  542. SELECT OTO .TRANS_ORDER_ID "transOrderId",
  543. TUR .RESULT_ID "resultId",
  544. #{item.车号} "capacityId",
  545. #{item.净重} "unloadWeight"
  546. FROM OMS_TRANS_ORDER OTO
  547. LEFT JOIN TMS_UNLOAD_RESULT TUR
  548. ON TUR .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID AND TUR.UNLOAD_START_TIME = to_date(#{unloadTime}, 'yyyymmdd')
  549. LEFT JOIN OMS_ORDER_CHILD OOC ON OOC .TRANS_ORDER_ID = OTO .TRANS_ORDER_ID
  550. LEFT JOIN AMS_PLAN_CHILD APC ON APC.PLAN_CHILD_ID = OOC.PLAN_CHILD_ID
  551. LEFT JOIN AMS_REQUIREMENT_CHILD ARC ON ARC.REQUIREMENT_CHILD_ID = APC.REQUIREMENT_CHILD_ID
  552. LEFT JOIN AMS_TRANS_REQUIREMENT ATR ON ATR.TRANS_REQUIREMENT_ID = ARC.TRANS_REQUIREMENT_ID
  553. <where>
  554. OTO.DELETED != 1
  555. AND ATR.SERIAL_NUMBER =#{requirementNumber}
  556. AND OTO.CAPACITY_ID = #{item.车号}
  557. </where>
  558. </foreach>
  559. </select>
  560. <select id="getOrderIds" resultType="java.util.Map">
  561. SELECT oto.TRANS_ORDER_ID FROM OMS_TRANS_ORDER OTO
  562. left join RMS_PERSONNEL RP
  563. on rp.PERSONNEL_ID = oto.DRIVER_ID
  564. left join RMS_PERSONNEL RP2
  565. on RP2.PERSONNEL_ID = oto.DRIVER_ID2
  566. where (rp.PERSONNEL_JOB_NUMBER = #{jobNumber}
  567. or rp2.PERSONNEL_JOB_NUMBER = #{jobNumber})
  568. and oto.deleted = 5
  569. </select>
  570. <select id="getFuelTypeByLike" resultType="java.util.Map">
  571. select * from(
  572. SELECT
  573. FUEL_TYPE_ID "fuelTypeId",
  574. FUEL_TYPE_NAME "fuelTypeName",
  575. FUEL_TYPE_ID "id",
  576. FUEL_TYPE_ID "value",
  577. FUEL_TYPE_NAME "text",
  578. FUEL_TYPE_NAME "label"
  579. FROM RMS_FUEL_TYPE
  580. WHERE DELETED = 0
  581. <if test="id!=null and id.size > 0 and !(index!=null and index!='')">
  582. UNION
  583. SELECT
  584. FUEL_TYPE_ID "fuelTypeId",
  585. FUEL_TYPE_NAME "fuelTypeName",
  586. FUEL_TYPE_ID "id",
  587. FUEL_TYPE_ID "value",
  588. FUEL_TYPE_NAME "text",
  589. FUEL_TYPE_NAME "label"
  590. FROM RMS_FUEL_TYPE
  591. WHERE FUEL_TYPE_ID in
  592. <foreach collection="id" item="item" open="(" close=")" separator="," >
  593. #{item}
  594. </foreach>
  595. </if>
  596. )
  597. <where>
  598. <if test="index!=null and index!=''">
  599. AND REGEXP_LIKE("label", #{index})
  600. </if>
  601. </where>
  602. FETCH NEXT 10 ROWS ONLY
  603. </select>
  604. <select id="getDemandRulesCode" resultType="java.util.Map">
  605. SELECT * FROM (
  606. SELECT RDB.BILLING_TYPE "billingType",
  607. RDB.BUSINESS_TYPE "businessType",
  608. rdb.LINE_ID "lineId",
  609. RDB.CAPACITY_TYPE_ID "capacityTypeId",
  610. RDB.MATERIAL_TYPE_ID "operationsNameId",
  611. RDB.TRANS_RANGE_ID "operationRange",
  612. rdb.COMPANY_ID "businessCompanyId",
  613. RDB.RULES_ID "value",
  614. RDB.RULES_CODE "label",
  615. ROP.OPERATION_POINT_ID "shippingPointId",
  616. ROP2.OPERATION_POINT_ID "receivingPointId"
  617. FROM RMS_DEMAND_RULES RDB
  618. LEFT JOIN RMS_TRANS_RANGE RTR
  619. ON RTR.TRANS_RANGE_ID = RDB.TRANS_RANGE_ID
  620. LEFT JOIN RMS_OPERATION_POINT ROP
  621. ON ROP.OPERATION_POINT_ID = RTR.START_POINT_ID
  622. LEFT JOIN RMS_OPERATION_POINT ROP2
  623. ON ROP2.OPERATION_POINT_ID = RTR.END_POINT_ID
  624. )
  625. <where>
  626. <if test="index!=null and index!=''">
  627. AND REGEXP_LIKE("label", #{index})
  628. </if>
  629. </where>
  630. </select>
  631. </mapper>