[MyBatis의 표현식]


 # if

  - 사용예

  <if test="content !=null">

  명령문...

  </if>

 

 # choose(when, otherwise)

  - 사용예

     <choose>

      <when test="content !=null">

      명령문.....

      </when>

      <when test="product !=null and product.code !=null">

      명령문....

      </when>

      <otherwise>

      명령문....

      </otherwise>    

     </choose>

 

 

 # trim(where, set)

 

 // 맨끝에 있는 콤마(,)를 제거하는 경우

   

  <update id="updateMember" parameterType="com.spring.xxxxxVO"> 

  update Member 

  <trim prefix="set" suffixOverrides=",">

  <if test="userName !=null">userName = #{userName},</if>

   <if test="email !=null">email = #{email},</if>

   <if test="tel !=null">tel = #{tel} </if>

</trim>

  where id = #{id}

   </update>

 // 맨 앞에 있는 연산자를(AND / OR) 제거하는 경우

 

  <select id="selectInfo" parameterType="com.spring.xxxVO" resultType="memberResultMap">

    select * from Employee 

    <trim prefix="where" prefixOverrides = "AND | OR">

    <if test ="userName !=null">userName = #{userName}</if>

    <if test ="pwd !=null">and pwd = #{pwd} </if>

    <if test ="email !=null">and email = #{email}</if>

    </trim> 

  </select>

 

 # forEach 

  <foreach item="item" index ="idx" collection="list"

  open="(" separator="," close=")">

  #{item}

  </foreach>

 

 

 

'Java' 카테고리의 다른 글

나눔고딕  (0) 2017.07.02
엑박  (0) 2017.07.02
SYNCHRONIZE 작업시 불필요한 파일 제외하기  (0) 2017.07.02
svn 싱크  (0) 2017.07.02
was 없이 컨트롤러 테스트 하기  (0) 2017.05.04

http://software.naver.com/software/summary.nhn?softwareId=MFS_107630

'Java' 카테고리의 다른 글

[MyBatis의 표현식]  (0) 2017.07.02
엑박  (0) 2017.07.02
SYNCHRONIZE 작업시 불필요한 파일 제외하기  (0) 2017.07.02
svn 싱크  (0) 2017.07.02
was 없이 컨트롤러 테스트 하기  (0) 2017.05.04

http://m.blog.naver.com/doryjj/194062257

'Java' 카테고리의 다른 글

[MyBatis의 표현식]  (0) 2017.07.02
나눔고딕  (0) 2017.07.02
SYNCHRONIZE 작업시 불필요한 파일 제외하기  (0) 2017.07.02
svn 싱크  (0) 2017.07.02
was 없이 컨트롤러 테스트 하기  (0) 2017.05.04

http://www.jang-e.net/index.php/144

'Java' 카테고리의 다른 글

나눔고딕  (0) 2017.07.02
엑박  (0) 2017.07.02
svn 싱크  (0) 2017.07.02
was 없이 컨트롤러 테스트 하기  (0) 2017.05.04
controller 에서 주로 쓰는 annotation 정리  (0) 2017.05.04

http://m.blog.naver.com/dreamct0000/120208417610

'Java' 카테고리의 다른 글

엑박  (0) 2017.07.02
SYNCHRONIZE 작업시 불필요한 파일 제외하기  (0) 2017.07.02
was 없이 컨트롤러 테스트 하기  (0) 2017.05.04
controller 에서 주로 쓰는 annotation 정리  (0) 2017.05.04
cross domain  (0) 2012.01.18

+ Recent posts