ShipDynamicsMapper.xml 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.ShipDynamicsMapper">
  4. <!-- 获取数据 -->
  5. <select id="selectAll" resultType="java.util.Map" parameterType="java.util.Map">
  6. select *
  7. from (
  8. select db.BATCH_ID "batchId",
  9. db.result_foreign_ship_name "shipName",
  10. rm.material_name "materialName",
  11. actr.result_date_of_loans "tonnage",
  12. actr.RESULT_NUMBER_OF_LOANS "dateOfLoans",
  13. rp.port_name "numberOfLoans",
  14. wgm.gm_tonnage "portName",
  15. rc.capacity_number "capacity",
  16. tlsr.RESULT_ACTUAL_INSTALLATIONS "capacityNumber",
  17. tlsr.RESULT_OUT_PORT_TIME "outPortTime",
  18. tsl.LOCATION_STATUS "locationStatus",
  19. tsl.LOCATION_VALUE "locationValue",
  20. tsl.LOCATION_ROUTE_TIME "localtionRouteTime"
  21. from DIL_BATCH db
  22. join rms_material rm on db.material_id = rm.material_id
  23. left join AMSSHIP_CARGO_TRANSFER_RESULT actr on db.batch_id = actr.batch_id
  24. left join AMSSHIP_DELIVERY_NOTICE adn on adn.batch_id = db.batch_id
  25. left join rms_port rp on rp.port_id = adn.port_id
  26. left join (select *
  27. from WMSH_GRID_MATERIAL wgm
  28. where wgm.GM_ID in
  29. (SELECT wgm.GM_ID
  30. FROM (
  31. SELECT wgm.GM_ID,
  32. wgm.BATCH_ID,
  33. wgm.INSERT_TIME,
  34. ROW_NUMBER() OVER (
  35. PARTITION BY wgm.BATCH_ID
  36. ORDER BY wgm.INSERT_TIME DESC
  37. ) AS rn
  38. FROM WMSH_GRID_MATERIAL wgm
  39. ) wgm
  40. WHERE rn = 1)) wgm on wgm.batch_id = db.batch_id
  41. left join TMSSHIP_LOAD_SHIP_RESULT tlsr on db.batch_id = tlsr.batch_id
  42. left join tmsship_total_result ttr on ttr.result_id = tlsr.TOTAL_RESULT_ID
  43. left join omsship_instructions_capacity oic on ttr.order_id = oic.instructions_capacity_id
  44. left join rms_capacity rc on oic.capacity_id = rc.capacity_id
  45. left join (select *
  46. from tmsship_ship_location t
  47. where t.location_id in
  48. (SELECT t.location_id
  49. FROM (
  50. SELECT t.location_id,
  51. t.total_result_id,
  52. t.location_route_time,
  53. ROW_NUMBER() OVER (
  54. PARTITION BY t.total_result_id
  55. ORDER BY t.location_route_time DESC
  56. ) AS rn
  57. FROM tmsship_ship_location t
  58. ) t
  59. WHERE rn = 1)) tsl on tsl.total_result_id = ttr.result_id
  60. where ttr.ship_status = 0
  61. )
  62. where "locationValue" is not null
  63. </select>
  64. <select id="selectByshipName" resultType="java.util.Map" parameterType="java.util.Map">
  65. select sd.GM_TONNAGE as "tonnage",
  66. sd.RESULT_DATE_OF_LOANS as "dateOfLoans",
  67. sd.RESULT_NUMBER_OF_LOANS as "numberOfLoans",
  68. sd.PORT_NAME as "portName",
  69. sd.CAPACITY_NUMBER as "capacity",
  70. sd.RESULT_ACTUAL_INSTALLATIONS as "capacityNumber",
  71. sd.RESULT_OUT_PORT_TIME as "outPortTime",
  72. sd.LOCATION_VALUE as "locationValue",
  73. sd.LOCATION_STATUS as "locationStatus"
  74. from SHIP_DYNAMICS sd where sd.RESULT_FOREIGN_SHIP_NAME=#{shipName} and sd.MATERIAL_NAME=#{materialName} and sd.LOCATION_STATUS is not null
  75. </select>
  76. </mapper>