2022-09-20 09:10:30 +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.fpiMgt.affair.mapper.AffairMapper">
|
2022-09-21 09:23:08 +00:00
|
|
|
<sql id="selectAffairBoardWhere">
|
2022-09-20 09:10:30 +00:00
|
|
|
<where>
|
2022-10-20 04:53:22 +00:00
|
|
|
<if test='affairCategory != null and affairCategory != ""'>
|
|
|
|
|
and a.affair_category = #{affairCategory}
|
|
|
|
|
</if>
|
2022-09-20 09:10:30 +00:00
|
|
|
<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='wrtOrgan != null and wrtOrgan != ""'>
|
|
|
|
|
and a.wrt_organ = #{wrtOrgan}
|
|
|
|
|
</if>
|
2022-10-05 01:05:36 +00:00
|
|
|
<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>
|
2022-09-21 09:23:08 +00:00
|
|
|
<if test='title != null and title != ""'>
|
|
|
|
|
and a.title like '%'||#{title}||'%'
|
2022-09-20 09:10:30 +00:00
|
|
|
</if>
|
2022-09-21 09:23:08 +00:00
|
|
|
<if test='affairStatus != null and affairStatus != ""'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status = #{affairStatus}
|
2022-09-20 09:10:30 +00:00
|
|
|
</if>
|
2022-09-27 09:24:25 +00:00
|
|
|
<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
|
2022-09-20 09:10:30 +00:00
|
|
|
</if>
|
2022-09-29 06:02:15 +00:00
|
|
|
<if test='ratingOrgan != null and ratingOrgan != ""'>
|
|
|
|
|
and c.rating_organ = #{ratingOrgan}
|
|
|
|
|
</if>
|
2022-09-20 09:10:30 +00:00
|
|
|
<if test="downOrganCdList != null">
|
|
|
|
|
and a.wrt_organ in
|
|
|
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
|
|
|
#{organCd}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
2022-09-27 09:24:25 +00:00
|
|
|
<if test='userType != null and userType != ""'>
|
|
|
|
|
<if test='userType == "normalStayList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST002', 'DST004')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
<if test='userType == "normalCommitList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
<if test='userType == "sectionCommitList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST004', 'DST005', 'DST006')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
<if test='userType == "headCommitList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
<if test='userType == "managerStayList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST002', 'DST004')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
<if test='userType == "managerCommitList"'>
|
2022-09-29 06:02:15 +00:00
|
|
|
and c.affair_status in ('DST003', 'DST005', 'DST006')
|
2022-09-27 09:24:25 +00:00
|
|
|
</if>
|
|
|
|
|
</if>
|
2022-09-20 09:10:30 +00:00
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectAffairBoardList" resultType="AffairBoard" parameterType="AffairBoard">
|
|
|
|
|
select a.affair_key,
|
2022-10-04 09:41:46 +00:00
|
|
|
a.affair_type1,
|
|
|
|
|
a.affair_type2,
|
|
|
|
|
a.affair_type3,
|
|
|
|
|
a.affair_type4,
|
2022-09-20 09:10:30 +00:00
|
|
|
a.title,
|
|
|
|
|
a.wrt_organ,
|
|
|
|
|
a.wrt_part,
|
|
|
|
|
a.wrt_user_nm,
|
|
|
|
|
a.wrt_user_seq,
|
|
|
|
|
a.wrt_dt,
|
2022-09-29 06:02:15 +00:00
|
|
|
b.fileCnt,
|
2022-09-30 09:24:24 +00:00
|
|
|
c.affair_status,
|
|
|
|
|
c.affair_rate,
|
|
|
|
|
c.organ_up
|
2022-09-20 09:10:30 +00:00
|
|
|
from affair_board a
|
2022-09-29 06:02:15 +00:00
|
|
|
left outer join (select affair_key,
|
2022-09-20 09:10:30 +00:00
|
|
|
count(file_seq) as fileCnt
|
|
|
|
|
from affair_file
|
|
|
|
|
group by affair_key) b
|
2022-09-29 06:02:15 +00:00
|
|
|
on a.affair_key = b.affair_key
|
|
|
|
|
inner join affair_rating c
|
|
|
|
|
on a.affair_key = c.affair_key
|
2022-09-21 09:23:08 +00:00
|
|
|
<include refid="selectAffairBoardWhere"></include>
|
2022-09-29 06:02:15 +00:00
|
|
|
order by a.affair_key desc
|
2022-09-20 09:10:30 +00:00
|
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
|
|
|
</select>
|
2022-09-21 09:23:08 +00:00
|
|
|
<select id="selectAffairBoardCnt" resultType="int" parameterType="AffairBoard">
|
2022-09-20 09:10:30 +00:00
|
|
|
select count(*)
|
|
|
|
|
from affair_board a
|
2022-09-29 06:02:15 +00:00
|
|
|
inner join affair_rating c
|
|
|
|
|
on a.affair_key = c.affair_key
|
2022-09-21 09:23:08 +00:00
|
|
|
<include refid="selectAffairBoardWhere"></include>
|
2022-09-20 09:10:30 +00:00
|
|
|
</select>
|
2022-09-23 07:34:16 +00:00
|
|
|
<select id="selectHashTags" resultType="string" parameterType="int">
|
|
|
|
|
select aa.hashTags
|
|
|
|
|
from (select a.affair_key,
|
|
|
|
|
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}
|
|
|
|
|
group by a.affair_key) aa
|
|
|
|
|
</select>
|
2022-09-20 09:10:30 +00:00
|
|
|
</mapper>
|