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

65 lines
2.2 KiB
XML
Raw Normal View History

2022-09-20 09:10:30 +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.fpiMgt.affair.mapper.AffairMapper">
<sql id="selectAffairBoardWhere">
2022-09-20 09:10:30 +00:00
<where>
<if test='wrtUserSeq != null and wrtUserSeq != ""'>
and a.wrt_user_seq = #{wrtUserSeq}
</if>
<if test='wrtUserNm != null and wrtUserNm != ""'>
and a.wrt_user_nm like '%'||#{wrtUserNm}||'%'
</if>
<if test='wrtOrgan != null and wrtOrgan != ""'>
and a.wrt_organ = #{wrtOrgan}
</if>
<if test='title != null and title != ""'>
and a.title like '%'||#{title}||'%'
2022-09-20 09:10:30 +00:00
</if>
<if test='affairStatus != null and affairStatus != ""'>
and a.affair_status = #{affairStatus}
2022-09-20 09:10:30 +00:00
</if>
<if test='dateSelector == "wrtDt"'>
<if test='startDate != null and startDate != ""'>
and a.wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and a.wrt_dt &lt;= #{endDate}::date
</if>
</if>
<if test="downOrganCdList != null">
and a.wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</if>
</where>
</sql>
<select id="selectAffairBoardList" resultType="AffairBoard" parameterType="AffairBoard">
select a.affair_key,
a.title,
a.affair_status,
2022-09-20 09:10:30 +00:00
a.wrt_organ,
a.wrt_part,
a.wrt_user_nm,
a.wrt_user_seq,
a.wrt_dt,
b.fileCnt
from affair_board a
left outer join (select affair_key,
count(file_seq) as fileCnt
from affair_file
group by affair_key) b
on a.affair_key = b.affair_key
<include refid="selectAffairBoardWhere"></include>
2022-09-20 09:10:30 +00:00
order by affair_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectAffairBoardCnt" resultType="int" parameterType="AffairBoard">
2022-09-20 09:10:30 +00:00
select count(*)
from affair_board a
<include refid="selectAffairBoardWhere"></include>
2022-09-20 09:10:30 +00:00
</select>
</mapper>