|
@@ -130,23 +130,32 @@
|
|
|
where b1.valid = '有效'
|
|
|
) b on g.berthname = b.BERTHNAME
|
|
|
left join (
|
|
|
- select acc.SHIP_NAME,acc.FIRST_DTM
|
|
|
- from GHJG_BUSSINESS.BOAT_POLLUTANT_ACCEPT_NEW acc
|
|
|
- where acc.SEWAGE_TYPE = 'sewage'
|
|
|
+ select * from (
|
|
|
+ select acc.*,row_number() over(partition by acc.ship_name order by acc.first_dtm desc) rn
|
|
|
+ from GHJG_BUSSINESS.BOAT_WATER_POLLUTANT_ACCEPT_F acc where acc.SEWAGE_TYPE = 'sewage'
|
|
|
+ and acc.First_Dtm >= sysdate - 30
|
|
|
+ ) where rn = 1
|
|
|
) asw on asw.SHIP_NAME = g.boatname
|
|
|
left join (
|
|
|
- select acc.SHIP_NAME,acc.FIRST_DTM
|
|
|
- from GHJG_BUSSINESS.BOAT_POLLUTANT_ACCEPT_NEW acc
|
|
|
- where acc.SEWAGE_TYPE = 'rubbish'
|
|
|
+ select * from (
|
|
|
+ select acc.*,row_number() over(partition by acc.ship_name order by acc.first_dtm desc) rn
|
|
|
+ from GHJG_BUSSINESS.BOAT_WATER_POLLUTANT_ACCEPT_F acc where acc.SEWAGE_TYPE = 'rubbish'
|
|
|
+ and acc.First_Dtm >= sysdate - 30
|
|
|
+ ) where rn = 1
|
|
|
) asl on asl.SHIP_NAME = g.boatname
|
|
|
left join (
|
|
|
- select acc.SHIP_NAME,acc.FIRST_DTM
|
|
|
- from GHJG_BUSSINESS.BOAT_POLLUTANT_ACCEPT_NEW acc
|
|
|
- where acc.SEWAGE_TYPE = 'oilsewage'
|
|
|
+ select * from (
|
|
|
+ select acc.*,row_number() over(partition by acc.ship_name order by acc.first_dtm desc) rn
|
|
|
+ from GHJG_BUSSINESS.BOAT_WATER_POLLUTANT_ACCEPT_F acc where acc.SEWAGE_TYPE = 'oilsewage'
|
|
|
+ and acc.First_Dtm >= sysdate - 30
|
|
|
+ ) where rn = 1
|
|
|
) ayw on ayw.SHIP_NAME = g.boatname
|
|
|
where g.relievetype = 0 and g.deleteflag = 0
|
|
|
) tt
|
|
|
where 1=1
|
|
|
+ <if test="warningCode != null and warningCode != ''">
|
|
|
+ and tt.code = #{warningCode}
|
|
|
+ </if>
|
|
|
<if test="boatName != null and boatName != ''">
|
|
|
and tt.BOATNAME = #{boatName}
|
|
|
</if>
|
|
@@ -215,13 +224,18 @@
|
|
|
where b1.valid = '有效'
|
|
|
) b on g.berthname = b.BERTHNAME
|
|
|
left join (
|
|
|
- select acc.SHIP_NAME,acc.FIRST_DTM
|
|
|
- from GHJG_BUSSINESS.BOAT_POLLUTANT_ACCEPT_NEW acc
|
|
|
- where acc.SEWAGE_TYPE = 'sewage'
|
|
|
+ select * from (
|
|
|
+ select acc.*,row_number() over(partition by acc.ship_name order by acc.first_dtm desc) rn
|
|
|
+ from GHJG_BUSSINESS.BOAT_WATER_POLLUTANT_ACCEPT_F acc where acc.SEWAGE_TYPE = 'sewage'
|
|
|
+ and acc.First_Dtm >= sysdate - 60
|
|
|
+ ) where rn = 1
|
|
|
) asw on asw.SHIP_NAME = g.boatname
|
|
|
) tt
|
|
|
where 1=1
|
|
|
and tt.totaldays >= 0
|
|
|
+ <if test="warningCode != null and warningCode != ''">
|
|
|
+ and tt.code = #{warningCode}
|
|
|
+ </if>
|
|
|
<if test="boatName != null and boatName != ''">
|
|
|
and tt.BOATNAME = #{boatName}
|
|
|
</if>
|