牛骨文教育服务平台(让学习变的简单)
博文笔记

MyBatis多条件分页查询,返回总记录数

创建时间:2017-05-25 投稿人: 浏览次数:1790
 <!-- 通过多条件分页查询,返回总记录数 -->
  <select id="selectPageCount" parameterType="page" resultType="Integer">
  select count(1) from article 
  <where>
    <if test="paramEntity.markdown!=null">and markdown like #{paramEntity.markdown}</if>
    <if test="paramEntity.title!=null">and title like #{paramEntity.title}</if>
    <if test="paramEntity.content!=null">and content like #{paramEntity.content}</if>
    <if test="paramEntity.userId!=null">and a.user_id = #{paramEntity.userId}</if>  
    <if test="paramEntity.articleType!=null">and article_type = #{paramEntity.articleType}</if>          
    </where>
  </select>
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。