|
|
@@ -655,4 +655,63 @@
|
|
|
left join district_glossory dgg on dgg.id=p.city
|
|
|
where p.id= #{id,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
+
|
|
|
+ <!-- 获得所有的政策和新闻等内容 -->
|
|
|
+ <select id="searchPolicyAndNewsList" parameterType="Map" resultType="com.goafanti.news.bo.PolicyResult">
|
|
|
+ select * from (
|
|
|
+ select p.title, p.author, p.audit_status as auditStatus,
|
|
|
+ p.edit_time as editTime, p.id, p.source, p.release_date as releaseDate,
|
|
|
+ p.title_img as titleImg , p.content, p.summary, dg.name as provinceS
|
|
|
+ from policy p
|
|
|
+ left join district_glossory dg on dg.id =p.province
|
|
|
+ where p.audit_status =2
|
|
|
+ <if test="policy.title != null ">
|
|
|
+ and p.title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="policy.province != null">
|
|
|
+ and p.province = #{policy.title,,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ union
|
|
|
+ select n.title, n.author, n.audit_status as auditStatus,
|
|
|
+ n.edit_time as editTime, n.id, n.source, n.release_date as releaseDate,
|
|
|
+ n.title_img as titleImg, n.content, n.summary, dg.name as provinceS
|
|
|
+ from news n
|
|
|
+ left join district_glossory dg on dg.id = n.province_id
|
|
|
+ where audit_status = 2
|
|
|
+ <if test="policy.title != null ">
|
|
|
+ and title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="policy.province != null">
|
|
|
+ and province_id = #{policy.title,,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ ) a order by releaseDate desc
|
|
|
+ <if test="page_sql!=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="searchPolicyAndNewsCount" parameterType="Map" resultType="java.lang.Integer">
|
|
|
+ select count(*) from (
|
|
|
+ select p.id
|
|
|
+ from policy p
|
|
|
+ left join district_glossory dg on dg.id =p.province
|
|
|
+ where p.audit_status =2
|
|
|
+ <if test="policy.title != null ">
|
|
|
+ and p.title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="policy.province != null">
|
|
|
+ and p.province = #{policy.title,,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ union
|
|
|
+ select n.id
|
|
|
+ from news n
|
|
|
+ left join district_glossory dg on dg.id = n.province_id
|
|
|
+ where audit_status = 2
|
|
|
+ <if test="policy.title != null ">
|
|
|
+ and title like concat('%',#{policy.title,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="policy.province != null">
|
|
|
+ and province_id = #{policy.title,,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ ) a
|
|
|
+ </select>
|
|
|
</mapper>
|