CommonMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.shanghaichengdi.ghjgitem.mapper.CommonMapper">
  6. <select id="selectAisRealTimeXYList" resultType="com.shanghaichengdi.ghjgitem.vo.BoatAISVo">
  7. select k.DEVICEID,i.SHIP_NAME_CN BOATNAME,i.SHIP_NAME_EN
  8. boatNameEn,i.SHIP_LENGTH,i.SHIP_BREADTH,i.SHIP_DEPTH,
  9. k.VELOCITY,k.DIRECTION,k.GPSTIME,k.LATITUDE,k.LONGITUDE,k.mapx,k.mapy
  10. from GHJG_DYNAMIC.VW_GPSINFO_REALTIME k
  11. left join ghjg_basics.mvw_boat_info i on i.mmsi = k.DEVICEID
  12. where 1=1
  13. <if test="deviceId != '' and deviceId != null">
  14. and k.DEVICEID = #{deviceId}
  15. </if>
  16. <if test="startTime != '' and startTime != null and endTime != '' and endTime != null">
  17. and k.GPSTIME >= to_date(#{startTime},'yyyy-mm-dd hh24:mi:ss')
  18. and k.GPSTIME &lt;= to_date(#{endTime},'yyyy-mm-dd hh24:mi:ss')
  19. </if>
  20. and k.mapx > #{minX} and k.mapx &lt; #{maxX}
  21. and k.mapy > #{minY} and k.mapy &lt; #{maxY}
  22. order by k.GPSTIME desc
  23. </select>
  24. <select id="getLastInformNo" resultType="String">
  25. select max(t.docnumber) code
  26. from GHJG_DYNAMIC.BUSINESS_SUPERVISION_INFORM t
  27. where t.docnumber like #{rules} || '%'
  28. </select>
  29. <select id="getLastRecordNo" resultType="String">
  30. select max(t.supervisionnumber) code
  31. from GHJG_DYNAMIC.BUSINESS_SUPERVISION_record t
  32. where t.supervisionnumber like #{rules} || '%'
  33. </select>
  34. <select id="selectCargoDeclareInfo"
  35. resultType="com.shanghaichengdi.ghjgitem.vo.CCbCargoDeclareRecVo">
  36. select t.goods_id goodsId,
  37. t.specific_name specificName,
  38. t.actual_carrying_capacity actualCarryingCapacity,
  39. t.port_cargo portCargo,
  40. t.is_dangerous_goods isDangerousGoods
  41. from GHJG_BASICS.C_CB_CARGO_DECLARE_REC t
  42. where t.REPORT_ID = #{reportId}
  43. </select>
  44. <select id="selectShipCrewInfo" resultType="com.shanghaichengdi.ghjgitem.vo.CCbOnShipCrewRecVo">
  45. select t.crew_id crewId, t.name name
  46. from GHJG_BASICS.C_CB_ON_SHIP_CREW_REC t
  47. where t.REPORT_ID = #{reportId}
  48. </select>
  49. <select id="selectInfoList" resultType="com.shanghaichengdi.ghjgitem.vo.VwCertInfoSelfAllVo">
  50. select *
  51. from (select distinct infoall.CODE code,
  52. infoall.CRET_TYPE cretType,
  53. infoall.FZJG fzjg,
  54. infoall.CRET_NUMER cretNumer,
  55. infoall.CNAME cname,
  56. infoall.JUDGMENT judgment,
  57. to_char(infoall.BUSINESS_TYPE) businessType,
  58. '' bz,
  59. '' baseid,
  60. 2 infoSource,
  61. '' infoStats,
  62. infoall.CRE_DATE creDate,
  63. infoall.EFFECTIVESTARTDATE effectivestartdate,
  64. infoall.EFFECTIVEENDDATE effectiveenddate,
  65. t2.TAXLICENSE taxlicense,
  66. t2.CNNAME enterpriseName,
  67. t2.ENNAME enterpriseEnName,
  68. t2.MANAGECLASS manageClass,
  69. t2.LEGALPERSON legalPerson,
  70. t2.LEGALPERSONDOCUMENTTYPE legalPersonDocumentType,
  71. t2.LEGALPERSONDOCUMENTNUM legalPersonDocumentNum,
  72. t2.LEGALPERSONPHONE legalPersonPhone,
  73. t2.PHONENUMBER phoneNumber,
  74. t2.EMAIL email,
  75. t2.BUSINESSLICENSE businessLicense,
  76. t2.REGISTEREDDISTRICT registeredDistrict,
  77. t2.REGISTEREDADDRESS registeredAddress,
  78. t2.LICENSENUMBER licenseNumber,
  79. t2.CANCELLATIONDATE cancellationDate,
  80. ss.ECONOMIC_TYPE,
  81. ss.BUSINESS_SCOPE,
  82. row_number() over (partition by infoall.cname ORDER BY infoall.EFFECTIVESTARTDATE desc) rn
  83. from GHJG_BASICS.Vw_Cret_Info_Self_All infoall
  84. left join GHJG_BASICS.TOBJ_ENTERPRISE_BASIC t2 on infoall.cname = t2.cnname
  85. left join GHJG_PORT_MANAGE.SY_INSPECT ss
  86. on ss.LICENSE_NUMBER = infoall.CRET_NUMER
  87. where (infoall.JUDGMENT like '%上海市浦东新区建设和交通委员会%')
  88. and infoall.cname not in ('上海新洋山集装箱运输有限公司'))
  89. where rn = 1
  90. </select>
  91. <select id="selectBoatInfoList" resultType="com.shanghaichengdi.ghjgitem.vo.ShipDataVo">
  92. select T.SHIP_REG_NO shipRegNo,
  93. T.SHIP_ID shipId,
  94. T.SHIP_NAME_CN shipNameCn,
  95. T.SHIP_IMO shipImo,
  96. T.MMSI mmsi,
  97. T.REGPORT_CODE regportCode,
  98. T.SHIP_ROUTE_CODE shipRouteCode,
  99. T.SHIP_TYPE_CODE shipTypeCode,
  100. T.SHIP_SUMMER_DRAFT shipSummerDraft,
  101. T.SHIP_WIND_LEVEL shipWindLevel,
  102. T.SHIP_MINIMUM_FREEBOARD shipMinimumFreeboard,
  103. T.SHIP_CONTAINER_NUM shipContainerNum,
  104. T.SHIP_PARKING_NUM shipParkingNum,
  105. T.SHIP_PASSENGER_NUM shipPassengerNum,
  106. T.REMARK remark,
  107. T.SHIP_INSPECT_NO shipInspectNo,
  108. T.SHIP_CALLSIGN shipCallsign,
  109. T.SAILINGAREA_CODE sailingareaCode,
  110. T.SHIP_BUILT_DATE shipBuiltDate,
  111. T.SHIPYARD_CN shipyardCn,
  112. T.SHIP_BUILT_ADDR_CN shipBuiltAddrCn,
  113. T.SHIP_LENGTH shipLength,
  114. T.SHIP_BREADTH shipBreadth,
  115. T.SHIP_DEPTH shipDepth,
  116. T.SHIP_GROSSTON shipGrosston,
  117. T.SHIP_NETTON shipNetton,
  118. T.SHIP_DWT shipDwt,
  119. T.SHIP_ENGINE_POWER shipEnginePower,
  120. T.SHIP_REGION_TYPE shipRegionType,
  121. T.SHIP_REBUILT_DATE shipRebuiltDate,
  122. T.ORG_CODE orgCode,
  123. T.CREATE_TIME createTime,
  124. T.LAST_UPDATE_DATE lastUpdateDate,
  125. T.DELETE_FLAG deleteFlag,
  126. T.SHIP_OWNER_ADDR_CN shipOwnerAddrCn,
  127. T.OWNER_LEGAL_PERSON ownerLegalPerson,
  128. T.OWNER_CONTACT_PHONE ownerContactPhone,
  129. T.SHIP_TYPE_NAME shipTypeName,
  130. T.REGPORT_NAME regportName,
  131. T.SHIP_ROUTE_NAME shipRouteName
  132. from GHJG_BASICS.MVW_BOAT_INFO T
  133. <where>
  134. <if test="shipId != null and shipId != ''">
  135. and T.SHIP_ID = #{shipId}
  136. </if>
  137. <if test="mmsi != null and mmsi != ''">
  138. and T.MMSI like #{mmsi} || '%'
  139. </if>
  140. <if test="shipTypeName != null and shipTypeName != ''">
  141. and T.SHIP_TYPE_NAME = #{shipTypeName}
  142. </if>
  143. <if test="shipNameCn != null and shipNameCn != ''">
  144. and T.SHIP_NAME_CN = #{shipNameCn}
  145. </if>
  146. </where>
  147. </select>
  148. <select id="obscureSelectBoatInfoList" resultType="com.shanghaichengdi.ghjgitem.vo.ShipDataVo">
  149. select *
  150. from (select T.SHIP_NAME_CN shipNameCn,
  151. T.SHIP_NAME_EN shipNameEn,
  152. T.MMSI mmsi,
  153. T.SHIP_TYPE_CODE shipTypeCode,
  154. T.SHIP_TYPE_NAME shipTypeName,
  155. T.LAST_UPDATE_DATE lastUpdateDate,
  156. T.SHIP_IMO shipImo,
  157. T.SHIP_CALLSIGN shipCallsign,
  158. T1.LATITUDE latitude,
  159. T1.LONGITUDE longtitude,
  160. T1.DIRECTION direction,
  161. T1.VELOCITY velocity,
  162. T1.SHIPSTATE shipState,
  163. row_number() over (partition by T1.DEVICEID order by T1.GPSTIME desc) rn
  164. from GHJG_BASICS.MVW_BOAT_INFO T
  165. left join GHJG_DYNAMIC.VW_GPSINFO_REALTIME T1 on T.MMSI = T1.DEVICEID
  166. where T.SHIP_NAME_CN like '%' || #{keyWord} || '%' or
  167. T.MMSI like #{keyWord} || '%')
  168. where rn = 1
  169. </select>
  170. <select id="selectBoatReportInfoList" resultType="com.shanghaichengdi.ghjgitem.vo.BoatReportInfoVo">
  171. select t.REPORT_ID reportId,
  172. t.SHIP_ID shipId,
  173. t.REPORT_NO reportNo,
  174. t.ORG_CODE orgCode,
  175. t.REPORT_PORT_NAME reportPortName,
  176. t.REPORT_PORT_CODE reportPortCode,
  177. t.ARRIVAL_OR_LEAVE arrivalOrLeave,
  178. t.ARRIVAL_REPORT_ID arrivalReportId,
  179. t.NEXT_PORT_NAME nextPortName,
  180. t.NEXT_PORT_CODE nextPortCode,
  181. t.REPORT_TIME reportTime,
  182. t.EXPECT_TIME expectTime,
  183. t.IF_ANCHORED ifAnchored,
  184. t.DRAFT_FORWARD draftForward,
  185. t.AFT_DRAFT aftDraft,
  186. t.BERTH_CODE berthCode,
  187. t.BERTH_NAME berthName,
  188. t.ACTUAL_CARRYING_CAPACITY actualCarryingCapacity,
  189. t.PORT_CARGO portCargo,
  190. t.REAL_DANGER_CARGO realDangerCargo,
  191. t.PORT_DANGER_CARGO portDangerCargo,
  192. t.ACTUAL_CAPACITY actualCapacity,
  193. t.PORT_PASSENGER portPassenger,
  194. t.REAL_VEHICLE realVehicle,
  195. t.PORT_VEHICLE portVehicle,
  196. t.NUM_OF_BARGE numOfBarge,
  197. t.PORT_BARGE portBarge,
  198. t.REAL_CONTAINER_QAY realContainerQay,
  199. t.PORT_CONTAINER_QAY portContainerQay,
  200. t.IF_REVOKE ifRevoke,
  201. t.VOYAGE_REPORT voyageReport,
  202. t.FREQUENCY frequency,
  203. t.NAVIGATION_SECTION navigationSection,
  204. t.PRE_PORT_NAME prePortName,
  205. t.PRE_PORT_CODE prePortCode,
  206. t.SHIP_NAME_CN shipName,
  207. t.MMSI mmsi,
  208. t.BID_NAME bidName,
  209. t.MOBILE_PHONE mobilePhone
  210. from GHJG_BASICS.c_cb_ship_eep_report_rec partition(${partition}) t
  211. left join ghjg_basics.dict_district_port p on p.berthname = t.berth_name and p.valid = '有效'
  212. and p.lochus != '注销'
  213. where 1 = 1
  214. and (REPORT_PORT_CODE like '31%'
  215. or NEXT_PORT_CODE like '31%'
  216. or PRE_PORT_CODE like '31%')
  217. and p.team = '浦东新区'
  218. <if test="reportId != '' and reportId != null">
  219. and t.REPORT_ID = #{reportId}
  220. </if>
  221. <if test="shipId != '' and shipId != null">
  222. and t.SHIP_ID = #{shipId}
  223. </if>
  224. <if test="startTime != null and endTime != null and endTime != '' and startTime != ''">
  225. and REPORT_TIME >= to_date(#{startTime},'yyyy-mm-dd hh24:mi:ss')
  226. and REPORT_TIME &lt;= to_date(#{endTime},'yyyy-mm-dd hh24:mi:ss')
  227. </if>
  228. <if test="reportNo != '' and reportNo != null">
  229. and t.REPORT_NO = #{reportNo}
  230. </if>
  231. order by t.REPORT_TIME desc
  232. </select>
  233. <select id="selectCountByRange" resultType="com.shanghaichengdi.ghjgitem.vo.CountVo">
  234. select count(1) count
  235. from GHJG_DYNAMIC.VW_GPSINFO_REALTIME t
  236. where t.LATITUDE >= #{minLat}
  237. and t.LATITUDE &lt;= #{maxLat}
  238. and t.LONGITUDE >= #{minLon}
  239. and t.LONGITUDE &lt;= #{maxLon}
  240. </select>
  241. <select id="selectBoatInfoByRange" resultType="com.shanghaichengdi.ghjgitem.vo.ShipDataVo">
  242. select *
  243. from (select T.MMSI mmsi,
  244. T1.DIRECTION direction,
  245. T1.VELOCITY velocity,
  246. T.LAST_UPDATE_DATE lastUpdateDate,
  247. T1.LATITUDE latitude,
  248. T1.LONGITUDE longtitude,
  249. T.SHIP_NAME_EN shipNameEn,
  250. T.SHIP_NAME_CN shipNameCn,
  251. T.SHIP_LENGTH shipLength,
  252. T.SHIP_BREADTH shipBreadth,
  253. T1.SHIPSTATE shipState,
  254. T.SHIP_SUMMER_DRAFT shipSummerDraft,
  255. T.SHIP_IMO shipImo,
  256. T.SHIP_TYPE_CODE shipTypeCode,
  257. T.SHIP_TYPE_NAME shipTypeName,
  258. T.SHIP_CALLSIGN shipCallsign,
  259. T.SHIP_BUILT_DATE shipBuiltDate,
  260. T.SHIP_DWT shipDwt,
  261. row_number() over (partition by T1.DEVICEID order by T1.GPSTIME desc) rn
  262. from GHJG_BASICS.MVW_BOAT_INFO T
  263. left join GHJG_DYNAMIC.VW_GPSINFO_REALTIME T1 on T.MMSI = T1.DEVICEID
  264. where t1.LATITUDE >= #{minLat}
  265. and t1.LATITUDE &lt;= #{maxLat}
  266. and t1.LONGITUDE >= #{minLon}
  267. and t1.LONGITUDE &lt;= #{maxLon})
  268. and t1.gpstime > sysdate - 30/24/60
  269. where rn = 1
  270. </select>
  271. <select id="selectBoatInfoByMmsi" resultType="com.shanghaichengdi.ghjgitem.vo.ShipDataVo">
  272. select *
  273. from (select T.LAST_UPDATE_DATE lastUpdateDate,
  274. T1.LATITUDE latitude,
  275. T1.LONGITUDE longtitude,
  276. T1.DIRECTION direction,
  277. T1.VELOCITY velocity,
  278. T.SHIP_SUMMER_DRAFT shipSummerDraft,
  279. T.MMSI mmsi,
  280. T.SHIP_IMO shipImo,
  281. T.SHIP_CALLSIGN shipCallsign,
  282. T.SHIP_NAME_EN shipNameEn,
  283. T.SHIP_NAME_CN shipNameCn,
  284. T.SHIP_TYPE_CODE shipTypeCode,
  285. T.SHIP_TYPE_NAME shipTypeName,
  286. T.SHIP_LENGTH shipLength,
  287. T.SHIP_BREADTH shipBreadth,
  288. T1.SHIPSTATE shipState,
  289. T.SHIP_BUILT_DATE shipBuiltDate,
  290. T.SHIP_DWT shipDwt,
  291. T.REGPORT_CODE regportCode,
  292. T.REGPORT_NAME regportName,
  293. decode(T2.ARRIVAL_OR_LEAVE,0,T2.REPORT_PORT_NAME,1,T2.NEXT_PORT_NAME) destination,
  294. T2.EXPECT_TIME expectTime,
  295. row_number() over (partition by T1.DEVICEID order by T1.GPSTIME desc) rn
  296. from GHJG_BASICS.MVW_BOAT_INFO T
  297. left join GHJG_DYNAMIC.VW_GPSINFO_REALTIME T1 on T.MMSI = T1.DEVICEID
  298. left join (select
  299. a.SHIP_ID,a.REPORT_PORT_NAME,a.NEXT_PORT_NAME,a.ARRIVAL_OR_LEAVE,a.EXPECT_TIME
  300. from (
  301. <foreach item="item" collection="tableNameList" separator="union">
  302. select SHIP_ID,REPORT_PORT_NAME,NEXT_PORT_NAME,ARRIVAL_OR_LEAVE,EXPECT_TIME from
  303. ${item}
  304. </foreach>
  305. ) a
  306. ) T2 on T.SHIP_ID is not null and T.SHIP_ID = T2.SHIP_ID
  307. where T.MMSI = #{mmsi})
  308. where rn = 1
  309. </select>
  310. <select id="selectBoatPathFromMvwHistory" resultType="com.shanghaichengdi.ghjgitem.vo.BoatPathVo">
  311. select t.deviceid mmsi, t.VELOCITY,t.DIRECTION,t.LONGITUDE,t.LATITUDE,
  312. to_char(t.GPSTIME,'yyyy-mm-dd hh24:mi:ss') time
  313. from GHJG_DYNAMIC.VW_GPSINFO_HISTORY t
  314. where t.deviceid = #{mmsi}
  315. and t.gpstime >= to_date(#{startTime}, 'yyyy-mm-dd hh24:mi:ss')
  316. and to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss') >= t.gpstime
  317. </select>
  318. <select id="selectBoatInfoByShipId" resultType="com.shanghaichengdi.ghjgitem.vo.ShipInfoForShipLockVo">
  319. select t.SHIP_ID,
  320. t.SHIP_NAME_CN shipName,
  321. t.SHIP_TYPE_CODE shipTypeCode,
  322. t.SHIP_TYPE_NAME shipTypeName,
  323. t.SHIP_LENGTH shipLength,
  324. t.MMSI,
  325. t.SHIP_DEPTH shipLength,
  326. t.SHIP_DWT shipDwt,
  327. t.SHIP_BREADTH shipWidth
  328. from GHJG_BASICS.MVW_BOAT_INFO t
  329. where SHIP_ID = #{shipId}
  330. </select>
  331. <select id="selectCargoDeclareInfoByShipId"
  332. resultType="com.shanghaichengdi.ghjgitem.vo.CargoInfoForShipLockVo">
  333. <foreach collection="list" item="item" index="index" separator="union all">
  334. select c.ship_id shipId,
  335. c.SHIP_NAME_CN shipName,
  336. c.mmsi mmsi,
  337. r.type_code pCargoCode,
  338. d.ITEM_NAME_CN pCargoName,
  339. r.GOODS_CODE cargoCode,
  340. r.specific_name cargoName,
  341. c.actual_carrying_capacity actualLoad,
  342. c.PRE_PORT_NAME startPort,
  343. c.pre_port_code startPortCode,
  344. c.next_port_code nextPortCode,
  345. c.next_port_name nextPort,
  346. c.LAST_UPDATE_DATE lastUpdateDate
  347. from ghjg_basics.c_cb_ship_eep_report_rec partition(${item}) c
  348. left join ghjg_basics.c_cb_cargo_declare_rec r
  349. on c.report_id = r.report_id
  350. left join ghjg_basics.d_cb_cargo_type d on r.type_code = d.code
  351. where c.SHIP_ID = #{shipId}
  352. </foreach>
  353. </select>
  354. <select id="getPdShipCountByMmsi" resultType="java.lang.Integer">
  355. select count(1) from ghjg_dynamic.vw_gpsinfo_realtime t
  356. where t.deviceid = #{mmsi}
  357. and t.GPSTIME > sysdate - 1/24
  358. and t.MAPX > -2000 and t.MAPX &lt; 48000
  359. and t.MAPY > -48000 and t.MAPY &lt; 18000
  360. </select>
  361. <select id="getPdShipCountByShipId" resultType="java.lang.Integer">
  362. select count(1) from ghjg_dynamic.vw_gpsinfo_realtime t
  363. left join ghjg_basics.mvw_boat_info b on t.deviceid = b.mmsi
  364. where b.ship_id = #{shipId}
  365. and t.GPSTIME > sysdate - 1/24
  366. and t.MAPX > -2000 and t.MAPX &lt; 48000
  367. and t.MAPY > -48000 and t.MAPY &lt; 18000
  368. </select>
  369. </mapper>