스프링
검색 기능 만들기
제목, 내용, 글쓴이
( 기존 쿼리문에
where title '%가%' or content '%나%' or writer '%김%'
이 문장을 추가하기)
select * from
( select Tb.*, rownum rNum from
(select * from tbl_board
where title '%가%' or content '%나%'
or writer '%김%'
order by bno desc) Tb
) where rNum between 1 and 10;
MyBatis 동적 태그들
1. if <if>
<if test="true"> ex - '%월요일%'
where title like '%' || #{keyword} || '%'
</if>
|| -> 오라클에서 쓰는 결합연산자
2. where <where>
<where>
<if test "bno != null">
bno = #{bno}
</if>
</where>
<foreach collection="" index="key" item="val">
<if test="">
title like #{val}
</if>
</foreach>
3. sql <sql> : 필요한 SQL 태그 일부를 별도로 보관
<sql id="id명">
SQL 일부
</sql>
4. include <include> : 필요한 경우에 include시키는 형태로 사용
(sql 태그에 지정한 id명과 동일하게 부여해주면 됨)
<include refid="id명"></include>
5. trim <trim>
<trim prefix="">
<foreach collection="" index="" item="">
<if test="val == 'T'.toString()">
test like #{val}
</if>
</foreach>
</trim>
부트스트랩
SB admin 2 다운 검색 후 다운로드
압축 풀고 index.html 열기