2022-12-29 09:16:45 +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.counterIntelligence.mapper.CounterIntelligenceMapper">
|
2022-12-30 09:01:34 +00:00
|
|
|
<sql id="selectCounterIntelligenceWorkListWhere">
|
|
|
|
|
<where>
|
|
|
|
|
<if test='wrtUserSeq != null and wrtUserSeq != 0'>
|
|
|
|
|
and (a.wrt_user_seq = #{wrtUserSeq} and a.status = 'DST002') or a.status = 'DST007'
|
|
|
|
|
</if>
|
|
|
|
|
<if test='workRating != null and workRating != ""'>
|
|
|
|
|
and a.work_rating = #{workRating}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='arrestType1 != null and arrestType1 != ""'>
|
|
|
|
|
and a.arrest_type1 = #{arrestType1}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='arrestType2 != null and arrestType2 != ""'>
|
|
|
|
|
and a.arrest_type2 = #{arrestType2}
|
|
|
|
|
</if>
|
|
|
|
|
<if test='title != null and title != ""'>
|
|
|
|
|
and a.title like '%'||#{title}||'%'
|
|
|
|
|
</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>
|
|
|
|
|
<if test='hashTags != null and hashTags != ""'>
|
|
|
|
|
and a.ciw_key in (
|
|
|
|
|
select aa.ciw_key
|
|
|
|
|
from hash_tag_link_ciw aa
|
|
|
|
|
inner join hash_tag ab on aa.tag_key = ab.tag_key
|
|
|
|
|
where ab.tag_nm like '%'||#{hashTags}||'%'
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test='dateSelector == "workStartDate"'>
|
|
|
|
|
<if test='startDate != null and startDate != ""'>
|
|
|
|
|
and a.work_start_date >= #{startDate}::date
|
|
|
|
|
</if>
|
|
|
|
|
<if test='endDate != null and endDate != ""'>
|
|
|
|
|
and a.work_start_date <= #{endDate}::date+1
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test='dateSelector == "workEndDate"'>
|
|
|
|
|
<if test='startDate != null and startDate != ""'>
|
|
|
|
|
and a.work_end_date >= #{startDate}::date
|
|
|
|
|
</if>
|
|
|
|
|
<if test='endDate != null and endDate != ""'>
|
|
|
|
|
and a.work_end_date <= #{endDate}::date+1
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test='dateSelector == "reRatingDate1"'>
|
|
|
|
|
<if test='startDate != null and startDate != ""'>
|
|
|
|
|
and a.re_rating_date1 >= #{startDate}::date
|
|
|
|
|
</if>
|
|
|
|
|
<if test='endDate != null and endDate != ""'>
|
|
|
|
|
and a.re_rating_date1 <= #{endDate}::date+1
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test='dateSelector == "reRatingDate2"'>
|
|
|
|
|
<if test='startDate != null and startDate != ""'>
|
|
|
|
|
and a.re_rating_date2 >= #{startDate}::date
|
|
|
|
|
</if>
|
|
|
|
|
<if test='endDate != null and endDate != ""'>
|
|
|
|
|
and a.re_rating_date2 <= #{endDate}::date+1
|
|
|
|
|
</if>
|
|
|
|
|
</if>
|
|
|
|
|
<if test='dateSelector == "wrtDt"'>
|
|
|
|
|
<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>
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</sql>
|
|
|
|
|
<select id="selectCounterIntelligenceWorkList" parameterType="CounterIntelligenceWork" resultType="CounterIntelligenceWork">
|
|
|
|
|
select a.ciw_key,
|
|
|
|
|
a.status,
|
|
|
|
|
a.work_rating,
|
|
|
|
|
a.work_start_date,
|
|
|
|
|
a.work_end_date,
|
|
|
|
|
a.re_rating_date1,
|
|
|
|
|
a.re_rating_date2,
|
|
|
|
|
a.arrest_type1,
|
|
|
|
|
a.arrest_type2,
|
|
|
|
|
a.title,
|
|
|
|
|
a.wrt_organ,
|
|
|
|
|
a.wrt_part,
|
|
|
|
|
a.wrt_user_seq,
|
|
|
|
|
a.wrt_user_grd,
|
|
|
|
|
a.wrt_user_nm,
|
|
|
|
|
a.wrt_dt,
|
|
|
|
|
b.fileCnt
|
|
|
|
|
from counter_intelligence_work a
|
|
|
|
|
inner join (select ciw_key, count(*) as fileCnt from ciw_file group by ciw_key) b
|
|
|
|
|
on a.ciw_key = b.ciw_key
|
|
|
|
|
<include refid="selectCounterIntelligenceWorkListWhere"></include>
|
|
|
|
|
ORDER BY a.ciw_key DESC
|
|
|
|
|
LIMIT #{rowCnt} OFFSET #{firstIndex}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectCounterIntelligenceWorkCnt" parameterType="CounterIntelligenceWork" resultType="int">
|
|
|
|
|
select count(*)
|
|
|
|
|
from counter_intelligence_work a
|
|
|
|
|
inner join (select ciw_key, count(*) as fileCnt from ciw_file group by ciw_key) b
|
|
|
|
|
on a.ciw_key = b.ciw_key
|
|
|
|
|
<include refid="selectCounterIntelligenceWorkListWhere"></include>
|
|
|
|
|
</select>
|
2022-12-29 09:16:45 +00:00
|
|
|
<select id="selectHashTags" resultType="string" parameterType="int">
|
|
|
|
|
select array_to_string(array_agg(b.tag_nm), ' ') as hashTags
|
|
|
|
|
from hash_tag_link_ciw a
|
|
|
|
|
inner join hash_tag b on a.tag_key = b.tag_key
|
|
|
|
|
where a.ciw_key = #{ciwKey}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|