MyBatis级联多条件分页查询

来源:互联网 发布:mac在windows截图 编辑:程序博客网 时间:2024/05/21 00:15
<!-- 通过多条件分页查询,返回数据集 -->
  <select id="selectPageListUseDyc" parameterType="page" resultMap="articleResultMap" >
    select a.article_id, a.title, a.img_url,a.article_type,a.add_time,a.like_num,a.content,a.markdown,b.user_id,
    b.user_name,b.user_photo
    FROM article a join user b on a.user_id = b.user_id
    <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>
    order by a.like_num DESC limit #{start},#{rows} 
  </select>