FAISP/src/main/resources/mybatisMapper/UserInfoMapper.xml

317 lines
10 KiB
XML
Raw Normal View History

2022-08-18 06:21:44 +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">
2022-10-27 00:02:05 +00:00
<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>
</where>
</sql>
2022-08-18 06:21:44 +00:00
<select id="selectUserInfoList" resultType="UserInfo" parameterType="UserInfo">
2022-08-25 09:39:21 +00:00
select user_seq,
dic_code,
2022-08-25 09:39:21 +00:00
user_id,
user_nm,
user_role,
2022-08-25 09:39:21 +00:00
email,
og_cd,
ofc_cd,
title_cd,
2022-08-25 09:39:21 +00:00
wrt_dt
from user_info
<include refid="selectUserInfoWhere"></include>
order by og_cd, ofc_cd, title_cd desc
2022-08-25 09:39:21 +00:00
limit #{rowCnt} offset #{firstIndex}
2022-08-18 06:21:44 +00:00
</select>
<select id="selectUserInfoListCnt" resultType="int" parameterType="UserInfo">
2022-08-25 09:39:21 +00:00
select count(*)
from user_info
<include refid="selectUserInfoWhere"></include>
2022-08-18 06:21:44 +00:00
</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>
2022-10-13 09:34:32 +00:00
<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>
2022-11-15 09:51:45 +00:00
<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,
2022-11-15 09:51:45 +00:00
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>
2022-11-16 04:33:03 +00:00
<select id="selectPoliceInfo" resultType="UserInfo" parameterType="Integer">
select user_seq,
2022-11-18 09:01:23 +00:00
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
2022-11-16 04:33:03 +00:00
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>
2022-08-18 06:21:44 +00:00
</mapper>