| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- Unity
- jsp
- 아두이노
- s4a
- 스크래치
- 라즈베리파이
- 안드로이드
- 시작하기
- 잡토이 메이킹 코딩 학원
- 설정
- oracle
- MSSQL
- 예제
- 파주
- 잡토이
- 리브레캐드
- 오라클
- 코딩
- jobtoy
- Spring Security
- html5
- 설치
- 운정
- librecad
- 유니티
- 톰캣
- mysql
- 강좌
- tomcat
- Android
Archives
- Today
- Total
랩제이
[mybatis] order by 동적 쿼리 본문
반응형
[mybatis] order by 동적 쿼리
다음처럼 하면 order by를 동적으로 삽입 할 수 있다.
* java
String orderKind = "wbsalecount";
Map<String, Object> condition = new HashMap<String, Object>();
condition.put("orderKind" , orderKind );
* mybatis
<select id="selDomainMap1" parameterType="java.util.Map" resultMap="libroBestsellerResultMap">
...
<trim prefix="ORDER BY">
<if test="orderKind == 'wbrank'"> A.WB_RANK ASC </if>
<if test="orderKind == 'wbsalecount'"> A.WB_SALE_COUNT DESC </if>
</trim>
...
</select>
[mybatis] order by 동적 쿼리
'programming > mybatis' 카테고리의 다른 글
| [mybatis] IN qeury 사용하기 (0) | 2014.09.23 |
|---|---|
| [mybatis] where 1=1 는 <where> 로 바꾸어 주세요 (0) | 2014.06.20 |