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

82 lines
3.1 KiB
XML
Raw Normal View History

<?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='wrtUserNm != null and wrtUserNm != ""'>
and op.wrt_user_nm like '%'||#{wrtUserNm}||'%'
</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 &lt;= #{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_phone ,
op_rank ,
(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>
</mapper>