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

187 lines
6.0 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>
</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,
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 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>
</mapper>