티스토리 뷰

반응형

mybatis 에서 not null 비교문을 사용할때 choose 문법이 있다는걸 알고 메모합니다.

choose 문을 사용하여 when 일경우  otherwise (when구문이 아닐경우)로 표시할수 있습니다. 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!--ibatis -->
<isNotNull property="stringProperty">
    조건문
</isNotNull>
<!--mybatis(1)-->
<if test="stringProperty != null">
    조건문
</if>
<!--mybatis(2)-->
<choose>
    <when test="stringProperty == null">
        NULL일경우 조건문
    </when>
    <otherwise>
        NULL이 아닐경우 조건문
    </otherwise>
</choose>
 
cs


반응형
댓글