kcscDev/kcsc-back-end/src/main/resources/mybatisMapper/AdminBoardsMapper.xml

60 lines
1.5 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.kcscbackend.admin.boards.mapper.AdminBoardsMapper">
<select id="selectPostList" parameterType="TnBbsContents" resultType="TnBbsContents">
select
bbs_cont_seq,
bbs_seq,
bbs_cont_title,
bbs_contents,
bbs_cont_seq_group,
bbs_cont_seq_parent,
bbs_cont_level,
bbs_cont_sort,
file_grp_id,
bbs_read_cnt,
fixed_yn,
secret_yn,
secret_pwd,
doc_info_seq,
ip_address,
frst_crt_id,
frst_crt_dt,
last_chg_id,
last_chg_dt,
use_yn,
old_seq,
bbs_id
from tn_bbs_contents
<include refid="selectPostListWhere"></include>
order by bbs_cont_seq desc
<if test='fixedYn != "Y"'>
limit #{rowCnt} offset #{firstIndex}
</if>
</select>
<select id="selectPostListCnt" parameterType="TnBbsContents" resultType="int">
select count(*)
from tn_bbs_contents
<include refid="selectPostListWhere"></include>
</select>
<sql id="selectPostListWhere">
<where>
<if test='fixedYn != null and fixedYn != ""'>
and fixed_yn = #{fixedYn}
</if>
<if test='bbsSeq != null and bbsSeq != ""'>
and bbs_seq = #{bbsSeq}
</if>
<if test='searchKeyword != null and searchKeyword != ""'>
and bbs_cont_title like '%'||#{searchKeyword}||'%'
</if>
<if test='bbsId != null and bbsId != ""'>
and bbs_id = #{bbsId}
</if>
</where>
</sql>
</mapper>