每日总结

今天的内容:

学习Mybatis的choose、when、otherwise标签(可以在多条件中选择一个相当于ifelse):

官方示例:

<select id="findActiveBlogLike"
     resultType="Blog">
  SELECT * FROM BLOG WHERE state = ‘ACTIVE’
  <choose>
    <when test="title != null">
      AND title like #{title}
    </when>
    <when test="author != null and author.name != null">
      AND author_name like #{author.name}
    </when>
    <otherwise>
      AND featured = 1
    </otherwise>
  </choose>
</select>

问题:无

明天的打算:继续学习Mybatis

原文地址:https://www.cnblogs.com/MXming/p/14912464.html