454 lines
15 KiB
XML
454 lines
15 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.userInfo.mapper.UserInfoMapper">
|
||
|
|
<sql id="selectUserInfoWhere">
|
||
|
|
<where>
|
||
|
|
<choose>
|
||
|
|
<when test='userStatus != null and userStatus != ""'>
|
||
|
|
user_status = #{userStatus}
|
||
|
|
</when>
|
||
|
|
<otherwise>
|
||
|
|
user_status != 'D'
|
||
|
|
</otherwise>
|
||
|
|
</choose>
|
||
|
|
<if test='userId != null and userId != ""'>
|
||
|
|
and user_id like '%'||#{userId}||'%'
|
||
|
|
</if>
|
||
|
|
<if test='userNm != null and userNm != ""'>
|
||
|
|
and user_nm like '%'||#{userNm}||'%'
|
||
|
|
</if>
|
||
|
|
<if test='ogCd != null and ogCd != ""'>
|
||
|
|
and og_cd = #{ogCd}
|
||
|
|
</if>
|
||
|
|
<if test='ofcCd != null and ofcCd != ""'>
|
||
|
|
and ofc_cd = #{ofcCd}
|
||
|
|
</if>
|
||
|
|
<if test='titleCd != null and titleCd != ""'>
|
||
|
|
and title_cd = #{titleCd}
|
||
|
|
</if>
|
||
|
|
<if test='userRole == "ROLE_ADMIN,ROLE_SUB_ADMIN,ROLE_USER"'>
|
||
|
|
and user_role like '%ROLE_USER'
|
||
|
|
</if>
|
||
|
|
<if test='userRole == "ROLE_SUB_ADMIN,ROLE_USER"'>
|
||
|
|
and (user_role = 'ROLE_SUB_ADMIN,ROLE_USER' or user_role = 'ROLE_USER')
|
||
|
|
</if>
|
||
|
|
<if test="downOrganCdList != null">
|
||
|
|
and og_cd in
|
||
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
||
|
|
#{organCd}
|
||
|
|
</foreach>
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
<select id="selectUserInfoList" resultType="UserInfo" parameterType="UserInfo">
|
||
|
|
select user_seq,
|
||
|
|
dic_code,
|
||
|
|
user_id,
|
||
|
|
user_nm,
|
||
|
|
user_role,
|
||
|
|
email,
|
||
|
|
og_cd,
|
||
|
|
ofc_cd,
|
||
|
|
title_cd,
|
||
|
|
wrt_dt
|
||
|
|
from user_info
|
||
|
|
<include refid="selectUserInfoWhere"></include>
|
||
|
|
order by og_cd, ofc_cd, title_cd desc
|
||
|
|
limit #{rowCnt} offset #{firstIndex}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectUserInfoListCnt" resultType="int" parameterType="UserInfo">
|
||
|
|
select count(*)
|
||
|
|
from user_info
|
||
|
|
<include refid="selectUserInfoWhere"></include>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectManagerList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="com.dbnt.faisp.util.ParamMap">
|
||
|
|
select user_seq,
|
||
|
|
user_id,
|
||
|
|
(select item_value from code_mgt where item_cd = title_cd) as title_cd,
|
||
|
|
user_nm
|
||
|
|
from user_info
|
||
|
|
where og_cd in
|
||
|
|
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
order by user_nm asc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectDashboardConfigList" resultType="DashboardConfig" parameterType="int">
|
||
|
|
select a.menu_key ,
|
||
|
|
a.cat1_cd ,
|
||
|
|
a.cat2_cd ,
|
||
|
|
a.cat3_cd ,
|
||
|
|
a.menu_url ,
|
||
|
|
b.order_num
|
||
|
|
from menu_mgt a
|
||
|
|
inner join dashboard_config b
|
||
|
|
on a.menu_key = b.menu_key
|
||
|
|
where b.user_seq = #{userSeq}
|
||
|
|
order by b.order_num
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<sql id="selectPoliceListWhere">
|
||
|
|
<where>
|
||
|
|
user_status = #{userStatus}
|
||
|
|
and og_cd in
|
||
|
|
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
<if test="ogCd != null and ogCd != ''">
|
||
|
|
and og_cd = #{ogCd}
|
||
|
|
</if>
|
||
|
|
<if test="sex != null and sex != ''">
|
||
|
|
and sex = #{sex}
|
||
|
|
</if>
|
||
|
|
<if test="userNm != null and userNm != ''">
|
||
|
|
and user_nm like '%'||#{userNm}||'%'
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectPoliceList" resultType="UserInfo" parameterType="UserInfo">
|
||
|
|
select (ROW_NUMBER() OVER(order by user_nm desc)) AS rownum,
|
||
|
|
a.user_seq,
|
||
|
|
(select item_value from code_mgt where item_cd = title_cd) as title_cd,
|
||
|
|
user_nm,
|
||
|
|
og_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = og_cd) as organ_nm,
|
||
|
|
(select item_value from code_mgt where item_cd = ofc_cd) as ofc_cd,
|
||
|
|
birth_date,
|
||
|
|
(select item_value from code_mgt where item_cd = sex) as sex,
|
||
|
|
police_in_date,
|
||
|
|
title_in_date,
|
||
|
|
ofc_in_date,
|
||
|
|
(select item_value from code_mgt where item_cd = outturn_cd) as outturn_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = job_in_cd) as job_in_cd,
|
||
|
|
wrt_dt,
|
||
|
|
b.crc001Sum,
|
||
|
|
b.crc002Sum,
|
||
|
|
b.crc003Sum,
|
||
|
|
b.crc004Sum,
|
||
|
|
b.crc005Sum,
|
||
|
|
b.crc006Sum
|
||
|
|
from user_info a
|
||
|
|
left outer join (
|
||
|
|
select user_seq,
|
||
|
|
sum(case when career_cd = 'CRC001' then work_month else 0 end) as crc001Sum,
|
||
|
|
sum(case when career_cd = 'CRC002' then work_month else 0 end) as crc002Sum,
|
||
|
|
sum(case when career_cd = 'CRC003' then work_month else 0 end) as crc003Sum,
|
||
|
|
sum(case when career_cd = 'CRC004' then work_month else 0 end) as crc004Sum,
|
||
|
|
sum(case when career_cd = 'CRC005' then work_month else 0 end) as crc005Sum,
|
||
|
|
sum(case when career_cd = 'CRC006' then work_month else 0 end) as crc006Sum
|
||
|
|
from user_career
|
||
|
|
group by user_seq
|
||
|
|
) b on a.user_seq = b.user_seq
|
||
|
|
<include refid="selectPoliceListWhere"></include>
|
||
|
|
order by rownum desc
|
||
|
|
<if test='excel != "Y"'>
|
||
|
|
limit #{rowCnt} offset #{firstIndex}
|
||
|
|
</if>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectPoliceListCnt" resultType="Integer" parameterType="UserInfo">
|
||
|
|
select count(*)
|
||
|
|
from(
|
||
|
|
select user_seq,
|
||
|
|
(select item_value from code_mgt where item_cd = title_cd) as title_cd,
|
||
|
|
user_nm,
|
||
|
|
og_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = og_cd) as organ_nm,
|
||
|
|
(select item_value from code_mgt where item_cd = ofc_cd) as ofc_cd,
|
||
|
|
birth_date,
|
||
|
|
(select item_value from code_mgt where item_cd = sex) as sex,
|
||
|
|
police_in_date,
|
||
|
|
title_in_date,
|
||
|
|
ofc_in_date,
|
||
|
|
(select item_value from code_mgt where item_cd = outturn_cd) as outturn_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = job_in_cd) as job_in_cd,
|
||
|
|
wrt_dt
|
||
|
|
from user_info
|
||
|
|
<include refid="selectPoliceListWhere"></include>
|
||
|
|
order by user_seq desc
|
||
|
|
) a
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectPoliceHisList" resultType="UserInfoHistory" parameterType="UserInfoHistory">
|
||
|
|
select user_seq,
|
||
|
|
version_no,
|
||
|
|
(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_title) as wrt_title,
|
||
|
|
wrt_nm,
|
||
|
|
wrt_dt
|
||
|
|
from user_info_history
|
||
|
|
where user_seq = #{userSeq}
|
||
|
|
order by version_no desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectpoliceHistoryView" resultType="UserInfoHistory" parameterType="UserInfoHistory">
|
||
|
|
select user_seq,
|
||
|
|
version_no,
|
||
|
|
dic_code,
|
||
|
|
user_id,
|
||
|
|
user_nm,
|
||
|
|
phone_no,
|
||
|
|
email,
|
||
|
|
(select item_value from code_mgt where item_cd = sex) as sex,
|
||
|
|
birth_date,
|
||
|
|
police_in_date,
|
||
|
|
(select item_value from code_mgt where item_cd = og_cd) as og_cd,
|
||
|
|
organ_in_date,
|
||
|
|
ofc_cd,
|
||
|
|
ofc_in_date,
|
||
|
|
(select item_value from code_mgt where item_cd = title_cd) as title_cd,
|
||
|
|
title_in_date,
|
||
|
|
(select item_value from code_mgt where item_cd = outturn_cd) as outturn_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = series_cd) as series_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = language_cd) as language_cd
|
||
|
|
from user_info_history
|
||
|
|
where user_seq = #{userSeq}
|
||
|
|
and version_no = #{versionNo}
|
||
|
|
</select>
|
||
|
|
<select id="selectPersonnelStatusList" parameterType="PersonnelStatus" resultType="PersonnelStatus">
|
||
|
|
select
|
||
|
|
case
|
||
|
|
when a.year is null then #{year}
|
||
|
|
else a.year
|
||
|
|
end as year,
|
||
|
|
case
|
||
|
|
when a.og_cd is null then c.organ_cd
|
||
|
|
else a.og_cd
|
||
|
|
end as og_cd,
|
||
|
|
a.version_no,
|
||
|
|
jt007_max,
|
||
|
|
jt007_now,
|
||
|
|
jt006_max,
|
||
|
|
jt006_now,
|
||
|
|
jt005_max,
|
||
|
|
jt005_now,
|
||
|
|
jt004_max,
|
||
|
|
jt004_now,
|
||
|
|
jt003_max,
|
||
|
|
jt003_now,
|
||
|
|
jt002_max,
|
||
|
|
jt002_now,
|
||
|
|
jt001_max,
|
||
|
|
jt001_now,
|
||
|
|
wrt_organ,
|
||
|
|
wrt_part,
|
||
|
|
wrt_user_seq,
|
||
|
|
wrt_user_grd,
|
||
|
|
wrt_user_nm,
|
||
|
|
wrt_dt
|
||
|
|
from personnel_status a
|
||
|
|
inner join (select year, og_cd, max(version_no) as version_no
|
||
|
|
from personnel_status
|
||
|
|
group by year, og_cd) b
|
||
|
|
on a.year = b.year and a.og_cd = b.og_cd and a.version_no = b.version_no
|
||
|
|
right outer join organ_config c
|
||
|
|
on a.og_cd = c.organ_cd and a.year = #{year}
|
||
|
|
where c.organ_cd in
|
||
|
|
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
|
||
|
|
#{item}
|
||
|
|
</foreach>
|
||
|
|
order by c.organ_type, c.parent_organ, c.organ_cd
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="nowPersonnelStatus" resultType="PersonnelStatus" parameterType="string">
|
||
|
|
select a.og_cd,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT001' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt001Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT002' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt002Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT003' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt003Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT004' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt004Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT005' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt005Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT006' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt006Now,
|
||
|
|
sum(case
|
||
|
|
when a.title_cd = 'JT007' then 1
|
||
|
|
else 0
|
||
|
|
end) as jt007Now
|
||
|
|
from user_info a
|
||
|
|
where a.user_status = 'USC003'
|
||
|
|
and a.og_cd = #{ogCd}
|
||
|
|
group by a.og_cd
|
||
|
|
order by a.og_cd
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectPoliceInfo" resultType="UserInfo" parameterType="Integer">
|
||
|
|
select user_seq,
|
||
|
|
user_nm,
|
||
|
|
dic_code,
|
||
|
|
(select item_value from code_mgt where item_cd = title_cd) as title_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = og_cd) as og_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = ofc_cd) as ofc_cd,
|
||
|
|
(select item_value from code_mgt where item_cd = sex) as sex,
|
||
|
|
birth_date,
|
||
|
|
(select item_value from code_mgt where item_cd = language_cd) as language_cd
|
||
|
|
from user_info
|
||
|
|
where user_seq = #{userSeq}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectEduList" resultType="UserEdu" parameterType="UserEdu">
|
||
|
|
select edu_seq,
|
||
|
|
user_seq,
|
||
|
|
edu_name,
|
||
|
|
edu_sdate,
|
||
|
|
edu_edate,
|
||
|
|
edu_ra,
|
||
|
|
(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_title) as wrt_title,
|
||
|
|
wrt_user_seq,
|
||
|
|
wrt_nm,
|
||
|
|
wrt_dt
|
||
|
|
from user_edu
|
||
|
|
where user_seq = #{userSeq}
|
||
|
|
order by edu_seq desc
|
||
|
|
</select>
|
||
|
|
<sql id="selectRequestLogListWhere">
|
||
|
|
<where>
|
||
|
|
user_organ in
|
||
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
||
|
|
#{organCd}
|
||
|
|
</foreach>
|
||
|
|
<if test='contactIp != null and contactIp != ""'>
|
||
|
|
and contact_ip like '%'||#{contactIp}||'%'
|
||
|
|
</if>
|
||
|
|
<if test='requestUrl != null and requestUrl != ""'>
|
||
|
|
and request_url like '%'||#{requestUrl}||'%'
|
||
|
|
</if>
|
||
|
|
<if test='requestMethod != null and requestMethod != ""'>
|
||
|
|
and request_method = #{requestMethod}
|
||
|
|
</if>
|
||
|
|
<if test='userBelong != null and userBelong != ""'>
|
||
|
|
and user_belong like '%'||#{userBelong}||'%'
|
||
|
|
</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>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
<select id="selectRequestLogList" resultType="UserRequestLog" parameterType="UserRequestLog">
|
||
|
|
select *
|
||
|
|
from user_request_log
|
||
|
|
<include refid="selectRequestLogListWhere"></include>
|
||
|
|
order by ul_key desc
|
||
|
|
limit #{rowCnt} offset #{firstIndex}
|
||
|
|
</select>
|
||
|
|
<select id="selectRequestLogListCnt" resultType="int" parameterType="UserRequestLog">
|
||
|
|
select count(*)
|
||
|
|
from user_request_log
|
||
|
|
<include refid="selectRequestLogListWhere"></include>
|
||
|
|
</select>
|
||
|
|
<sql id="selectInoutLogListWhere">
|
||
|
|
<where>
|
||
|
|
user_organ in
|
||
|
|
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
|
||
|
|
#{organCd}
|
||
|
|
</foreach>
|
||
|
|
<if test='contactIp != null and contactIp != ""'>
|
||
|
|
and contact_ip like '%'||#{contactIp}||'%'
|
||
|
|
</if>
|
||
|
|
<if test='inoutType != null and inoutType != ""'>
|
||
|
|
and inout_type = #{inoutType}
|
||
|
|
</if>
|
||
|
|
<if test='userBelong != null and userBelong != ""'>
|
||
|
|
and user_belong like '%'||#{userBelong}||'%'
|
||
|
|
</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>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
<select id="selectInoutLogList" resultType="UserInoutLog" parameterType="UserInoutLog">
|
||
|
|
select *
|
||
|
|
from user_inout_log
|
||
|
|
<include refid="selectInoutLogListWhere"></include>
|
||
|
|
order by inout_key desc
|
||
|
|
limit #{rowCnt} offset #{firstIndex}
|
||
|
|
</select>
|
||
|
|
<select id="selectInoutLogListCnt" resultType="int" parameterType="UserInoutLog">
|
||
|
|
select count(*)
|
||
|
|
from user_inout_log
|
||
|
|
<include refid="selectInoutLogListWhere"></include>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<sql id="selectAlarmListWhere">
|
||
|
|
<where>
|
||
|
|
<if test='userSeq != null and userSeq != 0'>
|
||
|
|
and a.user_seq = #{userSeq}
|
||
|
|
</if>
|
||
|
|
<if test='viewYn != null and viewYn != ""'>
|
||
|
|
and a.view_yn = #{viewYn}
|
||
|
|
</if>
|
||
|
|
<if test='cat1Cd != null and cat1Cd != ""'>
|
||
|
|
and b.cat1_cd = #{cat1Cd}
|
||
|
|
</if>
|
||
|
|
<if test='cat2Cd != null and cat2Cd != ""'>
|
||
|
|
and b.cat2_cd = #{cat2Cd}
|
||
|
|
</if>
|
||
|
|
<if test='cat3Cd != null and cat3Cd != ""'>
|
||
|
|
and b.cat3_cd = #{cat3Cd}
|
||
|
|
</if>
|
||
|
|
<if test='alarmMsg != null and alarmMsg != ""'>
|
||
|
|
and a.alarm_msg like '%'||#{alarmMsg}||'%'
|
||
|
|
</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>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
<select id="selectAlarmList" resultType="UserAlarm" parameterType="UserAlarm">
|
||
|
|
select a.alarm_key ,
|
||
|
|
a.user_seq ,
|
||
|
|
a.menu_key ,
|
||
|
|
a.ref_doc_key ,
|
||
|
|
b.cat1_cd,
|
||
|
|
b.cat2_cd,
|
||
|
|
b.cat3_cd,
|
||
|
|
a.alarm_msg ,
|
||
|
|
a.view_yn ,
|
||
|
|
a.wrt_dt
|
||
|
|
from user_alarm a
|
||
|
|
inner join menu_mgt b on a.menu_key = b.menu_key
|
||
|
|
<include refid="selectAlarmListWhere"></include>
|
||
|
|
order by wrt_dt desc
|
||
|
|
limit #{rowCnt} offset #{firstIndex}
|
||
|
|
</select>
|
||
|
|
<select id="selectAlarmListCnt" resultType="int" parameterType="UserAlarm">
|
||
|
|
select count(*)
|
||
|
|
from user_alarm a
|
||
|
|
inner join menu_mgt b on a.menu_key = b.menu_key
|
||
|
|
<include refid="selectAlarmListWhere"></include>
|
||
|
|
</select>
|
||
|
|
</mapper>
|