| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <?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.goafanti.common.dao.NewsMapper">
- <resultMap id="SummaryResultMap" type="com.goafanti.news.bo.NewsSummary">
- <id column="id" jdbcType="BIGINT" property="id" />
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
- <result column="title" jdbcType="VARCHAR" property="title" />
- <result column="title_img" jdbcType="VARCHAR" property="titleImg" />
- <result column="type" jdbcType="INTEGER" property="type" />
- <result column="hot" jdbcType="INTEGER" property="hot" />
- <result column="summary" jdbcType="VARCHAR" property="summary" />
- <result column="source" jdbcType="VARCHAR" property="source" />
- <result column="audit_status" jdbcType="INTEGER" property="auditStatus" />
- <result column="release_status" jdbcType="INTEGER" property="releaseStatus" />
- </resultMap>
- <sql id="Summary_Column_List">
- id, create_time, title, title_img, type, hot, summary, source,audit_status,release_status
- </sql>
- <select id="findList" resultType="com.goafanti.news.bo.NewsSummary">
- select
- a.id,
- a.create_time as createTime,
- a.title,
- a.title_img as titleImg,
- a.type,
- a.hot,
- a.summary,
- a.source
- from news a
- join branch_office_info b
- on a.province_id = b.province_id
- where 1=1
- <if test="type != null">
- and a.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="website != null">
- and b.website = #{website,jdbcType=VARCHAR}
- </if>
- <if test="picRequired != null">
- and a.title_img is not null and a.title_img != ''
- </if>
-
- order by create_time desc
- limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
- </select>
-
- <select id="findIndexNewsList" resultMap="SummaryResultMap">
- select
- <include refid="Summary_Column_List" />
- from news
- where hot = 1
- <if test=" type != null">
- and type = #{type,jdbcType=INTEGER}
- </if>
- order by create_time desc
- limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
- </select>
-
- <select id="findNewsListByPage" parameterType="String" resultMap="BaseResultMap">
- select
- n.id,
- n.create_time,
- n.title,
- n.author,
- n.type,
- n.hot,
- n.source,
- n.summary,
- n.audit_status as auditStatus,
- n.release_status as releaseStatus,
- n.top_number as topNumber,
- n.hotspot,
- n.release_date as releaseDate
- from news n
- <if test="publishPage !=null">
- left join news_publish np on np.news_id= n.id
- </if>
- where (n.type =0 or n.type=98 or n.type=99)
- <if test="publishPage !=null">
- and np.publish_page =#{publishPage,jdbcType=VARCHAR}
- </if>
- <if test="auditStatus != null">
- and audit_status = #{auditStatus,jdbcType=INTEGER}
- </if>
- <if test="releaseStatus != null">
- and release_status = #{releaseStatus,jdbcType=INTEGER}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=INTEGER}
- </if>
- <if test="title != null">
- and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
- </if>
- <if test="author != null">
- and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
- </if>
- <if test="sDate != null">
- and create_time <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
- </if>
- <if test="eDate != null">
- and create_time <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
- </if>
- <if test="source != null">
- and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
- </if>
- <if test="hot != null">
- and hot = #{hot,jdbcType=INTEGER}
- </if>
- order by release_date desc
- <if test="page_sql!=null">
- ${page_sql}
- </if>
- </select>
-
- <select id="findNewsCount" parameterType="String" resultType="java.lang.Integer">
- select
- count(1)
- from news n
- <if test="publishPage !=null">
- left join news_publish np on np.news_id= n.id
- </if>
- where (n.type =0 or n.type=98 or n.type=99)
- <if test="publishPage !=null">
- and np.publish_page =#{publishPage,jdbcType=VARCHAR}
- </if>
- <if test="auditStatus != null">
- and audit_status = #{auditStatus,jdbcType=INTEGER}
- </if>
- <if test="releaseStatus != null">
- and release_status = #{releaseStatus,jdbcType=INTEGER}
- </if>
- <if test="type != null">
- and type = #{type,jdbcType=INTEGER}
- </if>
- <if test="title != null">
- and title like CONCAT('%',#{title,jdbcType=VARCHAR},'%')
- </if>
- <if test="author != null">
- and author like CONCAT('%',#{author,jdbcType=VARCHAR},'%')
- </if>
- <if test="sDate != null">
- and create_time <![CDATA[ >= ]]> #{sDate,jdbcType=TIMESTAMP}
- </if>
- <if test="eDate != null">
- and create_time <![CDATA[ < ]]> #{eDate,jdbcType=TIMESTAMP}
- </if>
- <if test="source != null">
- and source like CONCAT('%',#{source,jdbcType=VARCHAR},'%')
- </if>
- <if test="hot != null">
- and hot = #{hot,jdbcType=INTEGER}
- </if>
- </select>
-
- <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">
- delete
- from news
- where id in
- <foreach item="item" index="index" collection="list" open="("
- separator="," close=")">
- #{item}
- </foreach>
- </delete>
-
- <select id="findPortalList" resultType="com.goafanti.news.bo.NewsPortalList">
- select
- a.id,
- a.create_time as createTime,
- a.title,
- a.title_img as titleImg,
- a.type,
- a.hot,
- a.summary,
- a.source
- from news a
- join branch_office_info b
- on a.province_id = b.province_id
- where 1 =1
- <if test="type != null and type != 0" >
- and a.type = #{type,jdbcType=INTEGER}
- </if>
- <if test="website != null">
- and b.website = #{website,jdbcType=VARCHAR}
- </if>
- order by create_time desc
- limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
- </select>
-
- <select id="findJmrhNewsList" parameterType="String" resultMap="SummaryResultMap">
- select
- id,title,create_time
- from
- news
- where
- jmrh_flag = 1 and type = #{type,jdbcType=INTEGER}
- order by
- create_time desc
- limit 3;
- </select>
- <select id="findIndexNewsLists" resultMap="SummaryResultMap">
- select
- <include refid="Summary_Column_List" />
- from news
- where
- type = 1
- order by create_time desc
- limit #{pageNo,jdbcType=INTEGER}, #{pageSize,jdbcType=INTEGER}
- </select>
- </mapper>
|