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

67 lines
2.2 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.ivsgtMgt.majorStatus.mapper.MajorStatusMapper">
<sql id="selectMajorListWhere">
<where>
a.content_status &lt;> 'DST008'
<if test='majorType != null and majorType != ""'>
and a.major_type = #{majorType}
</if>
<if test='wrtOrgan != null and wrtOrgan != ""'>
and a.wrt_organ = #{wrtOrgan}
</if>
<if test="contentTitle != null and contentTitle != ''">
AND a.content_title LIKE CONCAT('%', #{contentTitle}, '%')
</if>
<if test="wrtUserNm != null and wrtUserNm != ''">
AND a.wrt_user_nm LIKE CONCAT('%', #{wrtUserNm}, '%')
</if>
<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+1
</if>
</where>
</sql>
<select id="selectMajorList" resultType="MajorStatus" parameterType="MajorStatus">
select a.major_key,
a.major_type,
a.content_title,
a.content_info,
a.content_status,
a.wrt_user_grd,
a.wrt_user_seq,
a.wrt_user_nm,
a.wrt_dt,
a.wrt_organ,
a.wrt_part,
b.fileCnt
from major_status a
left outer join (select major_key,
count(file_seq) as fileCnt
from major_status_file
group by major_key) b
on a.major_key = b.major_key
<include refid="selectMajorListWhere"></include>
order by major_key desc
limit #{rowCnt} offset #{firstIndex}
</select>
<select id="selectMajorListCnt" resultType="int" parameterType="MajorStatus">
select count(*)
from major_status a
<include refid="selectMajorListWhere"></include>
</select>
</mapper>