516 lines
16 KiB
XML
516 lines
16 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.intelligenceNetwork.mapper.IntelligenceNetworkMapper">
|
|
<sql id="selectOperationPlanListWhere">
|
|
<where>
|
|
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
|
|
and op.wrt_user_seq = #{wrtUserSeq}
|
|
</if>
|
|
<if test='opName != null and opName != ""'>
|
|
and op.op_name like '%'||#{opName}||'%'
|
|
</if>
|
|
<if test='wrtOrgan != null and wrtOrgan != ""'>
|
|
and op.wrt_organ = #{wrtOrgan}
|
|
</if>
|
|
<if test='opState != null and opState != ""'>
|
|
and op.op_state = #{opState}
|
|
</if>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and op.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and op.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
<if test="downOrganCdList != null">
|
|
and op.wrt_organ in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
</if>
|
|
<if test='userType != null and userType != ""'>
|
|
<if test='userType == "normalStayList"'>
|
|
and op_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "normalCommitList"'>
|
|
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "sectionCommitList"'>
|
|
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "managerStayList"'>
|
|
and op_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "managerCommitList"'>
|
|
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
<select id="selectOperationPlanList" resultType="OperationPlan" parameterType="OperationPlan">
|
|
select op.op_key,
|
|
op_name,
|
|
op_birth,
|
|
op_position,
|
|
op_job,
|
|
op_career,
|
|
op_phone,
|
|
op_rank,
|
|
op_sdate,
|
|
op_state as status,
|
|
(select item_value from code_mgt where item_cd = op_state) as op_state,
|
|
wrt_user_seq,
|
|
(select item_value from code_mgt where item_cd = wrt_organ) as wrt_organ,
|
|
(select item_value from code_mgt where item_cd = wrt_part) as wrt_part,
|
|
(select item_value from code_mgt where item_cd = wrt_user_grd) as wrt_user_grd,
|
|
wrt_user_nm,
|
|
wrt_dt,
|
|
b.fileCnt
|
|
from operation_plan op
|
|
left outer join (select op_key,
|
|
count(file_seq) as fileCnt
|
|
from operation_plan_file
|
|
group by op_key) b
|
|
on op.op_key = b.op_key
|
|
<include refid="selectOperationPlanListWhere"></include>
|
|
order by op.op_key desc
|
|
limit #{rowCnt} offset #{firstIndex}
|
|
</select>
|
|
|
|
<select id="selectOperationPlanListCnt" resultType="Integer" parameterType="OperationPlan">
|
|
select count(*)
|
|
from operation_plan op
|
|
<include refid="selectOperationPlanListWhere"></include>
|
|
</select>
|
|
|
|
<select id="selectAffairCnt" resultType="IntelligenceAnalyze" parameterType="IntelligenceAnalyze">
|
|
select sum("AAR001"+"AAR003"+"AAR004"+"AAR006"+"AAR008") as total_cnt,
|
|
sum("AAR001") as special_cnt,
|
|
sum("AAR003") as middle_cnt,
|
|
sum("AAR004") as tong_cnt,
|
|
sum("AAR006") as jo_cnt,
|
|
sum("AAR008") as mu_cnt
|
|
from(
|
|
select ab.affair_key,
|
|
case
|
|
when ar.affair_rate = 'AAR001' then 1
|
|
else 0
|
|
end as "AAR001",
|
|
case
|
|
when ar.affair_rate = 'AAR003' then 1
|
|
else 0
|
|
end as "AAR003",
|
|
case
|
|
when ar.affair_rate = 'AAR004' then 1
|
|
else 0
|
|
end as "AAR004",
|
|
case
|
|
when ar.affair_rate = 'AAR006' then 1
|
|
else 0
|
|
end as "AAR006",
|
|
case
|
|
when ar.affair_rate = 'AAR008' then 1
|
|
else 0
|
|
end as "AAR008"
|
|
from affair_board ab,
|
|
affair_rating ar
|
|
where ab.affair_key = ar.affair_key
|
|
and ab.affair_category = 'CAT216'
|
|
and ab.affair_key in
|
|
<foreach collection="affairList" item="affairKey" separator="," open="(" close=")">
|
|
#{affairKey}
|
|
</foreach>
|
|
and (ar.organ_up != 'T' or ar.organ_up is null)
|
|
) a
|
|
|
|
</select>
|
|
|
|
<sql id="selectIntelligenceAnalyzeListWhere">
|
|
<where>
|
|
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
|
|
and wrt_user_seq = #{wrtUserSeq}
|
|
</if>
|
|
<if test='wrtOrgan != null and wrtOrgan != ""'>
|
|
and wrt_organ = #{wrtOrgan}
|
|
</if>
|
|
<if test='iaState != null and iaState != ""'>
|
|
and ia_state = #{iaState}
|
|
</if>
|
|
<if test='dateSelector == "iaDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and ia_sdate >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and ia_edate <= #{endDate}::date
|
|
</if>
|
|
</if>
|
|
<if test='dateSelector == "wrtDt"'>
|
|
<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>
|
|
<if test="downOrganCdList != null">
|
|
and wrt_organ in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
</if>
|
|
<if test='userType != null and userType != ""'>
|
|
<if test='userType == "normalStayList"'>
|
|
and ia_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "normalCommitList"'>
|
|
and ia_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "sectionCommitList"'>
|
|
and ia_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "managerStayList"'>
|
|
and ia_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "managerCommitList"'>
|
|
and ia_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
</if>
|
|
</where>
|
|
</sql>
|
|
|
|
<select id="selectIntelligenceAnalyzeList" resultType="IntelligenceAnalyze" parameterType="IntelligenceAnalyze">
|
|
select ia_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
sum("AAR001"+"AAR003"+"AAR004"+"AAR006"+"AAR008") as total_cnt,
|
|
sum("AAR001") as special_cnt,
|
|
sum("AAR003") as middle_cnt,
|
|
sum("AAR004") as tong_cnt,
|
|
sum("AAR006") as jo_cnt,
|
|
sum("AAR008") as mu_cnt,
|
|
fi_cnt,
|
|
(fa_cnt+work_cnt+arrest_cnt) as ia_total,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
wrt_dt,
|
|
(select item_value from code_mgt where item_cd = ia_state) as ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
(select item_value from code_mgt where item_cd = wrt_user_grd) as wrt_user_grd,
|
|
wrt_user_nm
|
|
from(
|
|
(select ia.ia_key,
|
|
iata.affair_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
fi_cnt,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
wrt_dt,
|
|
ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
wrt_user_grd,
|
|
wrt_user_nm
|
|
from intelligence_analyze ia,
|
|
intelligence_analyze_to_affair iata
|
|
where ia.ia_key = iata.ia_key) a left join
|
|
(select ab.affair_key,
|
|
case
|
|
when ar.affair_rate = 'AAR001' then 1
|
|
else 0
|
|
end as "AAR001",
|
|
case
|
|
when ar.affair_rate = 'AAR003' then 1
|
|
else 0
|
|
end as "AAR003",
|
|
case
|
|
when ar.affair_rate = 'AAR004' then 1
|
|
else 0
|
|
end as "AAR004",
|
|
case
|
|
when ar.affair_rate = 'AAR006' then 1
|
|
else 0
|
|
end as "AAR006",
|
|
case
|
|
when ar.affair_rate = 'AAR008' then 1
|
|
else 0
|
|
end as "AAR008"
|
|
from affair_board ab,
|
|
affair_rating ar
|
|
where ab.affair_key = ar.affair_key
|
|
and ab.affair_category = 'CAT216'
|
|
and (ar.organ_up != 'T' or ar.organ_up is null))b
|
|
on a.affair_key = b.affair_key
|
|
)
|
|
<include refid="selectIntelligenceAnalyzeListWhere"></include>
|
|
group by ia_key,ia_sdate,ia_edate,fi_cnt,fa_cnt,work_cnt,arrest_cnt,wrt_dt,ia_state,wrt_organ,wrt_user_seq, wrt_user_grd,wrt_user_nm
|
|
order by ia_key desc
|
|
</select>
|
|
|
|
<select id="selectIntelligenceAnalyzeListCnt" resultType="Integer" parameterType="IntelligenceAnalyze">
|
|
select count(*)
|
|
from(
|
|
select ia_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
sum("AAR001"+"AAR003"+"AAR004"+"AAR006"+"AAR008") as total_cnt,
|
|
sum("AAR001") as special_cnt,
|
|
sum("AAR003") as middle_cnt,
|
|
sum("AAR004") as tong_cnt,
|
|
sum("AAR006") as jo_cnt,
|
|
sum("AAR008") as mu_cnt,
|
|
fi_cnt,
|
|
(fa_cnt+work_cnt+arrest_cnt) as ia_total,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
wrt_dt,
|
|
ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
wrt_user_grd,
|
|
wrt_user_nm
|
|
from(
|
|
(select ia.ia_key,
|
|
iata.affair_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
fi_cnt,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
wrt_dt,
|
|
ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
wrt_user_grd,
|
|
wrt_user_nm
|
|
from intelligence_analyze ia,
|
|
intelligence_analyze_to_affair iata
|
|
where ia.ia_key = iata.ia_key) a left join
|
|
(select ab.affair_key,
|
|
case
|
|
when ar.affair_rate = 'AAR001' then 1
|
|
else 0
|
|
end as "AAR001",
|
|
case
|
|
when ar.affair_rate = 'AAR003' then 1
|
|
else 0
|
|
end as "AAR003",
|
|
case
|
|
when ar.affair_rate = 'AAR004' then 1
|
|
else 0
|
|
end as "AAR004",
|
|
case
|
|
when ar.affair_rate = 'AAR006' then 1
|
|
else 0
|
|
end as "AAR006",
|
|
case
|
|
when ar.affair_rate = 'AAR008' then 1
|
|
else 0
|
|
end as "AAR008"
|
|
from affair_board ab,
|
|
affair_rating ar
|
|
where ab.affair_key = ar.affair_key
|
|
and ab.affair_category = 'CAT216'
|
|
and (ar.organ_up != 'T' or ar.organ_up is null))b
|
|
on a.affair_key = b.affair_key
|
|
)
|
|
<include refid="selectIntelligenceAnalyzeListWhere"></include>
|
|
group by ia_key,ia_sdate,ia_edate,fi_cnt,fa_cnt,work_cnt,arrest_cnt,wrt_dt,ia_state,wrt_organ,wrt_user_seq, wrt_user_grd,wrt_user_nm
|
|
order by ia_key desc
|
|
)a
|
|
</select>
|
|
|
|
<select id="selectIntelligenceAnalyze" resultType="IntelligenceAnalyze" parameterType="IntelligenceAnalyze">
|
|
select ia_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
sum("AAR001"+"AAR003"+"AAR004"+"AAR006"+"AAR008") as total_cnt,
|
|
sum("AAR001") as special_cnt,
|
|
sum("AAR003") as middle_cnt,
|
|
sum("AAR004") as tong_cnt,
|
|
sum("AAR006") as jo_cnt,
|
|
sum("AAR008") as mu_cnt,
|
|
fi_cnt,
|
|
(fa_cnt+work_cnt+arrest_cnt) as ia_total,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
foreign_affairs,
|
|
"work",
|
|
arrest_offenders,
|
|
analysis_evaluation,
|
|
measures,
|
|
wrt_dt,
|
|
ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
(select item_value from code_mgt where item_cd = wrt_user_grd) as wrt_user_grd,
|
|
wrt_user_nm
|
|
from(
|
|
(select ia.ia_key,
|
|
iata.affair_key,
|
|
ia_sdate,
|
|
ia_edate,
|
|
fi_cnt,
|
|
fa_cnt,
|
|
work_cnt,
|
|
arrest_cnt,
|
|
foreign_affairs,
|
|
"work",
|
|
arrest_offenders,
|
|
analysis_evaluation,
|
|
measures,
|
|
wrt_dt,
|
|
ia_state,
|
|
wrt_organ,
|
|
wrt_user_seq,
|
|
wrt_user_grd,
|
|
wrt_user_nm
|
|
from intelligence_analyze ia,
|
|
intelligence_analyze_to_affair iata
|
|
where ia.ia_key = iata.ia_key) a left join
|
|
(select ab.affair_key,
|
|
case
|
|
when ar.affair_rate = 'AAR001' then 1
|
|
else 0
|
|
end as "AAR001",
|
|
case
|
|
when ar.affair_rate = 'AAR003' then 1
|
|
else 0
|
|
end as "AAR003",
|
|
case
|
|
when ar.affair_rate = 'AAR004' then 1
|
|
else 0
|
|
end as "AAR004",
|
|
case
|
|
when ar.affair_rate = 'AAR006' then 1
|
|
else 0
|
|
end as "AAR006",
|
|
case
|
|
when ar.affair_rate = 'AAR008' then 1
|
|
else 0
|
|
end as "AAR008"
|
|
from affair_board ab,
|
|
affair_rating ar
|
|
where ab.affair_key = ar.affair_key
|
|
and ab.affair_category = 'CAT216'
|
|
and (ar.organ_up != 'T' or ar.organ_up is null))b
|
|
on a.affair_key = b.affair_key
|
|
)
|
|
where ia_key = #{iaKey}
|
|
group by ia_key,ia_sdate,ia_edate,fi_cnt,fa_cnt,work_cnt,arrest_cnt, foreign_affairs,"work",arrest_offenders,analysis_evaluation,measures,wrt_dt,ia_state,wrt_organ,wrt_user_seq, wrt_user_grd,wrt_user_nm
|
|
</select>
|
|
|
|
<select id="selectIntelligenceAnalyzeAffairKey" resultType="Integer" parameterType="IntelligenceAnalyze">
|
|
select affair_key
|
|
from intelligence_analyze_to_affair
|
|
where ia_key = #{iaKey}
|
|
</select>
|
|
|
|
<sql id="selectIFireExtensionReportListWhere">
|
|
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
|
|
and fer.wrt_user_seq = #{wrtUserSeq}
|
|
</if>
|
|
<if test='wrtOrgan != null and wrtOrgan != ""'>
|
|
and fer.wrt_organ = #{wrtOrgan}
|
|
</if>
|
|
<if test='opName != null and opName != ""'>
|
|
and op.op_name like '%'||#{opName}||'%'
|
|
</if>
|
|
<if test='ferState != null and ferState != ""'>
|
|
and fer_state = #{ferState}
|
|
</if>
|
|
<if test='dateSelector == "ferDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and op.op_sdate >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and fer.op_edate <= #{endDate}::date
|
|
</if>
|
|
</if>
|
|
<if test='dateSelector == "wrtDt"'>
|
|
<if test='startDate != null and startDate != ""'>
|
|
and fer.wrt_dt >= #{startDate}::date
|
|
</if>
|
|
<if test='endDate != null and endDate != ""'>
|
|
and fer.wrt_dt <= #{endDate}::date+1
|
|
</if>
|
|
</if>
|
|
<if test="downOrganCdList != null">
|
|
and fer.wrt_organ in
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
|
#{organCd}
|
|
</foreach>
|
|
</if>
|
|
<if test='userType != null and userType != ""'>
|
|
<if test='userType == "normalStayList"'>
|
|
and fer_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "normalCommitList"'>
|
|
and fer_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "sectionCommitList"'>
|
|
and fer_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
<if test='userType == "managerStayList"'>
|
|
and fer_state in ('DST002')
|
|
</if>
|
|
<if test='userType == "managerCommitList"'>
|
|
and fer_state in ('DST003', 'DST004', 'DST005', 'DST006')
|
|
</if>
|
|
</if>
|
|
</sql>
|
|
|
|
<select id="selectIFireExtensionReportList" resultType="FireExtensionReport" parameterType="FireExtensionReport">
|
|
select fer_key,
|
|
op_name,
|
|
EXTRACT( year FROM age(CURRENT_DATE,op_birth)) as op_age,
|
|
op_position,
|
|
op_job,
|
|
op_sdate,
|
|
op_edate,
|
|
execution_amount,
|
|
fer_state,
|
|
fer.wrt_user_seq,
|
|
(select item_value from code_mgt where item_cd = fer.wrt_user_grd) as wrt_user_grd,
|
|
fer.wrt_user_nm,
|
|
fer.wrt_dt
|
|
from fire_extension_report fer,
|
|
operation_plan op
|
|
where fer.op_key = op.op_key
|
|
<include refid="selectIFireExtensionReportListWhere"></include>
|
|
order by fer_key desc
|
|
</select>
|
|
|
|
<select id="selectIFireExtensionReportListCnt" resultType="Integer" parameterType="FireExtensionReport">
|
|
select count(*)
|
|
from(
|
|
select fer_key,
|
|
op_name,
|
|
EXTRACT( year FROM age(CURRENT_DATE,op_birth)) as op_age,
|
|
op_position,
|
|
op_job,
|
|
op_sdate,
|
|
op_edate,
|
|
execution_amount,
|
|
fer_state,
|
|
fer.wrt_user_seq,
|
|
(select item_value from code_mgt where item_cd = fer.wrt_user_grd) as wrt_user_grd,
|
|
fer.wrt_user_nm,
|
|
fer.wrt_dt
|
|
from fire_extension_report fer,
|
|
operation_plan op
|
|
where fer.op_key = op.op_key
|
|
<include refid="selectIFireExtensionReportListWhere"></include>
|
|
order by fer_key desc
|
|
)a
|
|
</select>
|
|
|
|
</mapper> |