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

67 lines
2.2 KiB
XML
Raw Normal View History

2023-01-05 06:26:05 +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.main.ivsgtMgt.majorStatus.mapper.MajorStatusMapper">
<sql id="selectMajorListWhere">
<where>
2023-01-06 09:03:50 +00:00
a.content_status &lt;> 'DST008'
2023-01-05 06:26:05 +00:00
<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 != ''">
2023-01-06 05:00:33 +00:00
AND a.content_title LIKE CONCAT('%', #{contentTitle}, '%')
2023-01-05 06:26:05 +00:00
</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,
2023-01-06 05:00:33 +00:00
a.wrt_user_seq,
2023-01-05 06:26:05 +00:00
a.wrt_user_nm,
a.wrt_dt,
a.wrt_organ,
2023-01-06 05:00:33 +00:00
a.wrt_part,
b.fileCnt
2023-01-05 06:26:05 +00:00
from major_status a
2023-01-06 05:00:33 +00:00
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
2023-01-05 06:26:05 +00:00
<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>
2023-01-06 05:00:33 +00:00
2023-01-05 06:26:05 +00:00
</mapper>