2022-09-20 05:35:50 +00:00
<?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.equip.mapper.EquipMapper" >
2022-09-20 08:56:48 +00:00
<select id= "selectEquipStatus" resultType= "com.dbnt.faisp.util.ParamMap" parameterType= "Equip" >
select category_cd,
equ_type,
item_value,
item_cd,
sum( cnt_bon+
cnt_center+
cnt_incheon+
cnt_pyeongtaek+
cnt_taean+
cnt_boryeong+
cnt_west+
cnt_mokpo+
cnt_buan+
cnt_gunsan+
cnt_yusu+
cnt_wando+
cnt_south+
cnt_ulsan+
cnt_busan+
cnt_changwon+
cnt_tongyong+
cnt_sacheon+
cnt_east+
cnt_sokcho+
cnt_donghe+
cnt_ulgin+
cnt_pohang+
cnt_jeju+
cnt_jejuseo+
cnt_seoguipo) as total,
sum(cnt_bon) as cnt_bon,
sum(cnt_center) as cnt_center,
sum(cnt_incheon) as cnt_incheon,
sum(cnt_pyeongtaek) as cnt_pyeongtaek,
sum(cnt_taean) as cnt_taean,
sum(cnt_boryeong) as cnt_boryeong,
sum(cnt_west) as cnt_west,
sum(cnt_mokpo) as cnt_mokpo,
sum(cnt_buan) as cnt_buan,
sum(cnt_gunsan) as cnt_gunsan,
sum(cnt_yusu) as cnt_yusu,
sum(cnt_wando) as cnt_wando,
sum(cnt_south) as cnt_south,
sum(cnt_ulsan) as cnt_ulsan,
sum(cnt_busan) as cnt_busan,
sum(cnt_changwon) as cnt_changwon,
sum(cnt_tongyong) as cnt_tongyong,
sum(cnt_sacheon) as cnt_sacheon,
sum(cnt_east) as cnt_east,
sum(cnt_sokcho) as cnt_sokcho,
sum(cnt_donghe) as cnt_donghe,
sum(cnt_ulgin) as cnt_ulgin,
sum(cnt_pohang) as cnt_pohang,
sum(cnt_jeju) as cnt_jeju,
sum(cnt_jejuseo) as cnt_jejuseo,
sum(cnt_seoguipo) as cnt_seoguipo
from(
select a.category_cd,
a.item_cd,
(select item_value from code_mgt cmt where a.category_cd = cmt.item_cd) as equ_type,
a.item_value,
case
when b.mgt_organ = 'OG001' then b.item_qty
else 0
end as cnt_bon,
case
when b.mgt_organ = 'OG002' then b.item_qty
else 0
end as cnt_center,
case
when b.mgt_organ = 'OG007' then b.item_qty
else 0
end as cnt_incheon,
case
when b.mgt_organ = 'OG008' then b.item_qty
else 0
end as cnt_pyeongtaek,
case
when b.mgt_organ = 'OG009' then b.item_qty
else 0
end as cnt_taean,
case
when b.mgt_organ = 'OG010' then b.item_qty
else 0
end as cnt_boryeong,
case
when b.mgt_organ = 'OG003' then b.item_qty
else 0
end as cnt_west,
case
when b.mgt_organ = 'OG011' then b.item_qty
else 0
end as cnt_mokpo,
case
when b.mgt_organ = 'OG012' then b.item_qty
else 0
end as cnt_buan,
case
when b.mgt_organ = 'OG013' then b.item_qty
else 0
end as cnt_gunsan,
case
when b.mgt_organ = 'OG014' then b.item_qty
else 0
end as cnt_yusu,
case
when b.mgt_organ = 'OG015' then b.item_qty
else 0
end as cnt_wando,
case
when b.mgt_organ = 'OG004' then b.item_qty
else 0
end as cnt_south,
case
when b.mgt_organ = 'OG016' then b.item_qty
else 0
end as cnt_ulsan,
case
when b.mgt_organ = 'OG017' then b.item_qty
else 0
end as cnt_busan,
case
when b.mgt_organ = 'OG018' then b.item_qty
else 0
end as cnt_changwon,
case
when b.mgt_organ = 'OG019' then b.item_qty
else 0
end as cnt_tongyong,
case
when b.mgt_organ = 'OG020' then b.item_qty
else 0
end as cnt_sacheon,
case
when b.mgt_organ = 'OG005' then b.item_qty
else 0
end as cnt_east,
case
when b.mgt_organ = 'OG021' then b.item_qty
else 0
end as cnt_sokcho,
case
when b.mgt_organ = 'OG022' then b.item_qty
else 0
end as cnt_donghe,
case
when b.mgt_organ = 'OG023' then b.item_qty
else 0
end as cnt_ulgin,
case
when b.mgt_organ = 'OG024' then b.item_qty
else 0
end as cnt_pohang,
case
when b.mgt_organ = 'OG006' then b.item_qty
else 0
end as cnt_jeju,
case
when b.mgt_organ = 'OG025' then b.item_qty
else 0
end as cnt_jejuseo,
case
when b.mgt_organ = 'OG026' then b.item_qty
else 0
end as cnt_seoguipo
from (select category_cd,
item_cd,
item_value
from code_mgt
where category_cd in('IT1','IT2','IT3','IT4')
order by category_cd,item_cd asc) a left outer join
(select a.equ_key,
a.version_no,
mgt_organ,
equ_type,
detail_type,
item_qty
from equ_mgt a,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
code_mgt cm
where a.equ_key = b.equ_key
and a.version_no = b.lastVer
group by a.equ_key,a.version_no) b on a.item_cd = b.detail_type
order by a.category_cd,a.item_cd asc
) c
group by c.category_cd,c.equ_type,c.item_value,item_cd
order by category_cd,item_cd asc
</select>
2022-09-21 08:51:28 +00:00
<select id= "selectEquipList" resultType= "Equip" parameterType= "Equip" >
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection= "downOrganCdList" item= "item" index= "index" separator= "," open= "(" close= ")" >
#{item}
</foreach>
2022-09-26 00:38:58 +00:00
order by equ_key desc
limit #{rowCnt} offset #{firstIndex}
2022-09-21 08:51:28 +00:00
</select>
<select id= "selectEquipListCnt" resultType= "int" parameterType= "Equip" >
select count(*)
from(
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else (select item_value from code_mgt cm where cm.item_cd = oc.parent_organ )
end as sosok,
case
when oc.organ_type = 'OGC003' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else null
end as detail_sosok,
equ_type,
detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef,
organ_config oc
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and detail_type = #{detailType}
and mgt_organ in
<foreach collection= "downOrganCdList" item= "item" index= "index" separator= "," open= "(" close= ")" >
#{item}
</foreach>
order by equ_key asc
) a
</select>
<select id= "selectEquipInfo" resultType= "Equip" parameterType= "Equip" >
select em.equ_key,
em.version_no,
mgt_organ,
equ_type,
(select item_value from code_mgt cm where cm.item_cd = detail_type ) as detail_Name,
detail_type,
stored_year,
item_qty,
item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
(select equ_key,max(version_no) as lastVer
from equ_mgt group by equ_key) b,
equ_file ef
where em.equ_key = b.equ_key
and em.version_no = b.lastVer
and em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.equ_key = #{equKey}
</select>
<select id= "selectEduType" resultType= "com.dbnt.faisp.util.ParamMap" parameterType= "Equip" >
select (select item_value from code_mgt cm where cm.item_cd = a.category_cd) as equ_type,
(select item_value from code_mgt cm where cm.item_cd = a.item_cd) as detail_type
from code_mgt a
where item_cd = #{detailType}
</select>
2022-09-26 00:38:58 +00:00
<select id= "selectHistoryDetail" resultType= "Equip" parameterType= "Equip" >
select em.equ_key,
em.version_no,
mgt_organ,
case
when oc.organ_type = 'OGC001' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
when oc.organ_type = 'OGC002' then (select item_value from code_mgt cm where cm.item_cd = oc.organ_cd )
else CONCAT((select item_value from code_mgt cm where cm.item_cd = oc.parent_organ ),'-',(select item_value from code_mgt cm where cm.item_cd = oc.organ_cd ))
end as sosok,
(select item_value from code_mgt cm where cm.item_cd = equ_type ) as equ_type,
(select item_value from code_mgt cm where cm.item_cd = detail_type ) as detail_type,
stored_year,
item_qty,
(select item_value from code_mgt cm where cm.item_cd = item_condition ) as item_condition,
note,
ef.orig_nm,
ef.conv_nm,
ef.file_path
from equ_mgt em,
equ_file ef,
organ_config oc
where em.equ_key = ef.equ_key
and em.version_no = ef.version_no
and em.mgt_organ = oc.organ_cd
and em.equ_key = #{equKey}
and em.version_no = #{versionNo}
</select>
2022-09-20 08:56:48 +00:00
2022-09-20 05:35:50 +00:00
</mapper>