■ mybatis 조건입력에 사용될 파라메터 object(Person.java)
import java.util.List; public class Person { private boolean deleteAll; private List<String> gubun; private String useYn; public boolean isDeleteAll() { return deleteAll; } public void setDeleteAll(boolean deleteAll) { this.deleteAll = deleteAll; } public List<String> getGubun() { return gubun; } public void setGubun(List<String> gubun) { this.gubun = gubun; } public String getUseYn() { return useYn; } public void setUseYn(String useYn) { this.useYn = useYn; } }
■ Person 조건 객체(p object)에 값 입력
Person p = new Person(); p.setDeleteAll(true); p.setUseYn("Y"); List<String> list = new ArrayList<String>(); list.add("A"); list.add("B"); list.add("C"); p.setGubun(list);
■ mapper에서 if 조건문 예제(하나의 조건 : deleteYn)
<select id="listPerson1" parameterType="Person" resultType="Person"> SELECT * FROM TBL WHERE 1=1 <if test="deleteAll.equals(true)"> ...QUERY... </if> </select>
■ mapper에서 if 조건문 예제(하나 이상의 조건 : deleteAll, useYn)
<select id="listPerson2" parameterType="Person" resultType="Person"> SELECT * FROM TBL WHERE 1=1 <if test="deleteAll.equals(true) and uesYn.equals('Y')"> ...QUERY... </if> </select>
■ mapper에서 choose…when…otherwise 조건문 예제
<select id="listPerson3" parameterType="Person" resultType="Person"> SELECT * FROM TBL WHERE 1=1 <choose> <when test="deleteAll.equals(true)">...QUERY...</when> <when test="uesYn.equals('Y')">...QUERY...</when> <otherwise>...QUERY...</otherwise> </choose> </select>
■ mapper에서 foreach 조건문 예제
<select id="listPerson4" parameterType="Person" resultType="Person"> SELECT * FROM TBL WHERE 1=1 AND <foreach collection="gubun" item="item" separator="OR" open="(" close=")"> NAME LIKE #{item}||'%' </foreach> </select>
- JSP 파일 캐시 방지 2023년 1월 9일
- SpringBoot Port 변경 2022년 12월 27일
- jenkins, Tomcat return http status error: 401 에러 2022년 10월 12일
- jenkins 빌드할때 Unsupported class file major version 63 에러 발생 2022년 10월 12일
- Python mysql like 검색 2022년 8월 22일
- agGrid cell style 지정 2022년 3월 12일
- AngularJS Error: error:tplrt Invalid Template Root 2019년 12월 10일
- Java 콤마로 구분된 코드들을 List로 변환 2019년 12월 6일
- SuppressWarnings, unused , 경고무시 어노테이션 2019년 8월 13일
- Spring 트랜잭션 관리 2019년 6월 20일
- Spring RESTful 웹 서비스 사용하기 2019년 6월 19일
- Spring RESTful 웹 서비스 2019년 6월 19일
- Spring Scheduling Task 예제 2019년 6월 18일
- AngularJS fromJson, toJson 사용법 2019년 5월 15일
- 워드프레스 댓글 관리(댓글 삭제 방법) 2019년 4월 8일
- Java 메일전송 예제 2019년 4월 3일
- Java에서 properties파일 읽기 2019년 4월 3일
- 이클립스 에디터 동일 파일 화면 분할 2019년 3월 27일
- Java 배열을 리스트로, 리스트를 배열로 변환 2019년 3월 27일
- weblogic.jdbc.wrapper.clob_oracle_sql_clob cannot be cast to oracle.sql.clob 2019년 3월 21일
- Java keytool 사용법 2019년 3월 14일
- Tomcat 시작시 ServletContextListener를 통한 mySQL 접속 2018년 5월 8일
- XML파일 정보를 읽어 Java VO에 저장 2018년 5월 8일
- Eclipse에서 Maven으로 Tomcat 시작 2018년 5월 8일
- spring mybatis mysql 연결 예제 2018년 5월 4일
- myBatis 조건문 예제 2018년 5월 3일
- apache commons StringUtils 예제 2018년 5월 3일
- apache commons DateFormatUtils 예제 2018년 5월 3일
- Spring Path Parameter 예제 2018년 2월 13일
- 자바 래퍼 클래스(Java Wrapper Class)? 2018년 2월 13일
- java string 변수 switch, junit test 2018년 2월 12일
- AngularJS $http, spring TEXT response 예제 2018년 1월 17일
- jdom2를 이용한 spring xml response(응답) 2017년 12월 5일
- jquery xml 요청, spring xml 리턴 2017년 12월 5일
- spring controller에서 get, post 동시 허용 방법 2017년 12월 5일
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 2017년 12월 4일
- mybatis, oracle procedure(오라클 커서)를 통한 데이터 조회 2017년 11월 6일
- HTTP 406 Not Acceptable in Spring, Jackson, Json 2017년 11월 6일
- 단정문 assertEquals와 assertSame의 차이점 2017년 4월 12일
- java continue, break 키워드 2017년 3월 25일
- maven filtering – 메이븐 필터링 2016년 10월 24일
- maven profiles – 개발/운영 환경별 빌드 2016년 10월 24일
- maven pom.xml에서 로그 출력하기 2016년 5월 30일
- spring service junit test 2016년 5월 25일
- ServletContextLister를 구현한 웹 애플리케이션 시작 시 작업 2016년 5월 2일
- mybatis mapper junit test 2016년 5월 2일
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 2016년 5월 2일
- JUnit Controller Test java.lang.NoClassDefFoundError: javax/servlet/SessionCookieConfig 2016년 3월 22일
- Maven skipTests – Maven JUnit 테스트 안하기 2016년 3월 18일
- maven compile option -Xlint:deprecation 2016년 3월 17일
- Maven encoding 2016년 3월 17일
- TIBCO ActiveSpace Eclipse Maven 2016년 3월 16일
- java eclipse static import 2016년 3월 15일
- junit 단정문 – Assertions 2016년 3월 14일
- junit & spring-test maven dependency 2016년 3월 14일
- Jetty Maven Plugin 2016년 3월 9일
- java.lang.UnsupportedClassVersionError: org/eclipse/jetty/maven/plugin/JettyRunMojo : Unsupported major.minor version 52.0 2016년 3월 9일
- Web Application MessageResource 2016년 3월 8일
- java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? 2016년 3월 8일
- Java String, 자바 문자열 2016년 3월 3일
- org.mariadb.jdbc.internal.common.QueryException : No database selected 2016년 2월 19일
- java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet 2016년 2월 19일
- jquery spring – checkbox로 선택된 배열 주고 받기 2015년 8월 15일
- jquery spring ajax call 2015년 8월 15일
- spring json return 2015년 8월 15일
- spring exception – SimpleMappingExceptionResolver 2015년 8월 8일
- sqlSessionFactory빈 생성 에러 2015년 1월 1일
- redundant cast to ‘XXX’ 2015년 1월 1일
- 이클립스 콘솔버퍼 제한 2015년 1월 1일
- Map is a raw type 2015년 1월 1일
- servlet-api duplicate 2015년 1월 1일
- eclipse maven 디버그(debug) 모드로 빌드 2014년 11월 21일
- No Spring WebApplicationInitializer types detected on classpath 에러 2014년 11월 21일
- logback 일별 로깅 – logback daily logging 2014년 11월 16일
- logback 파일에 로깅하기 – logback file logging 2014년 11월 15일
- Logback 기본 설정 2014년 11월 15일
- logback encoder pattern 2014년 11월 11일
- org.apache.ibatis.binding.BindingException 디버깅 2014년 11월 11일
- maven-war-plugin webXml, 개발 환경별 web.xml 관리 2014년 11월 10일
- 명령행 모드 메이븐 프로젝트 생성하기 2014년 9월 17일
- eclipse maven tomcat 자동 재시작 2014년 9월 13일