and extract(year from a.napo_dt) = #{year}::numeric
and extract(month from a.napo_dt) = #{month}::numeric
and (a.napo_sea_point_lon like '%'||#{napoSeaPointDetail}||'%' or
a.napo_sea_point_lat like '%'||#{napoSeaPointDetail}||'%' or
a.napo_sea_point_detail like '%'||#{napoSeaPointDetail}||'%')
and a.nll like '%'||#{nll}||'%'
and a.mmsi like '%'||#{mmsi}||'%'
and a.distance like '%'||#{distance}||'%'
and b.dambo_unpaid_amount > 0
and (b.dambo_unpaid_amount = 0 or b.dambo_unpaid_amount is null)
and b.eviction_dt is not null
and b.eviiction_dt is null
and b.return_dt is not null
and b.return_dt is null
and b.consignment_start_dt is not null
and b.consignment_start_dt is null
and b.confiscation_dt is not null
and b.confiscation_dt is null
and b.direct_handover_dt is not null
and b.direct_handover_dt is null
and b.boat_disposal_type = #{boatDisposalType}
and (b.handover_sea_point_lon like '%'||#{handoverSeaPointDetail}||'%' or
b.handover_sea_point_lat like '%'||#{handoverSeaPointDetail}||'%' or
b.handover_sea_point_detail like '%'||#{handoverSeaPointDetail}||'%')
and b.handover_boat like '%'||#{handoverBoat}||'%'
and b.middle_takeover_boat like '%'||#{middleTakeoverBoat}||'%'
and d.sailor_name_kr like '%'||#{sailorNameKr}||'%'
and c.catch_fish_species like '%'||#{catchFishSpecies}||'%'
and c.offense_fish_species like '%'||#{offenseFishSpecies}||'%'
and c.confiscation_frame is not null
and c.confiscation_frame is null or c.confiscation_frame = 0
and c.confiscation_width is not null
and c.confiscation_width is null or c.confiscation_width = 0
and c.confiscation_jo is not null
and c.confiscation_jo is null or c.confiscation_jo = 0
and c.confiscation_gae is not null
and c.confiscation_gae is null or c.confiscation_gae = 0
and c.confiscation_etc is not null
and c.confiscation_etc is null or c.confiscation_etc = 0
and a.obstr_exspd_cnt >= #{obstrExspdCntMin}
and a.obstr_exspd_cnt <= #{obstrExspdCntMax}
and a.person_damage_cnt >= #{personDamageCntMin}
and a.person_damage_cnt <= #{personDamageCntMax}
and a.person_damage_amount >= #{personDamageAmountMin}
and a.person_damage_amount <= #{personDamageAmountMax}
and a.person_damage_detail like '%'||#{personDamageDetail}||'%'
and a.material_damage_cnt >= #{materialDamageCntMin}
and a.material_damage_cnt <= #{materialDamageCntMax}
and a.material_damage_amount >= #{materialDamageAmountMin}
and a.material_damage_amount <= #{materialDamageAmountMax}
and a.material_damage_detail like '%'||#{materialDamageDetail}||'%'
and e.captainRestriction > 0
and e.captainRestrictionNot > 0
and e.navigaterRestriction > 0
and e.navigaterRestrictionNot > 0
and e.engineerRestriction > 0
and e.engineerRestrictionNot > 0
and a.case_agency = #{caseAgency}
and a.crackdown_police = #{crackdownPolice}
and a.crackdown_boat = #{crackdownBoat}
and c.boat_name_kr like '%'||#{boatNameKr}||'%'
and c.boat_nny_sung like '%'||#{boatNnySung}||'%'
and c.boat_nny_si like '%'||#{boatNnySi}||'%'
and c.boat_material = #{boatMaterial}
and c.fishery_type = #{fisheryType}
and b.process_status = #{processStatus}
and c.ton_cnt >= #{tonMin}
and c.ton_cnt <= #{tonMax}
and
f.violationCode like '%'||#{violation}||'%'
and a.napo_dt >= #{startDate}::date
and a.napo_dt <= #{endDate}::date+1
and b.eviction_dt >= #{startDate}::date
and b.eviction_dt <= #{endDate}::date+1
and b.direct_handover_dt >= #{startDate}::date
and b.direct_handover_dt <= #{endDate}::date+1
and b.consignment_dt >= #{startDate}::date
and b.consignment_dt <= #{endDate}::date+1
and b.confiscation_dt >= #{startDate}::date
and b.confiscation_dt <= #{endDate}::date+1
and b.boat_disposal_dt >= #{startDate}::date
and b.boat_disposal_dt <= #{endDate}::date+1
and b.return_dt >= #{startDate}::date
and b.return_dt <= #{endDate}::date+1
and a.wrt_dt >= #{startDate}::date
and a.wrt_dt <= #{endDate}::date+1
and extract(year from a.napo_dt) = ${year}
and a.case_agency = #{caseAgency}
and a.crackdown_police = #{crackdownPolice}
and a.crackdown_boat = #{crackdownBoat}
and b.boat_name_kr like '%'||#{boatNameKr}||'%'
and b.boat_nny_sung like '%'||#{boatNnySung}||'%'
and b.boat_nny_si like '%'||#{boatNnySi}||'%'
and b.boat_material = #{boatMaterial}
and b.fishery_type = #{fisheryType}
and c.process_status = #{processStatus}
and b.ton_cnt >= #{tonMin}
and b.ton_cnt <= #{tonMax}
and
e.violationCode like '%'||#{violation}||'%'
and a.napo_dt >= #{startDate}::date
and a.napo_dt <= #{endDate}::date+1
and c.eviction_dt >= #{startDate}::date
and c.eviction_dt <= #{endDate}::date+1
and c.direct_handover_dt >= #{startDate}::date
and c.direct_handover_dt <= #{endDate}::date+1
and c.consignment_dt >= #{startDate}::date
and c.consignment_dt <= #{endDate}::date+1
and c.confiscation_dt >= #{startDate}::date
and c.confiscation_dt <= #{endDate}::date+1
and c.boat_disposal_dt >= #{startDate}::date
and c.boat_disposal_dt <= #{endDate}::date+1
and c.return_dt >= #{startDate}::date
and c.return_dt <= #{endDate}::date+1
and a.wrt_dt >= #{startDate}::date
and a.wrt_dt <= #{endDate}::date+1