Просмотр исходного кода

更多 政策 资讯 百科接口

limin лет назад: 7
Родитель
Сommit
4f5eb1d42c

+ 25 - 3
src/main/java/com/goafanti/common/controller/WebpageController.java

@@ -737,14 +737,14 @@ public class WebpageController extends BaseController {
 				p.setTitleImg(p.getTitleImg().substring(0, p.getTitleImg().indexOf(",")));
 				p.setTitleImg(p.getTitleImg().substring(0, p.getTitleImg().indexOf(",")));
 			}
 			}
 		}
 		}
-		modelview.addObject("policys", policies);
+		modelview.addObject("policys", policies);//政策
 		List<News> newsList = (List<News>) newsService
 		List<News> newsList = (List<News>) newsService
 				.listNews(0, null, null, null, null, null, null, 1, 3, "2", null, null).getList();
 				.listNews(0, null, null, null, null, null, null, 1, 3, "2", null, null).getList();
-		modelview.addObject("news", newsList);
+		modelview.addObject("news", newsList);//资讯
 		//
 		//
 		List<News> subscriptions = (List<News>) newsService
 		List<News> subscriptions = (List<News>) newsService
 				.listNews(99, null, null, null, null, null, null, 1, 4, "2", null, null).getList();
 				.listNews(99, null, null, null, null, null, null, 1, 4, "2", null, null).getList();
-		modelview.addObject("subscription", subscriptions);
+		modelview.addObject("subscription", subscriptions);//技淘观点精选
 
 
 		if (subscriptions != null && subscriptions.size() > 0 && subscriptions.get(0).getSourceUrl() != null
 		if (subscriptions != null && subscriptions.size() > 0 && subscriptions.get(0).getSourceUrl() != null
 				&& subscriptions.get(0).getSourceUrl().contains(".")) {
 				&& subscriptions.get(0).getSourceUrl().contains(".")) {
@@ -1302,4 +1302,26 @@ public class WebpageController extends BaseController {
 		return modelview;
 		return modelview;
 	}
 	}
 	
 	
+	/**
+	 * 政策 资讯 百科
+	 * @param policy
+	 * @param pageNo
+	 * @param pageSize
+	 * @return
+	 */
+	@RequestMapping(value="/portal/policyAndNewsList", method = RequestMethod.GET)
+	@ResponseBody
+	public Result policyAndNewsList(Policy policy, Integer pageNo, Integer pageSize){
+		Result res = new Result();
+		//如果type是null 查看政策和新闻等的数据
+		if(null == policy.getType()){
+			res.setData(policyService.searchPolicyAndNewsList(policy, pageNo, pageSize));
+		}else if(policy.getType() >= 0){//资讯\观点\知产 news表
+			res.setData(newsService.listNews(policy.getType(), null, null, null, null, null, null, pageNo, pageSize, "2", null, null).getList());
+		}else{//政策
+			res.setData(policyService.searchPolicy(policy.getTitle(), 2, null, null, null, pageNo, pageSize, policy.getProvince()));
+		}
+		return res;
+	} 
+	
 }
 }

+ 6 - 0
src/main/java/com/goafanti/common/mapper/NewsMapperExt.xml

@@ -108,6 +108,9 @@
   	<if test="hot != null">
   	<if test="hot != null">
   		and hot = #{hot,jdbcType=INTEGER}
   		and hot = #{hot,jdbcType=INTEGER}
   	</if>
   	</if>
+  	<if test="provinceId != null">
+  		and province_id = #{provinceId,jdbcType=INTEGER}
+  	</if>
   	order by release_date desc
   	order by release_date desc
   	<if test="page_sql!=null">
   	<if test="page_sql!=null">
 			${page_sql}
 			${page_sql}
@@ -152,6 +155,9 @@
   	<if test="hot != null">
   	<if test="hot != null">
   		and hot = #{hot,jdbcType=INTEGER}
   		and hot = #{hot,jdbcType=INTEGER}
   	</if>
   	</if>
+  	<if test="provinceId != null">
+  		and province_id = #{provinceId,jdbcType=INTEGER}
+  	</if>
   </select>
   </select>
   
   
   <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">
   <delete id="batchDeleteByPrimaryKey" parameterType="java.util.List">

+ 59 - 0
src/main/java/com/goafanti/common/mapper/PolicyMapper.xml

@@ -655,4 +655,63 @@
   left join district_glossory dgg on dgg.id=p.city
   left join district_glossory dgg on dgg.id=p.city
   where p.id= #{id,jdbcType=VARCHAR}
   where p.id= #{id,jdbcType=VARCHAR}
   </select>
   </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>
 </mapper>

+ 4 - 0
src/main/java/com/goafanti/news/service/NewsService.java

@@ -231,6 +231,10 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		if (StringUtils.isNotBlank(source)) {
 		if (StringUtils.isNotBlank(source)) {
 			params.put("source", source);
 			params.put("source", source);
 		}
 		}
+		String provinceId =null; //省份
+		if (StringUtils.isNotBlank(provinceId)) {
+			params.put("provinceId", provinceId);
+		}
 
 
 		if (null != hot) {
 		if (null != hot) {
 			params.put("hot", hot);
 			params.put("hot", hot);

+ 7 - 0
src/main/java/com/goafanti/news/service/PolicyService.java

@@ -155,4 +155,11 @@ public Pagination<AppDiscoveryBo> appListPolicy(Integer pageNo, Integer pageSize
 public PolicyResult policyDetail(String id) {
 public PolicyResult policyDetail(String id) {
 	return policyMapper.selectPolicyDetail(id);
 	return policyMapper.selectPolicyDetail(id);
 }
 }
+
+@SuppressWarnings("unchecked")
+public Pagination<PolicyResult> searchPolicyAndNewsList(Policy policy, Integer pageNo, Integer pageSize){
+	Map<String, Object> params = new HashMap<>();
+	params.put("policy", policy);
+	return (Pagination<PolicyResult>) findPage("searchPolicyAndNewsList","searchPolicyAndNewsCount",params, pageNo, pageSize); 
+}
 }
 }