632 lines
26 KiB
XML
632 lines
26 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.CrackdownStatusMapper">
|
|
<sql id="selectCrackdownStatusListWhere">
|
|
<where>
|
|
<if test='year != null and year != ""'>
|
|
and extract(year from a.napo_dt) = #{year}::numeric
|
|
</if>
|
|
<if test='month != null and month != ""'>
|
|
and extract(month from a.napo_dt) = #{month}::numeric
|
|
</if>
|
|
<if test="napoSeaPointDetail != null and napoSeaPointDetail != ''">
|
|
and (a.napo_sea_point_lon like '%'||#{napoSeaPointDetail}||'%' or
|
|
a.napo_sea_point_lat like '%'||#{napoSeaPointDetail}||'%' or
|
|
a.napo_sea_point_detail like '%'||#{napoSeaPointDetail}||'%')
|
|
</if>
|
|
<if test="nll != null and nll != ''">
|
|
and a.nll like '%'||#{nll}||'%'
|
|
</if>
|
|
<if test="mmsi != null and mmsi != ''">
|
|
and a.mmsi like '%'||#{mmsi}||'%'
|
|
</if>
|
|
<if test="distance != null and distance != ''">
|
|
and a.distance like '%'||#{distance}||'%'
|
|
</if>
|
|
<if test="isDamboUnpaidAmount == 'Y'">
|
|
and b.dambo_unpaid_amount > 0
|
|
</if>
|
|
<if test="isDamboUnpaidAmount == 'N'">
|
|
and (b.dambo_unpaid_amount = 0 or b.dambo_unpaid_amount is null)
|
|
</if>
|
|
<if test="isEvictionDt == 'Y'">
|
|
and b.eviction_dt is not null
|
|
</if>
|
|
<if test="isEvictionDt == 'N'">
|
|
and b.eviiction_dt is null
|
|
</if>
|
|
<if test="isReturnDt == 'Y'">
|
|
and b.return_dt is not null
|
|
</if>
|
|
<if test="isReturnDt == 'N'">
|
|
and b.return_dt is null
|
|
</if>
|
|
<if test="isConsignmentStartDt == 'Y'">
|
|
and b.consignment_start_dt is not null
|
|
</if>
|
|
<if test="isConsignmentStartDt == 'N'">
|
|
and b.consignment_start_dt is null
|
|
</if>
|
|
<if test="isConfiscationDt == 'Y'">
|
|
and b.confiscation_dt is not null
|
|
</if>
|
|
<if test="isConfiscationDt == 'N'">
|
|
and b.confiscation_dt is null
|
|
</if>
|
|
<if test="isDirectHandoverDt == 'Y'">
|
|
and b.direct_handover_dt is not null
|
|
</if>
|
|
<if test="isDirectHandoverDt == 'N'">
|
|
and b.direct_handover_dt is null
|
|
</if>
|
|
<if test="boatDisposalType != null and boatDisposalType != ''">
|
|
and b.boat_disposal_type = #{boatDisposalType}
|
|
</if>
|
|
<if test="handoverSeaPointDetail != null and handoverSeaPointDetail != ''">
|
|
and (b.handover_sea_point_lon like '%'||#{handoverSeaPointDetail}||'%' or
|
|
b.handover_sea_point_lat like '%'||#{handoverSeaPointDetail}||'%' or
|
|
b.handover_sea_point_detail like '%'||#{handoverSeaPointDetail}||'%')
|
|
</if>
|
|
<if test="handoverBoat != null and handoverBoat != ''">
|
|
and b.handover_boat like '%'||#{handoverBoat}||'%'
|
|
</if>
|
|
<if test="middleTakeoverBoat != null and middleTakeoverBoat != ''">
|
|
and b.middle_takeover_boat like '%'||#{middleTakeoverBoat}||'%'
|
|
</if>
|
|
<if test="sailorNameKr != null and sailorNameKr != ''">
|
|
and d.sailor_name_kr like '%'||#{sailorNameKr}||'%'
|
|
</if>
|
|
<if test="catchFishSpecies != null and catchFishSpecies != ''">
|
|
and c.catch_fish_species like '%'||#{catchFishSpecies}||'%'
|
|
</if>
|
|
<if test="offenseFishSpecies != null and offenseFishSpecies != ''">
|
|
and c.offense_fish_species like '%'||#{offenseFishSpecies}||'%'
|
|
</if>
|
|
<if test="confiscationFrame == 'Y'">
|
|
and c.confiscation_frame is not null
|
|
</if>
|
|
<if test="confiscationFrame == 'N'">
|
|
and c.confiscation_frame is null or c.confiscation_frame = 0
|
|
</if>
|
|
<if test="confiscationWidth == 'Y'">
|
|
and c.confiscation_width is not null
|
|
</if>
|
|
<if test="confiscationWidth == 'N'">
|
|
and c.confiscation_width is null or c.confiscation_width = 0
|
|
</if>
|
|
<if test="confiscationJo == 'Y'">
|
|
and c.confiscation_jo is not null
|
|
</if>
|
|
<if test="confiscationJo == 'N'">
|
|
and c.confiscation_jo is null or c.confiscation_jo = 0
|
|
</if>
|
|
<if test="confiscationGae == 'Y'">
|
|
and c.confiscation_gae is not null
|
|
</if>
|
|
<if test="confiscationGae == 'N'">
|
|
and c.confiscation_gae is null or c.confiscation_gae = 0
|
|
</if>
|
|
<if test="confiscationEtc == 'Y'">
|
|
and c.confiscation_etc is not null
|
|
</if>
|
|
<if test="confiscationEtc == 'N'">
|
|
and c.confiscation_etc is null or c.confiscation_etc = 0
|
|
</if>
|
|
<if test="obstrExspdCntMin != null and obstrExspdCntMin != ''">
|
|
and a.obstr_exspd_cnt >= #{obstrExspdCntMin}
|
|
</if>
|
|
<if test="obstrExspdCntMax != null and obstrExspdCntMax != ''">
|
|
and a.obstr_exspd_cnt <= #{obstrExspdCntMax}
|
|
</if>
|
|
<if test="personDamageCntMin != null and personDamageCntMin != ''">
|
|
and a.person_damage_cnt >= #{personDamageCntMin}
|
|
</if>
|
|
<if test="personDamageCntMax != null and personDamageCntMax != ''">
|
|
and a.person_damage_cnt <= #{personDamageCntMax}
|
|
</if>
|
|
<if test="personDamageAmountMin != null and personDamageAmountMin != ''">
|
|
and a.person_damage_amount >= #{personDamageAmountMin}
|
|
</if>
|
|
<if test="personDamageAmountMax != null and personDamageAmountMax != ''">
|
|
and a.person_damage_amount <= #{personDamageAmountMax}
|
|
</if>
|
|
<if test="personDamageDetail != null and personDamageDetail != ''">
|
|
and a.person_damage_detail like '%'||#{personDamageDetail}||'%'
|
|
</if>
|
|
<if test="materialDamageCntMin != null and materialDamageCntMin != ''">
|
|
and a.material_damage_cnt >= #{materialDamageCntMin}
|
|
</if>
|
|
<if test="materialDamageCntMax != null and materialDamageCntMax != ''">
|
|
and a.material_damage_cnt <= #{materialDamageCntMax}
|
|
</if>
|
|
<if test="materialDamageAmountMin != null and materialDamageAmountMin != ''">
|
|
and a.material_damage_amount >= #{materialDamageAmountMin}
|
|
</if>
|
|
<if test="materialDamageAmountMax != null and materialDamageAmountMax != ''">
|
|
and a.material_damage_amount <= #{materialDamageAmountMax}
|
|
</if>
|
|
<if test="materialDamageDetail != null and materialDamageDetail != ''">
|
|
and a.material_damage_detail like '%'||#{materialDamageDetail}||'%'
|
|
</if>
|
|
<if test="captainRestriction == 'Y'">
|
|
and e.captainRestriction > 0
|
|
</if>
|
|
<if test="captainRestriction == 'N'">
|
|
and e.captainRestrictionNot > 0
|
|
</if>
|
|
<if test="navigaterRestriction == 'Y'">
|
|
and e.navigaterRestriction > 0
|
|
</if>
|
|
<if test="navigaterRestriction == 'N'">
|
|
and e.navigaterRestrictionNot > 0
|
|
</if>
|
|
<if test="engineerRestriction == 'Y'">
|
|
and e.engineerRestriction > 0
|
|
</if>
|
|
<if test="engineerRestriction == 'N'">
|
|
and e.engineerRestrictionNot > 0
|
|
</if>
|
|
<if test="caseAgency != null and caseAgency != ''">
|
|
and a.case_agency = #{caseAgency}
|
|
</if>
|
|
<if test="crackdownPolice != null and crackdownPolice != ''">
|
|
and a.crackdown_police = #{crackdownPolice}
|
|
</if>
|
|
<if test="crackdownBoat != null and crackdownBoat != ''">
|
|
and a.crackdown_boat = #{crackdownBoat}
|
|
</if>
|
|
<if test="boatNameKr != null and boatNameKr != ''">
|
|
and c.boat_name_kr like '%'||#{boatNameKr}||'%'
|
|
</if>
|
|
<if test="boatNnySung != null and boatNnySung != ''">
|
|
and c.boat_nny_sung like '%'||#{boatNnySung}||'%'
|
|
</if>
|
|
<if test="boatNnySi != null and boatNnySi != ''">
|
|
and c.boat_nny_si like '%'||#{boatNnySi}||'%'
|
|
</if>
|
|
<if test="boatMaterial != null and boatMaterial != ''">
|
|
and c.boat_material = #{boatMaterial}
|
|
</if>
|
|
<if test="fisheryType != null and fisheryType != ''">
|
|
and c.fishery_type = #{fisheryType}
|
|
</if>
|
|
<if test="processStatus != null and processStatus != ''">
|
|
and b.process_status = #{processStatus}
|
|
</if>
|
|
<if test="tonMin != null and tonMin > 0">
|
|
and c.ton_cnt >= #{tonMin}
|
|
</if>
|
|
<if test="tonMax != null and tonMax > 0">
|
|
and c.ton_cnt <= #{tonMax}
|
|
</if>
|
|
<if test='violationList != null'>
|
|
and
|
|
<foreach collection="violationList" item="violation" index="index" separator=" or " open="(" close=")">
|
|
f.violationCode like '%'||#{violation}||'%'
|
|
</foreach>
|
|
</if>
|
|
<choose>
|
|
<when test='dateSelector == "napoDt"'>
|
|
<if test='startDate != null'>
|
|
and a.napo_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and a.napo_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "evictionDt"'>
|
|
<if test='startDate != null'>
|
|
and b.eviction_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.eviction_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "directHandoverDt"'>
|
|
<if test='startDate != null'>
|
|
and b.direct_handover_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.direct_handover_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "consignmentDt"'>
|
|
<if test='startDate != null'>
|
|
and b.consignment_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.consignment_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "confiscationDt"'>
|
|
<if test='startDate != null'>
|
|
and b.confiscation_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.confiscation_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "boatDisposalDt"'>
|
|
<if test='startDate != null'>
|
|
and b.boat_disposal_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.boat_disposal_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "returnDt"'>
|
|
<if test='startDate != null'>
|
|
and b.return_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and b.return_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null'>
|
|
and a.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and a.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="selectCrackdownStatusList" resultType="CrackdownStatusDTO" parameterType="UnlawfulFishingParam">
|
|
select a.cds_key,
|
|
a.case_num,
|
|
a.status,
|
|
a.napo_dt,
|
|
f.violationStr,
|
|
a.napo_sea_point_lon,
|
|
a.napo_sea_point_lat,
|
|
a.napo_sea_point_detail,
|
|
f.violationCode,
|
|
a.nll,
|
|
a.obstr_exspd_cnt ,
|
|
a.person_damage_cnt ,
|
|
a.person_damage_amount ,
|
|
a.person_damage_detail ,
|
|
a.material_damage_cnt ,
|
|
a.material_damage_amount ,
|
|
a.material_damage_detail ,
|
|
a.case_agency ,
|
|
a.case_police_officer,
|
|
a.crackdown_police ,
|
|
a.crackdown_boat ,
|
|
a.mmsi ,
|
|
c.boat_name_kr ,
|
|
c.ton_cnt ,
|
|
c.sailor_cnt,
|
|
c.boat_material ,
|
|
c.boat_nny_sung ,
|
|
c.boat_nny_si ,
|
|
d.sailor_name_kr as captainName,
|
|
d.birthdate as captainBirthDate,
|
|
c.fishery_type ,
|
|
c.catch_fish_species ,
|
|
c.catch_cnt ,
|
|
c.offense_type ,
|
|
c.offense_weight ,
|
|
c.offense_quantity ,
|
|
c.offense_amount ,
|
|
c.offense_illegal_waste_quantity ,
|
|
b.process_status ,
|
|
c.dambo_unpaid_amount ,
|
|
c.dambo_payment ,
|
|
c.payment_payment_dt ,
|
|
b.consignment_start_dt ,
|
|
b.consignment_end_dt ,
|
|
b.eviction_dt ,
|
|
b.direct_handover_dt ,
|
|
b.boat_disposal_type ,
|
|
b.exile_dt ,
|
|
b.return_dt ,
|
|
b.handover_sea_point_lon ,
|
|
b.handover_sea_point_lat ,
|
|
b.handover_sea_point_detail ,
|
|
b.handover_boat ,
|
|
b.middle_takeover_boat ,
|
|
b.confiscation_dt,
|
|
coalesce(e.captainRestriction, 0) as captainRestriction,
|
|
coalesce(e.navigaterRestriction, 0) as navigaterRestriction,
|
|
coalesce(e.engineerRestriction, 0) as engineerRestriction,
|
|
coalesce(e.ownerRestriction, 0) as ownerRestriction,
|
|
coalesce(e.seniorRestriction, 0) as seniorRestriction,
|
|
coalesce(e.normalRestriction, 0) as normalRestriction,
|
|
coalesce(e.captainRestrictionNot, 0) as captainRestrictionNot,
|
|
coalesce(e.navigaterRestrictionNot, 0) as navigaterRestrictionNot,
|
|
coalesce(e.engineerRestrictionNot, 0) as engineerRestrictionNot,
|
|
coalesce(e.ownerRestrictionNot, 0) as ownerRestrictionNot,
|
|
coalesce(e.seniorRestrictionNot, 0) as seniorRestrictionNot,
|
|
coalesce(e.normalRestrictionNot, 0) as normalRestrictionNot,
|
|
a.field_ivsgt,
|
|
b.release_dt ,
|
|
date_part('DAY', b.release_dt-a.napo_dt)||'일'||date_part('HOUR', b.release_dt-a.napo_dt)||'시간' as fieldIvsgtDayHour,
|
|
b.pressurized_time_taken ,
|
|
a.distance ,
|
|
b.warrant_req_take_time ,
|
|
c.confiscation_frame ,
|
|
c.confiscation_width ,
|
|
c.confiscation_jo ,
|
|
c.confiscation_gae ,
|
|
c.confiscation_etc,
|
|
a.wrt_organ,
|
|
a.wrt_part,
|
|
a.wrt_user_seq,
|
|
a.wrt_user_grd,
|
|
a.wrt_user_nm,
|
|
a.wrt_dt
|
|
from crackdown_status a
|
|
inner join process_result b
|
|
on a.cds_key = b.cds_key
|
|
inner join fishing_boat c
|
|
on a.cds_key = c.cds_key
|
|
left outer join sailor d
|
|
on c.fb_key = d.fb_key and d.position = 'POS001'
|
|
left outer join (
|
|
select fb_key,
|
|
sum(case when ab.item_cd = 'POS001' and is_restriction = 'Y' then 1 end) as captainRestriction,
|
|
sum(case when ab.item_cd = 'POS001' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as captainRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS002' and is_restriction = 'Y' then 1 end) as navigaterRestriction,
|
|
sum(case when ab.item_cd = 'POS002' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as navigaterRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS003' and is_restriction = 'Y' then 1 end) as engineerRestriction,
|
|
sum(case when ab.item_cd = 'POS003' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as engineerRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS004' and is_restriction = 'Y' then 1 end) as ownerRestriction,
|
|
sum(case when ab.item_cd = 'POS004' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as ownerRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS005' and is_restriction = 'Y' then 1 end) as seniorRestriction,
|
|
sum(case when ab.item_cd = 'POS005' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as seniorRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS006' and is_restriction = 'Y' then 1 end) as normalRestriction,
|
|
sum(case when ab.item_cd = 'POS006' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as normalRestrictionNot
|
|
from sailor aa left outer join code_mgt ab on aa.position = ab.item_cd
|
|
group by fb_key
|
|
) e on c.fb_key = e.fb_key
|
|
left outer join (
|
|
select aa.fb_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation aa
|
|
inner join code_mgt ab
|
|
on aa.violation = ab.item_cd
|
|
group by aa.fb_key
|
|
) f on c.fb_key = f.fb_key
|
|
<include refid="selectCrackdownStatusListWhere"></include>
|
|
order by a.napo_dt desc
|
|
</select>
|
|
|
|
<select id="selectCrackdownStatusListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from crackdown_status a
|
|
inner join process_result b
|
|
on a.cds_key = b.cds_key
|
|
inner join fishing_boat c
|
|
on a.cds_key = c.cds_key
|
|
left outer join sailor d
|
|
on c.fb_key = d.fb_key and d.position = 'POS001'
|
|
left outer join (
|
|
select fb_key,
|
|
sum(case when ab.item_cd = 'POS001' and is_restriction = 'Y' then 1 end) as captainRestriction,
|
|
sum(case when ab.item_cd = 'POS001' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as captainRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS002' and is_restriction = 'Y' then 1 end) as navigaterRestriction,
|
|
sum(case when ab.item_cd = 'POS002' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as navigaterRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS003' and is_restriction = 'Y' then 1 end) as engineerRestriction,
|
|
sum(case when ab.item_cd = 'POS003' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as engineerRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS004' and is_restriction = 'Y' then 1 end) as ownerRestriction,
|
|
sum(case when ab.item_cd = 'POS004' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as ownerRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS005' and is_restriction = 'Y' then 1 end) as seniorRestriction,
|
|
sum(case when ab.item_cd = 'POS005' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as seniorRestrictionNot,
|
|
sum(case when ab.item_cd = 'POS006' and is_restriction = 'Y' then 1 end) as normalRestriction,
|
|
sum(case when ab.item_cd = 'POS006' and (is_restriction is null or is_restriction <> 'Y') then 1 end) as normalRestrictionNot
|
|
from sailor aa left outer join code_mgt ab on aa.position = ab.item_cd
|
|
group by fb_key, is_restriction
|
|
) e on c.fb_key = e.fb_key
|
|
left outer join (
|
|
select aa.fb_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation aa
|
|
inner join code_mgt ab
|
|
on aa.violation = ab.item_cd
|
|
group by aa.fb_key
|
|
) f on c.fb_key = f.fb_key
|
|
<include refid="selectCrackdownStatusListWhere"></include>
|
|
</select>
|
|
|
|
<sql id="selectFishingBoatListWhere">
|
|
<where>
|
|
<if test="year != null and year != 0">
|
|
and extract(year from a.napo_dt) = ${year}
|
|
</if>
|
|
<if test="caseAgency != null and caseAgency != ''">
|
|
and a.case_agency = #{caseAgency}
|
|
</if>
|
|
<if test="crackdownPolice != null and crackdownPolice != ''">
|
|
and a.crackdown_police = #{crackdownPolice}
|
|
</if>
|
|
<if test="crackdownBoat != null and crackdownBoat != ''">
|
|
and a.crackdown_boat = #{crackdownBoat}
|
|
</if>
|
|
<if test="boatNameKr != null and boatNameKr != ''">
|
|
and b.boat_name_kr like '%'||#{boatNameKr}||'%'
|
|
</if>
|
|
<if test="boatNnySung != null and boatNnySung != ''">
|
|
and b.boat_nny_sung like '%'||#{boatNnySung}||'%'
|
|
</if>
|
|
<if test="boatNnySi != null and boatNnySi != ''">
|
|
and b.boat_nny_si like '%'||#{boatNnySi}||'%'
|
|
</if>
|
|
<if test="boatMaterial != null and boatMaterial != ''">
|
|
and b.boat_material = #{boatMaterial}
|
|
</if>
|
|
<if test="fisheryType != null and fisheryType != ''">
|
|
and b.fishery_type = #{fisheryType}
|
|
</if>
|
|
<if test="processStatus != null and processStatus != ''">
|
|
and c.process_status = #{processStatus}
|
|
</if>
|
|
<if test="tonMin != null and tonMin > 0">
|
|
and b.ton_cnt >= #{tonMin}
|
|
</if>
|
|
<if test="tonMax != null and tonMax > 0">
|
|
and b.ton_cnt <= #{tonMax}
|
|
</if>
|
|
<if test='violationList != null'>
|
|
and
|
|
<foreach collection="violationList" item="violation" index="index" separator=" or " open="(" close=")">
|
|
e.violationCode like '%'||#{violation}||'%'
|
|
</foreach>
|
|
</if>
|
|
<choose>
|
|
<when test='dateSelector == "napoDt"'>
|
|
<if test='startDate != null'>
|
|
and a.napo_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and a.napo_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "evictionDt"'>
|
|
<if test='startDate != null'>
|
|
and c.eviction_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.eviction_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "directHandoverDt"'>
|
|
<if test='startDate != null'>
|
|
and c.direct_handover_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.direct_handover_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "consignmentDt"'>
|
|
<if test='startDate != null'>
|
|
and c.consignment_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.consignment_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "confiscationDt"'>
|
|
<if test='startDate != null'>
|
|
and c.confiscation_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.confiscation_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "boatDisposalDt"'>
|
|
<if test='startDate != null'>
|
|
and c.boat_disposal_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.boat_disposal_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "returnDt"'>
|
|
<if test='startDate != null'>
|
|
and c.return_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and c.return_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null'>
|
|
and a.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null'>
|
|
and a.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="selectFishingBoatList" resultType="CrackdownStatus" parameterType="UnlawfulFishingParam">
|
|
select a.cds_key,
|
|
a.napo_dt,
|
|
a.napo_sea_point_lon,
|
|
a.napo_sea_point_lat,
|
|
a.napo_sea_point_detail,
|
|
a.case_agency,
|
|
a.crackdown_police,
|
|
a.crackdown_boat,
|
|
b.boat_name_kr,
|
|
b.fishery_type,
|
|
b.boat_nny_sung,
|
|
b.boat_nny_si,
|
|
b.ton_cnt,
|
|
b.boat_material,
|
|
b.wrt_organ,
|
|
b.wrt_user_grd,
|
|
b.wrt_user_nm,
|
|
b.wrt_dt,
|
|
c.process_status,
|
|
d.sailor_name_kr,
|
|
e.violationStr
|
|
from crackdown_status a
|
|
inner join fishing_boat b
|
|
on a.cds_key = b.cds_key
|
|
inner join process_result c
|
|
on a.cds_key = c.cds_key
|
|
left outer join sailor d
|
|
on b.fb_key = d.fb_key and d.position = 'POS001'
|
|
left outer join (
|
|
select aa.fb_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation aa
|
|
inner join code_mgt ab
|
|
on aa.violation = ab.item_cd
|
|
group by aa.fb_key
|
|
) e on b.fb_key = e.fb_key
|
|
<include refid="selectFishingBoatListWhere"></include>
|
|
order by a.cds_key desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
<select id="selectFishingBoatListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from crackdown_status a
|
|
inner join fishing_boat b
|
|
on a.cds_key = b.cds_key
|
|
inner join process_result c
|
|
on a.cds_key = c.cds_key
|
|
left outer join sailor d
|
|
on b.fb_key = d.fb_key and d.position = 'POS001'
|
|
left outer join (
|
|
select aa.fb_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation aa
|
|
inner join code_mgt ab
|
|
on aa.violation = ab.item_cd
|
|
group by aa.fb_key
|
|
) e on b.fb_key = e.fb_key
|
|
<include refid="selectFishingBoatListWhere"></include>
|
|
</select>
|
|
<select id="selectFishingBoatYearParam" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select distinct extract(year from napo_dt) as year
|
|
from crackdown_status
|
|
where napo_dt is not null
|
|
</select>
|
|
<select id="selectCrackdownStatusVersionList" resultType="CrackdownStatusVersion" parameterType="int">
|
|
select cds_key,
|
|
version_no,
|
|
wrt_organ,
|
|
wrt_part,
|
|
wrt_user_grd,
|
|
wrt_user_nm,
|
|
wrt_dt
|
|
from crackdown_status_version
|
|
where cds_key = #{cds_key}
|
|
order by version_no desc
|
|
</select>
|
|
</mapper> |