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

242 lines
7.8 KiB
XML
Raw Normal View History

2022-09-28 07:56:31 +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">
<mapper namespace="com.dbnt.faisp.fipTarget.mapper.FipTargetMapper">
<select id="selectPartInfoManagerList" resultType="com.dbnt.faisp.util.ParamMap" parameterType="com.dbnt.faisp.util.ParamMap">
select user_seq,
user_id
user_name
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="selectPartInfoList" resultType="PartInfo" parameterType="PartInfo">
select pi.pi_seq,
version_no,
(select item_value from code_mgt where item_cd = mgt_organ) as mgt_organ,
land_police,
(select item_value from code_mgt where item_cd = mp_work_type) as mp_work_type,
mp_people_cnt,
mp_description,
(select item_value from code_mgt where item_cd = pl_work_type) as pl_work_type,
pl_people_cnt,
pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
2022-09-29 08:55:12 +00:00
terminal_nm,
2022-09-28 07:56:31 +00:00
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
2022-09-29 08:55:12 +00:00
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
2022-09-28 07:56:31 +00:00
order by wrt_dt desc
2022-09-29 08:55:12 +00:00
<if test='rowCnt != null and rowCnt != ""'>
limit #{rowCnt} offset #{firstIndex}
</if>
2022-09-28 07:56:31 +00:00
</select>
<select id="selectPartInfoListCnt" resultType="int" parameterType="PartInfo">
select count(*)
from(
select pi.pi_seq,
version_no,
mgt_organ,
land_police,
mp_work_type,
mp_people_cnt,
mp_description,
pl_work_type,
pl_people_cnt,
pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
2022-09-29 08:55:12 +00:00
terminal_nm,
2022-09-28 07:56:31 +00:00
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
2022-09-29 08:55:12 +00:00
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
2022-09-28 07:56:31 +00:00
order by wrt_dt desc
) a
</select>
2022-09-29 08:55:12 +00:00
<select id="selectWorkTypeTotal" resultType="com.dbnt.faisp.util.ParamMap" parameterType="PartInfo">
select sum(mp_sangju) as mp_sangju,
sum(mp_sangju_cnt) as mp_sangju_total,
sum(mp_bsangju) as mp_bsangju,
sum(mp_bsangju_cnt) as mp_bsangju_total,
sum(mp_closure) as mp_closure,
sum(mp_closure_cnt) as mp_closure_total,
sum(pl_sangju) as pl_sangju,
sum(pl_sangju_cnt) as pl_sangju_total,
sum(pl_bsangju) as pl_bsangju,
sum(pl_bsangju_cnt) as pl_bsangju_total,
sum(pl_closure) as pl_closure,
sum(pl_closure_cnt) as pl_closure_total
from(
select case
when mp_work_type = 'PIS001' then coalesce(mp_people_cnt,0)
else 0
end as mp_sangju_cnt,
case
when mp_work_type = 'PIS002' then coalesce(mp_people_cnt,0)
else 0
end as mp_bsangju_cnt,
case
when mp_work_type = 'PIS003' then coalesce(mp_people_cnt,0)
else 0
end as mp_closure_cnt,
case
when pl_work_type = 'PIS001' then coalesce(pl_people_cnt,0)
else 0
end as pl_sangju_cnt,
case
when pl_work_type = 'PIS002' then coalesce(pl_people_cnt,0)
else 0
end as pl_bsangju_cnt,
case
when pl_work_type = 'PIS003' then coalesce(pl_people_cnt,0)
else 0
end as pl_closure_cnt,
case
when mp_work_type = 'PIS001' then 1
else 0
end as mp_sangju,
case
when mp_work_type = 'PIS002' then 1
else 0
end as mp_bsangju,
case
when mp_work_type = 'PIS003' then 1
else 0
end as mp_closure,
case
when pl_work_type = 'PIS001' then 1
else 0
end as pl_sangju,
case
when pl_work_type = 'PIS002' then 1
else 0
end as pl_bsangju,
case
when pl_work_type = 'PIS003' then 1
else 0
end as pl_closure
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
group by pi.pi_seq, version_no
) a
</select>
<select id="selectPartInfo" resultType="PartInfo" parameterType="PartInfo">
select pi.pi_seq,
version_no,
mgt_organ,
land_police,
mp_work_type,
mp_people_cnt,
mp_description,
pl_work_type,
pl_people_cnt,
pl_description,
pi_user_seq,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and pi.pi_seq = #{piSeq}
</select>
2022-09-28 07:56:31 +00:00
</mapper>