每日总结

今天的内容:

学习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

posted @ 2021-05-20 19:27  假装有知识  阅读(27)  评论(0编辑  收藏  举报