458 lines
18 KiB
XML
458 lines
18 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.unlawfulFishing.mapper.UnlawfulFishingMapper">
|
|
|
|
<select id="selectFishingBoatYearParam" resultType="int">
|
|
select distinct extract(year from napo_dt) as year
|
|
from crackdown_status
|
|
where napo_dt is not null
|
|
</select>
|
|
|
|
<select id="selectCrackdownInfoList" resultType="CrackdownInfo" parameterType="UnlawfulFishingParam">
|
|
select a.cds_key ,
|
|
case_num ,
|
|
napo_dt ,
|
|
napo_sea_point_lon ,
|
|
napo_sea_point_lat ,
|
|
napo_sea_point_detail ,
|
|
invasion_type ,
|
|
nll ,
|
|
case_agency ,
|
|
case_police_officer ,
|
|
crackdown_police ,
|
|
crackdown_boat ,
|
|
mmsi ,
|
|
field_ivsgt ,
|
|
wrt_organ ,
|
|
wrt_part ,
|
|
wrt_user_grd ,
|
|
wrt_user_nm ,
|
|
wrt_dt ,
|
|
violationStr,
|
|
violationCode
|
|
from crackdown_info a
|
|
left outer join (
|
|
select aa.cds_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation_info aa
|
|
inner join code_mgt ab on aa.violation = ab.item_cd
|
|
group by aa.cds_key
|
|
) vi on a.cds_key = vi.cds_key
|
|
<include refid="selectCrackdownInfoListWhere"></include>
|
|
order by a.wrt_dt desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
<select id="selectCrackdownInfoListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from crackdown_info a
|
|
left outer join (
|
|
select aa.cds_key,
|
|
array_to_string(array_agg(ab.item_value), ', ') as violationStr,
|
|
array_to_string(array_agg(ab.item_cd), ', ') as violationCode
|
|
from violation_info aa
|
|
inner join code_mgt ab on aa.violation = ab.item_cd
|
|
group by aa.cds_key
|
|
) vi on a.cds_key = vi.cds_key
|
|
<include refid="selectCrackdownInfoListWhere"></include>
|
|
</select>
|
|
<sql id="selectCrackdownInfoListWhere">
|
|
where status <> 'DST008'
|
|
<if test='caseAgency != null and caseAgency != ""'>
|
|
and case_agency = #{caseAgency}
|
|
</if>
|
|
<if test='crackdownBoat != null and crackdownBoat != ""'>
|
|
and crackdown_boat = #{crackdownBoat}
|
|
</if>
|
|
<if test='searchKeyword != null and searchKeyword != ""'>
|
|
and (napo_sea_point_lon like '%'||#{searchKeyword}||'%'
|
|
or napo_sea_point_lat like '%'||#{searchKeyword}||'%'
|
|
or napo_sea_point_detail like '%'||#{searchKeyword}||'%'
|
|
or case_police_officer like '%'||#{searchKeyword}||'%'
|
|
or case_num like '%'||#{searchKeyword}||'%'
|
|
or person_damage_detail like '%'||#{searchKeyword}||'%'
|
|
or material_damage_detail like '%'||#{searchKeyword}||'%'
|
|
or catch_fish_species like '%'||#{searchKeyword}||'%')
|
|
</if>
|
|
<choose>
|
|
<when test='dateSelector == "napoDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and napo_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and napo_dt <= #{endDate}::date
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and wrt_dt <= #{endDate}::date
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
<choose>
|
|
<when test='accessAuth == "ACC003"'>
|
|
and (case_agency in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
or wrt_user_seq = #{viewUserSeq}
|
|
)
|
|
</when>
|
|
<otherwise>
|
|
and (case_agency = #{viewOrgan} or wrt_user_seq = #{viewUserSeq})
|
|
</otherwise>
|
|
</choose>
|
|
</sql>
|
|
|
|
<select id="selectIllegalShipInfoList" resultType="IllegalShipInfo" parameterType="UnlawfulFishingParam">
|
|
select fb_key,
|
|
a.cds_key ,
|
|
b.case_num ,
|
|
boat_name_kr,
|
|
permit_num,
|
|
nationality,
|
|
sailor_cnt,
|
|
ton_cnt,
|
|
fishery_type,
|
|
boat_material,
|
|
boat_nny_sung,
|
|
boat_nny_si,
|
|
a.wrt_organ ,
|
|
a.wrt_part ,
|
|
a.wrt_user_grd ,
|
|
a.wrt_user_nm ,
|
|
a.wrt_dt
|
|
from illegal_ship_info a
|
|
left outer join crackdown_info b on a.cds_key = b.cds_key
|
|
<include refid="selectIllegalShipInfoListWhere"></include>
|
|
order by a.wrt_dt desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
<select id="selectIllegalShipInfoListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from illegal_ship_info a
|
|
left outer join crackdown_info b on a.cds_key = b.cds_key
|
|
<include refid="selectIllegalShipInfoListWhere"></include>
|
|
</select>
|
|
<sql id="selectIllegalShipInfoListWhere">
|
|
where a.status <> 'DST008'
|
|
<if test='boatName != null and boatName != ""'>
|
|
and (a.boat_name_kr like '%'||#{boatName}||'%' or a.boat_name_cn like '%'||#{boatName}||'%')
|
|
</if>
|
|
<if test='searchKeyword != null and searchKeyword != ""'>
|
|
and (a.boat_nny_sung like '%'||#{searchKeyword}||'%'
|
|
or a.boat_nny_si like '%'||#{searchKeyword}||'%'
|
|
or a.nationality like '%'||#{searchKeyword}||'%'
|
|
or a.offense_type like '%'||#{searchKeyword}||'%'
|
|
or b.case_num like '%'||#{searchKeyword}||'%')
|
|
</if>
|
|
<choose>
|
|
<when test='dateSelector == "paymentDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and a.deposit_payment_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and a.deposit_payment_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and a.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and a.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
<choose>
|
|
<when test='accessAuth == "ACC003"'>
|
|
and (b.case_agency in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
or a.wrt_user_seq = #{viewUserSeq}
|
|
)
|
|
</when>
|
|
<otherwise>
|
|
and (b.case_agency = #{viewOrgan} or a.wrt_user_seq = #{viewUserSeq})
|
|
</otherwise>
|
|
</choose>
|
|
</sql>
|
|
|
|
<select id="selectShipProcessInfoList" resultType="ShipProcessInfo" parameterType="UnlawfulFishingParam">
|
|
select a.pr_key,
|
|
c.case_num ,
|
|
b.boat_name_kr ,
|
|
c.napo_dt ,
|
|
a.process_status ,
|
|
a.is_ivsgt_stop ,
|
|
a.sentencing_court ,
|
|
a.sentencing_detail ,
|
|
a.wrt_organ ,
|
|
a.wrt_part ,
|
|
a.wrt_user_grd ,
|
|
a.wrt_user_nm ,
|
|
a.wrt_dt
|
|
from ship_process_info a
|
|
inner join illegal_ship_info b on a.fb_key = b.fb_key
|
|
inner join crackdown_info c on b.cds_key = c.cds_key
|
|
<include refid="selectShipProcessInfoListWhere"></include>
|
|
order by a.wrt_dt desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
<select id="selectShipProcessInfoListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from ship_process_info a
|
|
inner join illegal_ship_info b on a.fb_key = b.fb_key
|
|
inner join crackdown_info c on b.cds_key = c.cds_key
|
|
<include refid="selectShipProcessInfoListWhere"></include>
|
|
</select>
|
|
<sql id="selectShipProcessInfoListWhere">
|
|
where a.status <> 'DST008'
|
|
<if test='boatName != null and boatName != ""'>
|
|
and (b.boat_name_kr like '%'||#{boatName}||'%' or b.boat_name_cn like '%'||#{boatName}||'%')
|
|
</if>
|
|
<if test='processStatus != null and processStatus != ""'>
|
|
and a.process_status = #{processStatus}
|
|
</if>
|
|
<if test='isIvsgtStop != null and isIvsgtStop != ""'>
|
|
and a.is_ivsgt_stop = #{isIvsgtStop}
|
|
</if>
|
|
<if test='searchKeyword != null and searchKeyword != ""'>
|
|
and (a.sentencing_detail like '%'||#{searchKeyword}||'%'
|
|
or a.sentencing_court like '%'||#{searchKeyword}||'%'
|
|
or c.case_num like '%'||#{searchKeyword}||'%'
|
|
or a.handover_boat like '%'||#{searchKeyword}||'%'
|
|
or a.middle_takeover_boat like '%'||#{searchKeyword}||'%')
|
|
</if>
|
|
<choose>
|
|
<when test='dateSelector == "napoDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and c.napo_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and c.napo_dt <= #{endDate}::date
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and a.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and a.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
<choose>
|
|
<when test='accessAuth == "ACC003"'>
|
|
and (c.case_agency in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
or a.wrt_user_seq = #{viewUserSeq}
|
|
)
|
|
</when>
|
|
<otherwise>
|
|
and (c.case_agency = #{viewOrgan} or a.wrt_user_seq = #{viewUserSeq})
|
|
</otherwise>
|
|
</choose>
|
|
</sql>
|
|
|
|
<select id="selectIllegalShipSailorList" resultType="IllegalShipSailor" parameterType="UnlawfulFishingParam">
|
|
select iss.sailor_key ,
|
|
isi.fb_key ,
|
|
isi.boat_name_kr ,
|
|
ci.case_num ,
|
|
iss.sailor_name_kr ,
|
|
iss.birthdate ,
|
|
iss.is_restriction ,
|
|
iss.position ,
|
|
iss.career ,
|
|
iss.similar_criminal_history ,
|
|
iss.heterogeneous_criminal_history ,
|
|
iss.arrest_history ,
|
|
iss.wrt_organ ,
|
|
iss.wrt_part ,
|
|
iss.wrt_user_grd ,
|
|
iss.wrt_user_nm ,
|
|
iss.wrt_dt
|
|
from illegal_ship_sailor iss
|
|
inner join illegal_ship_info isi on iss.fb_key = isi.fb_key
|
|
inner join crackdown_info ci on isi.cds_key = ci.cds_key
|
|
<include refid="selectIllegalShipSailorListWhere"></include>
|
|
order by iss.wrt_dt desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
|
|
<select id="selectIllegalShipSailorListCnt" resultType="int" parameterType="UnlawfulFishingParam">
|
|
select count(*)
|
|
from illegal_ship_sailor iss
|
|
inner join illegal_ship_info isi on iss.fb_key = isi.fb_key
|
|
inner join crackdown_info ci on isi.cds_key = ci.cds_key
|
|
<include refid="selectIllegalShipSailorListWhere"></include>
|
|
</select>
|
|
|
|
<sql id="selectIllegalShipSailorListWhere">
|
|
where iss.status <> 'DST008'
|
|
<if test='caseNum != null and caseNum != ""'>
|
|
and ci.case_num like '%'||#{caseNum}||'%'
|
|
</if>
|
|
<if test='boatName != null and boatName != ""'>
|
|
and (isi.boat_name_kr like '%'||#{boatName}||'%'
|
|
or isi.boat_name_cn like '%'||#{boatName}||'%')
|
|
</if>
|
|
<if test='sailorName != null and sailorName != ""'>
|
|
and (iss.sailorName_kr like '%'||#{sailorName}||'%'
|
|
or iss.sailorName_cn like '%'||#{sailorName}||'%')
|
|
</if>
|
|
<if test='position != null and position != ""'>
|
|
and iss.position = #{position}
|
|
</if>
|
|
<if test='career != null and career != ""'>
|
|
and iss.career = #{career}
|
|
</if>
|
|
<if test='similarCriminalHistory != null and similarCriminalHistory != ""'>
|
|
and iss.similar_criminal_history = #{similarCriminalHistory}
|
|
</if>
|
|
<if test='heterogeneousCriminalHistory != null and heterogeneousCriminalHistory != ""'>
|
|
and iss.heterogeneous_criminal_history = #{heterogeneousCriminalHistory}
|
|
</if>
|
|
<if test='arrestHistory != null and arrestHistory != ""'>
|
|
and iss.arrest_history = #{arrestHistory}
|
|
</if>
|
|
|
|
<choose>
|
|
<when test='dateSelector == "birthdate"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and iss.birthdate >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and iss.birthdate <= #{endDate}::date
|
|
</if>
|
|
</when>
|
|
<when test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and iss.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and iss.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
<choose>
|
|
<when test='accessAuth == "ACC003"'>
|
|
and (ci.case_agency in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
or iss.wrt_user_seq = #{viewUserSeq}
|
|
)
|
|
</when>
|
|
<otherwise>
|
|
and (ci.case_agency = #{viewOrgan} or iss.wrt_user_seq = #{viewUserSeq})
|
|
</otherwise>
|
|
</choose>
|
|
</sql>
|
|
|
|
<select id="selectStatisticsListType1" parameterType="StatisticsModel" resultType="StatisticsModel">
|
|
select vt.year,
|
|
violation_1,
|
|
violation_2_1,
|
|
violation_2_2,
|
|
violation_3,
|
|
violation_4,
|
|
violation_5_1,
|
|
violation_5_2,
|
|
deposit_unpaid,
|
|
deposit_payment,
|
|
detention_cnt,
|
|
detention_not_cnt,
|
|
forfeit_cnt,
|
|
dispose_cnt,
|
|
etc
|
|
from (
|
|
select year,
|
|
sum(violation_1) as violation_1, --무허가조업
|
|
sum(violation_2_1) as violation_2_1, --무허가조업(특정금지)
|
|
sum(violation_2_2) as violation_2_2, -- 정선명령불응(특정금지)
|
|
sum(violation_3) as violation_3, -- 제한조건위반
|
|
sum(violation_4) as violation_4, -- 영해침범
|
|
sum(violation_5_1) as violation_5_1, -- 공무집행방해(건)
|
|
sum(violation_5_2) as violation_5_2 -- 공무집행방해(척)
|
|
from (
|
|
select a.cds_key ,
|
|
EXTRACT(YEAR FROM a.napo_dt) as year,
|
|
case when b.violation = 'VT002' then ship_cnt else 0 end as violation_1,
|
|
case when b.violation = 'VT003' then ship_cnt else 0 end as violation_2_1,
|
|
case when b.violation = 'VT004' then ship_cnt else 0 end as violation_2_2,
|
|
case when substring(b.violation, 3, 3)::int >= 7 and substring(b.violation, 3, 3)::int <= 26 then ship_cnt else 0 end as violation_3,
|
|
case when b.violation = 'VT001' then ship_cnt else 0 end as violation_4,
|
|
case when b.violation = 'VT028' then 1 else 0 end as violation_5_1,
|
|
case when b.violation = 'VT028' then ship_cnt else 0 end as violation_5_2
|
|
from crackdown_info a
|
|
inner join violation_info b on a.cds_key = b.cds_key
|
|
inner join (select cds_key, count(*) as ship_cnt
|
|
from illegal_ship_info
|
|
where status <> 'DST008'
|
|
group by cds_key) d on a.cds_key = d.cds_key
|
|
where a.status <> 'DST008'
|
|
) vi
|
|
group by year
|
|
) vt
|
|
left outer join (
|
|
select EXTRACT(YEAR FROM a.napo_dt) as year,
|
|
sum(b.deposit_payment) as deposit_payment,
|
|
sum(b.deposit_unpaid) as deposit_unpaid
|
|
from crackdown_info a
|
|
inner join (
|
|
select cds_key, sum(deposit_payment) as deposit_payment, sum(deposit_unpaid) as deposit_unpaid
|
|
from illegal_ship_info
|
|
where status <> 'DST008'
|
|
group by cds_key
|
|
) b on a.cds_key = b.cds_key
|
|
where a.status <> 'DST008'
|
|
group by year
|
|
) dps on vt.year = dps.year
|
|
left outer join (
|
|
select year,
|
|
sum(detention_cnt) as detention_cnt,
|
|
sum(detention_not_cnt) as detention_not_cnt
|
|
from (
|
|
select EXTRACT(YEAR FROM a.napo_dt) as year,
|
|
case when is_restriction = 'Y' then 1 else 0 end as detention_cnt,
|
|
case when is_restriction = 'N' then 1 else 0 end as detention_not_cnt
|
|
from crackdown_info a
|
|
inner join illegal_ship_info b on a.cds_key = b.cds_key and b.status <> 'DST008'
|
|
inner join illegal_ship_sailor c on b.fb_key = c.fb_key and c.status <> 'DST008'
|
|
) a
|
|
group by year
|
|
) si on vt.year = si.year
|
|
left outer join (
|
|
select year,
|
|
sum(forfeit_cnt) as forfeit_cnt,
|
|
sum(dispose_cnt) as dispose_cnt
|
|
from (
|
|
select EXTRACT(YEAR FROM a.napo_dt) as year,
|
|
case when c.process_status = 'PR002' or c.process_status = 'PR003' then 1 else 0 end as forfeit_cnt,
|
|
case when c.process_status = 'PR005' or c.process_status = 'PR006' then 1 else 0 end as dispose_cnt
|
|
from crackdown_info a
|
|
inner join illegal_ship_info b on a.cds_key = b.cds_key and b.status <> 'DST008'
|
|
inner join ship_process_info c on b.fb_key = c.fb_key and c.status <> 'DST008'
|
|
) sp
|
|
group by year
|
|
) sp on sp.year = vt.year
|
|
left outer join ship_statistics_etc etc on vt.year = etc.year
|
|
where vt.year <= ${year} and vt.year >= ${year}-5
|
|
order by year desc
|
|
</select>
|
|
<select id="selectStatisticsListType2" parameterType="StatisticsModel" resultType="StatisticsModel">
|
|
</select>
|
|
<select id="selectStatisticsListType3" parameterType="StatisticsModel" resultType="StatisticsModel">
|
|
</select>
|
|
</mapper> |