Notice
		                                        
										
                                    
                                        
                                    
                                        Recent Posts
                                        
                                    
                                        
                                    
                                        Recent Comments
                                        
                                    
                                        
                                    
                                        Link
                                        
                                    
                                | 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 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
                                        
                                    
                                        
                                    - Java
- hadoop
- Express
- Android
- Eclipse
- tomcat
- vaadin
- GIT
- 보조정렬
- mapreduce
- plugin
- MSSQL
- JavaScript
- es6
- Spring
- IntelliJ
- SQL
- SPC
- table
- Python
- mybatis
- NPM
- xPlatform
- window
- SSL
- 공정능력
- Sqoop
- Kotlin
- react
- R
                                        Archives
                                        
                                    
                                        
                                    - Today
- Total
DBILITY
mybatis foreach multiple like 본문
반응형
    
    
    
  갑자기 필요해서 해봤다.
paramter로 array를 사용함. 과목명과 교육목표에 특정 키워드들이 들어 갔는지 조회하는 부분에 사용...
<foreach collection="subjects" index="index" item="item" open=" AND (" close=")" separator=" ">
    <choose>
       <when test="index==0">
          B.SUBJECT_NAME LIKE '%${item}%'
          OR C.EDUC_GOAL LIKE '%${item}%'
       </when>
       <otherwise>
          OR B.SUBJECT_NAME LIKE '%${item}%'
          OR C.EDUC_GOAL LIKE '%${item}%'
       </otherwise>
    </choose>
</foreach>하고 보니 static...
<foreach collection="subjects" index="index" item="item" open=" AND (" close=")" separator=" ">
    <choose>
       <when test="index==0">
          B.SUBJECT_NAME LIKE '%#'+#{item}+'%'
          OR C.EDUC_GOAL LIKE '%#'+#{item}+'%'
       </when>
       <otherwise>
          OR B.SUBJECT_NAME LIKE '%'+#{item}+'%'
          OR C.EDUC_GOAL LIKE '%'+#{item}+'%'
       </otherwise>
    </choose>
</foreach>반응형
    
    
    
  'java > mybatis' 카테고리의 다른 글
| mybatis result net.sourceforge.jtds.jdbc.ClobImpl@object 일 경우 (0) | 2023.01.09 | 
|---|---|
| mybatis 조건문에서 java static method 사용 예시 (0) | 2022.11.08 | 
| mybatis comparision usage in condition expression ( 부등호 조건 등 ) (0) | 2022.10.04 | 
| mybatis typehandler를 이용한 oracle procedure에 list<map> parameter 넘기기 (0) | 2017.07.15 | 
| mybatis insert into table select시 ora-00933 (0) | 2017.07.01 | 
                          Comments