2022-12-22 01:55:19 +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.main.fpiMgt.affair.mapper.AffairMapper">
|
|
|
|
|
<sql id="selectAffairBoardWhere">
|
|
|
|
|
<where>
|
|
|
|
|
<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>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType != "openReportList"'>
|
|
|
|
|
<if test='wrtOrgan != null and wrtOrgan != ""'>
|
|
|
|
|
and a.wrt_organ = #{wrtOrgan}
|
|
|
|
|
</if>
|
2022-12-22 01:55:19 +00:00
|
|
|
</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>
|
2023-01-18 04:29:41 +00:00
|
|
|
<choose>
|
2023-02-07 09:29:59 +00:00
|
|
|
<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>
|
2023-01-18 04:29:41 +00:00
|
|
|
</choose>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType != "openReportList"'>
|
|
|
|
|
<if test="downOrganCdList != null">
|
|
|
|
|
and a.wrt_organ in
|
|
|
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
|
|
|
#{organCd}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-12-22 01:55:19 +00:00
|
|
|
</if>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType != null and queryType != ""'>
|
|
|
|
|
<if test='queryType == "normalStayList"'>
|
2022-12-22 01:55:19 +00:00
|
|
|
and c.affair_status in ('DST002', 'DST004')
|
|
|
|
|
</if>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType == "normalCommitList"'>
|
2022-12-22 01:55:19 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
|
|
|
|
</if>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType == "sectionCommitList"'>
|
2022-12-22 01:55:19 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
|
|
|
</if>
|
2023-02-08 09:19:52 +00:00
|
|
|
<if test='queryType == "headCommitList"'>
|
2022-12-22 01:55:19 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
|
|
|
|
</if>
|
2023-02-08 09:19:52 +00:00
|
|
|
<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')
|
|
|
|
|
)
|
2022-12-22 01:55:19 +00:00
|
|
|
</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,
|
|
|
|
|
b.fileCnt,
|
2023-02-16 09:50:49 +00:00
|
|
|
c.rating_organ,
|
2022-12-22 01:55:19 +00:00
|
|
|
c.affair_status,
|
|
|
|
|
c.affair_rate,
|
2023-02-13 02:14:32 +00:00
|
|
|
c.organ_up,
|
|
|
|
|
a.doc_no
|
2022-12-22 01:55:19 +00:00
|
|
|
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
|
|
|
|
|
<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>
|
|
|
|
|
|
2023-02-13 10:14:14 +00:00
|
|
|
<select id="selectDocNo" resultType="string" parameterType="hashMap">
|
|
|
|
|
select count(*)+1 as cnt
|
|
|
|
|
from affair_board a
|
|
|
|
|
inner join affair_rating b
|
|
|
|
|
on a.affair_key = b.affair_key and a.wrt_organ = b.rating_organ and b.affair_status = 'DST006'
|
|
|
|
|
where wrt_organ = #{wrtOrgan}
|
2023-02-14 05:53:24 +00:00
|
|
|
and a.doc_no is not null
|
2023-02-13 10:14:14 +00:00
|
|
|
and EXTRACT(YEAR FROM report_dt) = #{year}::numeric
|
2023-02-13 02:14:32 +00:00
|
|
|
</select>
|
|
|
|
|
|
2022-12-22 01:55:19 +00:00
|
|
|
<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>
|
|
|
|
|
|
2023-02-27 09:59:19 +00:00
|
|
|
<select id="selectDashboardAffairList" parameterType="DashboardAffair" resultType="DashboardAffair">
|
2023-02-28 04:11:59 +00:00
|
|
|
select 'plan1' as board,
|
2023-02-27 09:59:19 +00:00
|
|
|
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
|
2023-02-28 04:11:59 +00:00
|
|
|
from plan_board a
|
2023-02-27 09:59:19 +00:00
|
|
|
<where>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='planApprv == null or planApprv == ""'>
|
|
|
|
|
and a.wrt_user_seq = #{userSeq}
|
|
|
|
|
</when>
|
|
|
|
|
<when test='planApprv == "APC004APC001" or planApprv == "APC003APC002"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and (a.plan_state = 'DST002' or a.plan_state = 'DST004')
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
<when test='planApprv == "APC004" or planApprv == "APC003"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and a.plan_state = 'DST002'
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
<when test='planApprv == "APC002" or planApprv == "APC001"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and a.plan_state = 'DST004'
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</where>
|
|
|
|
|
union all
|
2023-02-28 04:11:59 +00:00
|
|
|
select 'affair1' as board,
|
2023-02-27 09:59:19 +00:00
|
|
|
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
|
2023-02-28 04:11:59 +00:00
|
|
|
from result_board a
|
2023-02-27 09:59:19 +00:00
|
|
|
<where>
|
|
|
|
|
<choose>
|
|
|
|
|
<when test='resultApprv == null or resultApprv == ""'>
|
|
|
|
|
and a.wrt_user_seq = #{userSeq}
|
|
|
|
|
</when>
|
|
|
|
|
<when test='resultApprv == "APC004APC001" or resultApprv == "APC003APC002"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and (a.result_state = 'DST002' or a.result_state = 'DST004')
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
<when test='resultApprv == "APC004" or resultApprv == "APC003"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and a.result_state = 'DST002'
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
<when test='resultApprv == "APC002" or resultApprv == "APC001"'>
|
2023-02-28 04:11:59 +00:00
|
|
|
and a.wrt_organ = #{ogCd} and a.result_state = 'DST004'
|
2023-02-27 09:59:19 +00:00
|
|
|
</when>
|
|
|
|
|
</choose>
|
|
|
|
|
</where>
|
|
|
|
|
order by wrt_dt desc
|
|
|
|
|
limit 8
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDashboardIntelligenceNetworkList" parameterType="DashboardAffair" resultType="DashboardAffair">
|
2023-02-28 04:11:59 +00:00
|
|
|
select 'affair2' as board,
|
2023-02-27 09:59:19 +00:00
|
|
|
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>
|
2022-12-22 01:55:19 +00:00
|
|
|
</mapper>
|