MyBatis多條件分頁查詢,返回總記錄數
阿新 • • 發佈:2019-01-25
<!-- 通過多條件分頁查詢,返回總記錄數 -->
<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>
<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>