and pi_state in ('DST001', 'DST007')
and pi_state = #{piState}
and mgt_organ in
#{item}
and mgt_organ = #{mgtOrgan}
and land_police LIKE CONCAT('%', #{landPolice}, '%')
and mp_work_type = #{mpWorkType}
and pl_work_type = #{plWorkType}
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
select pi.pi_seq,
version_no,
(select item_value from code_mgt where item_cd = mgt_organ) as mgt_organ,
land_police,
(select item_value from code_mgt where item_cd = mp_work_type) as mp_work_type,
mp_people_cnt,
mp_description,
(select item_value from code_mgt where item_cd = pl_work_type) as pl_work_type,
pl_people_cnt,
pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type,
rent_price,
utility_type,
utility_price,
wrt_user_seq,
wrt_dt,
pi_state
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
order by pi_seq desc
limit #{rowCnt} offset #{firstIndex}
select count(*)
from(
select pi.pi_seq,
version_no,
mgt_organ,
land_police,
mp_work_type,
mp_people_cnt,
mp_description,
pl_work_type,
pl_people_cnt,
pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
order by wrt_dt desc
) a
select sum(mp_sangju) as mp_sangju,
sum(mp_sangju_cnt) as mp_sangju_total,
sum(mp_bsangju) as mp_bsangju,
sum(mp_bsangju_cnt) as mp_bsangju_total,
sum(mp_closure) as mp_closure,
sum(mp_closure_cnt) as mp_closure_total,
sum(pl_sangju) as pl_sangju,
sum(pl_sangju_cnt) as pl_sangju_total,
sum(pl_bsangju) as pl_bsangju,
sum(pl_bsangju_cnt) as pl_bsangju_total,
sum(pl_closure) as pl_closure,
sum(pl_closure_cnt) as pl_closure_total
from(
select case
when mp_work_type = 'PIS001' then coalesce(mp_people_cnt,0)
else 0
end as mp_sangju_cnt,
case
when mp_work_type = 'PIS002' then coalesce(mp_people_cnt,0)
else 0
end as mp_bsangju_cnt,
case
when mp_work_type = 'PIS003' then coalesce(mp_people_cnt,0)
else 0
end as mp_closure_cnt,
case
when pl_work_type = 'PIS001' then coalesce(pl_people_cnt,0)
else 0
end as pl_sangju_cnt,
case
when pl_work_type = 'PIS002' then coalesce(pl_people_cnt,0)
else 0
end as pl_bsangju_cnt,
case
when pl_work_type = 'PIS003' then coalesce(pl_people_cnt,0)
else 0
end as pl_closure_cnt,
case
when mp_work_type = 'PIS001' then 1
else 0
end as mp_sangju,
case
when mp_work_type = 'PIS002' then 1
else 0
end as mp_bsangju,
case
when mp_work_type = 'PIS003' then 1
else 0
end as mp_closure,
case
when pl_work_type = 'PIS001' then 1
else 0
end as pl_sangju,
case
when pl_work_type = 'PIS002' then 1
else 0
end as pl_bsangju,
case
when pl_work_type = 'PIS003' then 1
else 0
end as pl_closure
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_state = 'DST007'
and pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
group by pi.pi_seq, version_no
) a
select pi.pi_seq,
version_no,
mgt_organ,
land_police,
mp_work_type,
mp_people_cnt,
mp_description,
pl_work_type,
pl_people_cnt,
pl_description,
pi_user_seq,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt,
pi_state
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and pi.pi_seq = #{piSeq}
select file_seq,
pif.pi_seq,
version_no,
orig_nm,
conv_nm,
file_extn,
file_size,
file_path
from part_info_file pif,
(select pi_seq,max(version_no) as lastVer
from part_info_file group by pi_seq) b
where pif.pi_seq = b.pi_seq
and pif.version_no = b.lastVer
and pif.pi_seq = #{piSeq}
select pi_seq,
version_no,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from part_info
where pi_seq = #{piSeq}
order by version_no desc
select wrt_user_seq
from part_info
where pi_seq = #{piSeq}
order by version_no asc
limit 1
select pi.pi_seq,
terminal_nm
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and pi.pi_state = 'DST007'
and mgt_organ in
#{item}
order by terminal_nm asc
and pi.mgt_organ in
#{item}
and pi.mgt_organ = #{wrtOrgan}
select pw.pw_seq,
pw.pi_seq ,
pi.terminal_nm,
pi.pi_state as terminalStatus,
(select item_value from code_mgt where item_cd = pw.wrt_title) as wrt_title,
pw.wrt_nm,
pw.wrt_user_seq,
pw.work_dt,
pw.save_yn,
work_type,
pw.description,
(select count(*) from part_work_file pwf where pw.pw_seq = pwf.pw_seq and pw.pi_seq = pwf.pi_seq) as file_cnt,
pw.wrt_dt
from part_work pw,
part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pw.pi_seq = pi.pi_seq
and pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
order by pw.wrt_dt desc
limit #{rowCnt} offset #{firstIndex}
select count(*)
from(
select pw.pw_seq,
pw.pi_seq ,
pi.terminal_nm,
pw.wrt_nm,
pw.work_dt,
pw.save_yn,
work_type,
case
when pw.work_type = 'CH' then 'O'
end as work_type_ch,
case
when pw.work_type = 'POCI' then 'O'
end as work_type_poci,
case
when pw.work_type = 'SRI' then 'O'
end as work_type_sri,
case
when pw.work_type = 'JI' then 'O'
end as work_type_ji,
case
when pw.work_type = 'MT' then 'O'
end as work_type_mt,
case
when pw.work_type = 'ETC' then 'O'
end as work_type_etc,
pw.description,
(select count(*) from part_work_file pwf where pw.pw_seq = pwf.pw_seq and pw.pi_seq = pwf.pi_seq) as file_cnt,
pw.wrt_dt
from part_work pw,
part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pw.pi_seq = pi.pi_seq
and pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
order by pw.wrt_dt desc
) a
select pw.pw_seq,
pw.pi_seq ,
pi.terminal_nm,
(select item_value from code_mgt where item_cd = pw.wrt_title) as wrt_title,
pw.wrt_nm,
pw.work_dt,
pw.save_yn,
pw.work_info,
work_type,
pw.description,
pw.wrt_nm,
pw.wrt_dt
from part_work pw,
part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pw.pi_seq = pi.pi_seq
and pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and pw.pw_seq = #{pwSeq}
and pw.pi_seq = #{piSeq}
select item_cd,
item_value
from code_mgt cm,
organ_config oc
where cm.item_cd = oc.organ_cd
and oc.organ_type = 'OGC003'
and cm.use_chk = 'T'
and cm.item_cd in
#{item}
order by cm.order_num, cm.item_cd asc
select gubun,
parent_organ,
item_cd,
item_value,
sum(A) as A,
sum(B) as B,
sum(C) as C
from(
select gubun,
parent_organ,
item_cd,
item_value,
case
when bv.vuln_type = 'VULNT001' then 1
else 0
end as A,
case
when bv.vuln_type = 'VULNT002' then 1
else 0
end as B,
case
when bv.vuln_type = 'VULNT003' then 1
else 0
end as C
from(
select (select item_value from code_mgt cm2 where cm2.item_cd = oc.parent_organ) as gubun,
oc.parent_organ,
item_cd,
item_value
from code_mgt cm,
organ_config oc
where cm.item_cd = oc.organ_cd
and oc.organ_type not in ('OGC001')
and oc.organ_type = 'OGC003'
) a left outer join board_vuln bv
on a.item_cd = bv.mgt_organ
) a
and a.item_cd in
#{organCd}
group by gubun,parent_organ,item_cd,item_value
order by parent_organ
select vuln_key,
mgt_organ,
vuln_nm,
(select item_value from code_mgt where item_cd = vuln_type) as vuln_type,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from board_vuln
where mgt_organ = #{mgtOrgan}
and mgt_organ in
#{item}
order by wrt_dt desc
select item_value
from code_mgt
where item_cd = #{mgtOrgan}
select vuln_key,
vuln_nm,
mgt_organ,
(select item_value from code_mgt where item_cd = vuln_type) as vuln_type,
description,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_user_seq,
wrt_dt
from board_vuln
where vuln_key = #{vulnKey}
and si.si_type = #{siType}
and start_point like '%'||#{startPoint}||'%'
and end_point like '%'||#{endPoint}||'%'
and distance_nm like '%'||#{distanceNm}||'%'
and owner_nm like '%'||#{ownerNm}||'%'
and ship_nm like '%'||#{shipNm}||'%'
and operation_cnt like '%'||#{operationCnt}||'%'
and wrt_dt >= #{startDate}::date
and wrt_dt <= #{endDate}::date
and wrt_organ = #{wrtOrgan}
and wrt_organ in
#{organCd}
select si.si_seq,
version_no,
si.si_type,
start_point,
end_point,
distance_nm,
distance_km,
owner_nm,
ship_nm,
ship_weight,
passenger_cnt,
freight_cnt,
operation_cnt,
close_yn,
wrt_dt
from ship_info si,
(select si_seq, si_type ,max(version_no) as lastVer
from ship_info group by si_seq, si_type) b
where si.si_seq = b.si_seq
and si.si_type = b.si_type
and si.version_no = b.lastVer
order by si.si_seq desc
limit #{rowCnt} offset #{firstIndex}
select count(*)
from(
select si.si_seq,
version_no,
si_type,
start_point,
end_point,
distance_nm,
distance_km,
owner_nm,
ship_nm,
ship_weight,
passenger_cnt,
freight_cnt,
operation_cnt,
close_yn,
wrt_dt
from ship_info si,
(select si_seq ,max(version_no) as lastVer
from ship_info group by si_seq) b
where si.si_seq = b.si_seq
and si.version_no = b.lastVer
order by si.si_seq desc
) a
select si.si_seq,
version_no,
si_type,
start_point,
end_point,
distance_nm,
distance_km,
owner_nm,
ship_nm,
ship_weight,
passenger_cnt,
freight_cnt,
operation_cnt,
close_yn,
description,
wrt_dt
from ship_info si,
(select si_seq ,max(version_no) as lastVer
from ship_info group by si_seq) b
where si.si_seq = b.si_seq
and si.version_no = b.lastVer
and si.si_seq = #{siSeq}
and si.si_type = #{siType}
select si_seq,
version_no,
si_type,
start_point,
end_point,
distance_nm,
distance_km,
owner_nm,
ship_nm,
ship_weight,
passenger_cnt,
freight_cnt,
operation_cnt,
close_yn,
description,
(select item_value from code_mgt where item_cd = wrt_title) as wrt_title,
wrt_nm,
wrt_dt
from ship_info
where si_seq = #{siSeq}
and si_type = #{siType}
select si.si_seq,
version_no,
si_type,
start_point,
end_point,
distance_nm,
distance_km,
owner_nm,
ship_nm,
ship_weight,
passenger_cnt,
freight_cnt,
operation_cnt,
close_yn,
to_char(wrt_dt, 'YYYY-MM-DD HH24:MI') as wrt_dt
from ship_info si,
(select si_seq ,max(version_no) as lastVer
from ship_info group by si_seq) b
where si.si_seq = b.si_seq
and si.version_no = b.lastVer
and si.si_type = #{siType}
order by si.si_seq desc