541 lines
20 KiB
XML
541 lines
20 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.fpiMgt.affair.mapper.AffairMapper">
|
|
<sql id="selectAffairBoardWhere">
|
|
<where>
|
|
c.affair_status <> 'DST008'
|
|
<if test='affairCategory != null and affairCategory != ""'>
|
|
and a.affair_category = #{affairCategory}
|
|
</if>
|
|
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
|
|
and a.wrt_user_seq = #{wrtUserSeq}
|
|
</if>
|
|
<if test='wrtUserNm != null and wrtUserNm != ""'>
|
|
and a.wrt_user_nm like '%'||#{wrtUserNm}||'%'
|
|
</if>
|
|
<if test='queryType != "openReportList"'>
|
|
<if test='wrtOrgan != null and wrtOrgan != ""'>
|
|
and a.wrt_organ = #{wrtOrgan}
|
|
</if>
|
|
</if>
|
|
<if test='affairType1 != null and affairType1 != ""'>
|
|
and a.affair_type1 = #{affairType1}
|
|
</if>
|
|
<if test='affairType2 != null and affairType2 != ""'>
|
|
and a.affair_type2 = #{affairType2}
|
|
</if>
|
|
<if test='affairType3 != null and affairType3 != ""'>
|
|
and a.affair_type3 = #{affairType3}
|
|
</if>
|
|
<if test='affairType4 != null and affairType4 != ""'>
|
|
and a.affair_type4 = #{affairType4}
|
|
</if>
|
|
<if test='title != null and title != ""'>
|
|
and a.title like '%'||#{title}||'%'
|
|
</if>
|
|
<if test='affairStatus != null and affairStatus != ""'>
|
|
and c.affair_status = #{affairStatus}
|
|
</if>
|
|
<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>
|
|
<choose>
|
|
<when test='ratingOrgan != null and ratingOrgan != ""'>
|
|
and c.rating_organ = #{ratingOrgan}
|
|
</when>
|
|
<otherwise>
|
|
and (c.organ_up != 'T' or c.organ_up is null)
|
|
</otherwise>
|
|
</choose>
|
|
<if test='queryType != "openReportList"'>
|
|
<if test="downOrganCdList != null">
|
|
and a.wrt_organ in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
</if>
|
|
</if>
|
|
<if test='queryType != null and queryType != ""'>
|
|
<if test='queryType == "normalStayList"'>
|
|
and c.affair_status in ('DST002', 'DST004')
|
|
</if>
|
|
<if test='queryType == "normalCommitList"'>
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='queryType == "sectionCommitList"'>
|
|
and c.affair_status in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='queryType == "headCommitList"'>
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='queryType == "openReportList"'>
|
|
and view_status <> 'AVS001'
|
|
and (
|
|
(view_status = 'AVS002' and a.wrt_organ = #{wrtOrgan}) or
|
|
(view_status = 'AVS003' and a.wrt_organ in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
) or
|
|
<if test='groupOrganCdList!=null'>
|
|
(view_status = 'AVS005' and a.wrt_organ in
|
|
<foreach collection="groupOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
) or
|
|
</if>
|
|
(view_status = 'AVS004')
|
|
)
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
<select id="selectAffairBoardList" resultType="AffairBoard" parameterType="AffairBoard">
|
|
select a.affair_key,
|
|
a.affair_type1,
|
|
a.affair_type2,
|
|
a.affair_type3,
|
|
a.affair_type4,
|
|
a.title,
|
|
a.wrt_organ,
|
|
a.wrt_part,
|
|
a.wrt_user_nm,
|
|
a.wrt_user_seq,
|
|
a.wrt_dt,
|
|
a.report_dt,
|
|
a.doc_no,
|
|
b.fileCnt,
|
|
c.rating_organ,
|
|
c.affair_status,
|
|
c.affair_rate,
|
|
c.organ_up,
|
|
d.beforeRating
|
|
from affair_board a
|
|
left outer join (select affair_key,
|
|
count(file_seq) as fileCnt
|
|
from affair_file
|
|
group by affair_key) b
|
|
on a.affair_key = b.affair_key
|
|
inner join affair_rating c
|
|
on a.affair_key = c.affair_key
|
|
left outer join (
|
|
select affair_key, STRING_AGG(CAST(og.item_value||' : '||ar.item_value AS VARCHAR), ', ') as beforeRating
|
|
from affair_rating aa
|
|
inner join code_mgt og on aa.rating_organ = og.item_cd
|
|
inner join code_mgt ar on aa.affair_rate = ar.item_cd
|
|
group by affair_key
|
|
) d on a.affair_key = d.affair_key
|
|
<include refid="selectAffairBoardWhere"></include>
|
|
order by a.affair_key desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
<select id="selectAffairBoardCnt" resultType="int" parameterType="AffairBoard">
|
|
select count(*)
|
|
from affair_board a
|
|
inner join affair_rating c
|
|
on a.affair_key = c.affair_key
|
|
<include refid="selectAffairBoardWhere"></include>
|
|
</select>
|
|
<select id="selectHashTags" resultType="string" parameterType="int">
|
|
select array_to_string(array_agg(b.tag_nm), ' ') as hashTags
|
|
from hash_tag_link a
|
|
inner join hash_tag b on a.tag_key = b.tag_key
|
|
where a.affair_key = #{affairKey}
|
|
</select>
|
|
|
|
<select id="selectDocNo" resultType="int" parameterType="hashMap">
|
|
select count(*)+1 as cnt
|
|
from affair_board a
|
|
inner join affair_rating b
|
|
on a.affair_key = b.affair_key and b.affair_status = 'DST006' --and a.wrt_organ = b.rating_organ
|
|
where wrt_organ = #{wrtOrgan}
|
|
and a.doc_no is not null
|
|
and EXTRACT(YEAR FROM report_dt) = #{year}::numeric
|
|
</select>
|
|
|
|
<sql id="searchStatistics">
|
|
<if test='userNm != null and userNm != ""'>
|
|
and wrt_user_nm like '%'||#{userNm}||'%'
|
|
</if>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
|
|
and ab.affair_key in (
|
|
select affair_key
|
|
from affair_rating ar2
|
|
inner join organ_config oc2
|
|
on ar2.rating_organ = oc2.organ_cd
|
|
<where>
|
|
<if test='rating != null and rating != ""'>
|
|
and ar2.affair_rate in
|
|
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test='sangbo != null and sangbo != ""'>
|
|
and ar2.organ_up = 'T'
|
|
and oc2.organ_type in
|
|
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
)
|
|
</if>
|
|
</sql>
|
|
|
|
<select id="selectDashboardAffairList" parameterType="DashboardAffair" resultType="DashboardAffair">
|
|
select 'plan1' as board,
|
|
a.plan_key as key,
|
|
a.content_title as title,
|
|
a.wrt_user_grd as wrtUserGrd,
|
|
a.wrt_user_nm as wrtUserNm,
|
|
a.wrt_dt
|
|
from plan_board a
|
|
<where>
|
|
<choose>
|
|
<when test='planApprv == null or planApprv == ""'>
|
|
and a.wrt_user_seq = #{userSeq}
|
|
</when>
|
|
<when test='planApprv == "APC004APC001" or planApprv == "APC003APC002"'>
|
|
and a.wrt_organ = #{ogCd} and (a.plan_state = 'DST002' or a.plan_state = 'DST004')
|
|
</when>
|
|
<when test='planApprv == "APC004" or planApprv == "APC003"'>
|
|
and a.wrt_organ = #{ogCd} and a.plan_state = 'DST002'
|
|
</when>
|
|
<when test='planApprv == "APC002" or planApprv == "APC001"'>
|
|
and a.wrt_organ = #{ogCd} and a.plan_state = 'DST004'
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
union all
|
|
select 'affair1' as board,
|
|
a.affair_key as key,
|
|
a.title as title,
|
|
a.wrt_user_grd as wrtUserGrd,
|
|
a.wrt_user_nm as wrtUserNm,
|
|
a.wrt_dt
|
|
from affair_board a inner join affair_rating b on a.affair_key = b.affair_key and b.rating_organ = #{ogCd}
|
|
<where>
|
|
affair_category = 'CAT215'
|
|
<choose>
|
|
<when test='affairApprv == null or affairApprv == ""'>
|
|
and a.wrt_user_seq = #{userSeq}
|
|
</when>
|
|
<when test='affairApprv == "APC004APC001" or affairApprv == "APC003APC002"'>
|
|
and (b.affair_status = 'DST002' or b.affair_status = 'DST004')
|
|
</when>
|
|
<when test='affairApprv == "APC004" or affairApprv == "APC003"'>
|
|
and b.affair_status = 'DST002'
|
|
</when>
|
|
<when test='affairApprv == "APC002" or affairApprv == "APC001"'>
|
|
and b.affair_status = 'DST004'
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
union all
|
|
select 'result' as board,
|
|
a.result_key as key,
|
|
a.clear_title as title,
|
|
a.wrt_user_grd as wrtUserGrd,
|
|
a.wrt_user_nm as wrtUserNm,
|
|
a.wrt_dt
|
|
from result_board a
|
|
<where>
|
|
<choose>
|
|
<when test='resultApprv == null or resultApprv == ""'>
|
|
and a.wrt_user_seq = #{userSeq}
|
|
</when>
|
|
<when test='resultApprv == "APC004APC001" or resultApprv == "APC003APC002"'>
|
|
and a.wrt_organ = #{ogCd} and (a.result_state = 'DST002' or a.result_state = 'DST004')
|
|
</when>
|
|
<when test='resultApprv == "APC004" or resultApprv == "APC003"'>
|
|
and a.wrt_organ = #{ogCd} and a.result_state = 'DST002'
|
|
</when>
|
|
<when test='resultApprv == "APC002" or resultApprv == "APC001"'>
|
|
and a.wrt_organ = #{ogCd} and a.result_state = 'DST004'
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
order by wrt_dt desc
|
|
limit 8
|
|
</select>
|
|
<select id="selectDashboardIntelligenceNetworkList" parameterType="DashboardAffair" resultType="DashboardAffair">
|
|
select 'affair2' as board,
|
|
a.affair_key as key,
|
|
a.title as title,
|
|
a.wrt_user_grd as wrtUserGrd,
|
|
a.wrt_user_nm as wrtUserNm,
|
|
a.wrt_dt
|
|
from affair_board a inner join affair_rating b on a.affair_key = b.affair_key and b.rating_organ = #{ogCd}
|
|
<where>
|
|
affair_category = 'CAT216'
|
|
<choose>
|
|
<when test='affairApprv == null or affairApprv == ""'>
|
|
and a.wrt_user_seq = #{userSeq}
|
|
</when>
|
|
<when test='affairApprv == "APC004APC001" or affairApprv == "APC003APC002"'>
|
|
and (b.affair_status = 'DST002' or b.affair_status = 'DST004')
|
|
</when>
|
|
<when test='affairApprv == "APC004" or affairApprv == "APC003"'>
|
|
and b.affair_status = 'DST002'
|
|
</when>
|
|
<when test='affairApprv == "APC002" or affairApprv == "APC001"'>
|
|
and b.affair_status = 'DST004'
|
|
</when>
|
|
</choose>
|
|
</where>
|
|
order by wrt_dt desc
|
|
limit 8
|
|
</select>
|
|
<select id="selectApprvStayList" parameterType="DashboardAffair" resultType="DashboardAffair">
|
|
select 29 as board,
|
|
a.plan_key as key,
|
|
a.content_title as title,
|
|
a.wrt_dt
|
|
from plan_board a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.plan_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.plan_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 29)
|
|
)
|
|
or (
|
|
a.plan_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 29)
|
|
)
|
|
)
|
|
union all
|
|
select 30 as board,
|
|
a.affair_key as key,
|
|
a.title,
|
|
a.wrt_dt
|
|
from affair_board a
|
|
inner join affair_rating b on a.affair_key = b.affair_key and b.rating_organ = #{ogCd}
|
|
where a.affair_category = 'CAT215'
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and b.affair_status in ('DST002', 'DST004'))
|
|
or (
|
|
b.affair_status = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 30)
|
|
) or (
|
|
b.affair_status = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 30)
|
|
)
|
|
)
|
|
union all
|
|
select 31 as board,
|
|
a.result_key as key,
|
|
a.clear_title as title,
|
|
a.wrt_dt
|
|
from result_board a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.result_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.result_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 31)
|
|
) or (
|
|
a.result_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 31)
|
|
)
|
|
)
|
|
union all
|
|
select 32 as board,
|
|
a.op_key as key,
|
|
a.op_sdate||' '||a.op_name||' 운영 계획' as title,
|
|
a.wrt_dt
|
|
from operation_plan a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.op_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.op_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 32 )
|
|
) or (
|
|
a.op_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 32
|
|
)
|
|
)
|
|
)
|
|
union all
|
|
select 33 as board,
|
|
a.affair_key as key,
|
|
a.title,
|
|
a.wrt_dt
|
|
from affair_board a
|
|
inner join affair_rating b on a.affair_key = b.affair_key and b.rating_organ = #{ogCd}
|
|
where a.affair_category = 'CAT216'
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and b.affair_status in ('DST002', 'DST004'))
|
|
or (
|
|
b.affair_status = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 33 )
|
|
) or (
|
|
b.affair_status = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 33 )
|
|
)
|
|
)
|
|
union all
|
|
select 34 as board,
|
|
a.ia_key as key,
|
|
a.ia_sdate||'~'||a.ia_edate||' 운영 실적 분석' as title,
|
|
a.wrt_dt
|
|
from intelligence_analyze a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.ia_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.ia_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 34 )
|
|
) or (
|
|
a.ia_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 34 )
|
|
)
|
|
)
|
|
union all
|
|
select 35 as board,
|
|
a.fer_key as key,
|
|
b.op_name||' 해고(연장)보고' as title,
|
|
a.wrt_dt
|
|
from fire_extension_report a
|
|
inner join operation_plan b on a.op_key = b.op_key
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.fer_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.fer_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 35 )
|
|
) or (
|
|
a.fer_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 35 )
|
|
)
|
|
)
|
|
union all
|
|
select 36 as board,
|
|
a.md_key as key,
|
|
a.md_title as title,
|
|
a.wrt_dt
|
|
from monitoring_designation a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.md_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.md_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 36)
|
|
) or (
|
|
a.md_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 36)
|
|
)
|
|
)
|
|
union all
|
|
select 37 as board,
|
|
a.mr_key as key,
|
|
a.mr_title as title,
|
|
a.wrt_dt
|
|
from monitoring_result a
|
|
where
|
|
a.wrt_organ = #{ogCd}
|
|
and (
|
|
(a.wrt_user_seq = #{userSeq} and a.mr_state in ('DST002', 'DST004'))
|
|
or (
|
|
a.mr_state = 'DST002' and
|
|
( select ab.approval_auth ~ 'APC003' or ab.approval_auth ~ 'APC004'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 37)
|
|
) or (
|
|
a.mr_state = 'DST004' and
|
|
( select ab.approval_auth ~ 'APC001' or ab.approval_auth ~ 'APC002'
|
|
from menu_mgt aa
|
|
left outer join approval_config ab on aa.menu_key = ab.menu_key and ab.user_seq = #{userSeq}
|
|
where aa.menu_key = 37 )
|
|
)
|
|
)
|
|
union all
|
|
select 12 as board,
|
|
b.case_key as key,
|
|
b.title,
|
|
b.wrt_dt
|
|
from activity_case a
|
|
inner join activity_case_info b on a.receipt_key = b.receipt_key
|
|
where
|
|
b.status = 'DST007'
|
|
and a.wrt_organ = #{ogCd}
|
|
and (
|
|
a.wrt_user_seq = #{userSeq}
|
|
or b.case_key in (
|
|
select case_key
|
|
from activity_case_apprv
|
|
where user_seq = #{userSeq}
|
|
)
|
|
)
|
|
order by wrt_dt desc
|
|
limit 9
|
|
</select>
|
|
</mapper> |