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

63 lines
2.1 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>
<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('%', #{content_title}, '%')
</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>
and a.wrt_organ in
<foreach collection="downOrganCdList" item="organCd" separator="," open="(" close=")">
#{organCd}
</foreach>
</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_nm,
a.wrt_dt,
a.wrt_organ,
wrt_user_seq,
wrt_part
from major_status a
<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>