123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
- <mapper namespace="com.cslg.ppa.mapper.ArticleInfoMapper">
- <select id="selectArticleInfoList" resultType="com.cslg.ppa.vo.SelectArticleInfoVO">
- select ai.id as articleId,
- ai.title,
- ai.digest,
- ai.category_id,
- ai.source_id,
- ai.public_time,
- ai.create_time,
- ai.article_url,
- ai.wx_article_icon,
- ca.name as categoryName,
- si.source_name,
- si.source_type
- from article_info ai
- left join category ca on ca.id = ai.category_id
- left join source_info si on si.id = ai.source_id
- <where>
- <if test="vo.key != null and vo.key != ''">
- ai.title like concat('%',#{vo.key},'%')
- </if>
- <if test="vo.categoryId != null">
- and ai.category_id = #{vo.categoryId}
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- and si.source_name = #{vo.sourceName}
- </if>
- <if test="vo.beginTime != null">
- and ai.public_time >= #{vo.beginTime}
- </if>
- <if test="vo.endTime != null">
- and ai.public_time <= #{vo.endTime}
- </if>
- </where>
- order by ai.public_time desc,ai.id desc
- <if test="vo.pageNum != null and vo.pageSize != null">
- limit
- ${(vo.pageNum -1) * vo.pageSize},${vo.pageSize}
- </if>
- </select>
- <select id="selectArticleInfoCount" resultType="java.lang.Long">
- select count(*)
- from article_info ai
- left join category ca on ca.id = ai.category_id
- left join source_info si on si.id = ai.source_id
- <where>
- <if test="vo.key != null and vo.key != ''">
- ai.title like concat('%',#{vo.key},'%')
- </if>
- <if test="vo.categoryId != null">
- and ai.category_id = #{vo.categoryId}
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- and si.source_name = #{vo.sourceName}
- </if>
- <if test="vo.beginTime != null">
- and ai.public_time >= #{vo.beginTime}
- </if>
- <if test="vo.endTime != null">
- and ai.public_time <= #{vo.endTime}
- </if>
- </where>
- </select>
- </mapper>
|