Explorar el Código

新增APP技淘观点列表

anderx hace 7 años
padre
commit
3546ee3836

+ 11 - 2
src/main/java/com/goafanti/app/controller/OpenAppDiscoveryController.java

@@ -166,7 +166,7 @@ public class OpenAppDiscoveryController extends BaseApiController {
 	@RequestMapping(value = "/listInformation", method = RequestMethod.GET)
 	public Result listInformation(Integer pageNo,Integer pageSize) {
 		Result res = new Result();
-		res.setData(newsService.appListinformation( pageNo, pageSize));
+		res.setData(newsService.listTypeNews( 0,pageNo, pageSize));
 		return res;
 	}
 	/**
@@ -184,7 +184,16 @@ public class OpenAppDiscoveryController extends BaseApiController {
 	@RequestMapping(value = "/listEncyclopedia", method = RequestMethod.GET)
 	public Result listEncyclopedia(Integer pageNo,Integer pageSize) {
 		Result res = new Result();
-		res.setData(newsService.listEncyclopedia( pageNo, pageSize));
+		res.setData(newsService.listTypeNews( 98,pageNo, pageSize));
+		return res;
+	}
+	/**
+	 * 技淘观点列表
+	 */
+	@RequestMapping(value = "/listJtViewpoint", method = RequestMethod.GET)
+	public Result listJtViewpoint(Integer pageNo,Integer pageSize) {
+		Result res = new Result();
+		res.setData(newsService.listTypeNews( 99,pageNo, pageSize));
 		return res;
 	}
 	

+ 13 - 26
src/main/java/com/goafanti/common/mapper/NewsMapper.xml

@@ -368,29 +368,7 @@
 	</select>
 	
 	
-	<select id="appNewsList" resultType="com.goafanti.app.bo.AppDiscoveryBo">
-		select
-			a.id,
-			DATE_FORMAT(a.release_date,'%Y-%m-%d') as releaseDate,
-			a.title,
-			a.content,
-			a.title_img as titleImg
-		from news a
-		left join district_glossory d on a.province_id=d.id
-		where a.type =0 and audit_status=2
-		order by a.release_date desc
-		<if test="page_sql != null">
-			${page_sql}
-		</if>
-	</select>
 	
-	<select id="appNewsCount" resultType="java.lang.Integer">
-		select 
-			count(0)
-		from news a
-		left join district_glossory d on a.province_id=d.id
-		where a.type =0	
-	</select>
 <select id="getNewsList" resultType="com.goafanti.common.model.News">
 select
 	title,
@@ -408,7 +386,10 @@ left join district_glossory dg1 on dg1.id=p.province
 left join district_glossory dg2 on dg2.id=p.city
 where audit_status = 2 and p.id=#{0}
 </select>
-	<select id="encyclopediaList" resultType="com.goafanti.app.bo.AppDiscoveryBo">
+
+	
+	
+	<select id="selectTypeNewsList" resultType="com.goafanti.app.bo.AppDiscoveryBo">
 		select
 			a.id,
 			DATE_FORMAT(a.release_date,'%Y-%m-%d') as releaseDate,
@@ -417,19 +398,25 @@ where audit_status = 2 and p.id=#{0}
 			a.title_img as titleImg
 		from news a
 		left join district_glossory d on a.province_id=d.id
-		where a.type =98 and audit_status=2
+		where audit_status=2
+		<if test="type != null"> 
+		and a.type =#{type}
+		</if>
 		order by a.release_date desc
 		<if test="page_sql != null">
 			${page_sql}
 		</if>
 	</select>
 	
-	<select id="encyclopediaCount" resultType="java.lang.Integer">
+	<select id="selectTypeNewsCount" resultType="java.lang.Integer">
 		select 
 			count(0)
 		from news a
 		left join district_glossory d on a.province_id=d.id
-		where a.type =98
+		where audit_status=2 
+		<if test="type != null"> 
+		and a.type =#{type}
+		</if>
 	</select>
 
 

+ 16 - 24
src/main/java/com/goafanti/news/service/NewsService.java

@@ -321,18 +321,7 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		
 		return newsMapper.portalNewsQuestion();
 	}
-	@SuppressWarnings("unchecked")
-	public Pagination<AppDiscoveryBo> appListinformation( Integer pNo,Integer pSize){
-		Map<String, Object> params=new HashMap<>();
-		if (pNo == null || pNo < 1)pNo = 1;
-		if (pSize == null || pSize < 1 )pSize = 10;
-		Pagination<AppDiscoveryBo>p=(Pagination<AppDiscoveryBo>) findPage("appNewsList", "appNewsCount", params, pNo, pSize);
-				List<AppDiscoveryBo> l=(List<AppDiscoveryBo>) p.getList();
-				for (AppDiscoveryBo a : l) {
-					a.setContent(a.getContent().replaceAll("<p>", "").replaceAll("</p>", ""));
-				}
-				return p;
-	}
+	
 	
 	public int deleteByPrimaryKey(long id) {
 		newsPublishMapper.deleteByNewsId(id);
@@ -355,18 +344,7 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 	}
 
 	
-	@SuppressWarnings("unchecked")
-	public Pagination<AppDiscoveryBo> listEncyclopedia(Integer pageNo, Integer pageSize) {
-		Map<String, Object> params=new HashMap<>();
-		if (pageNo == null || pageNo < 1)pageNo = 1;
-		if (pageSize == null || pageSize < 1 )pageSize = 10;
-		Pagination<AppDiscoveryBo>p= (Pagination<AppDiscoveryBo>) findPage("encyclopediaList", "encyclopediaCount", params, pageNo, pageSize);
-		List<AppDiscoveryBo> l=(List<AppDiscoveryBo>) p.getList();
-		for (AppDiscoveryBo a : l) {
-			a.setContent(a.getContent().replaceAll("<p>", "").replaceAll("</p>", ""));
-		}
-		return p;
-	}
+	
 
 	public News findAppNewsDetail(long id) {
 		return newsMapper.selectByPrimaryKey(id);
@@ -393,6 +371,20 @@ public class NewsService extends BaseMybatisDao<NewsMapper> {
 		if(collectFlag)jtCollectSearchMapper.deleteByrowId(news.getId().toString());
 		
 	}
+	
+	@SuppressWarnings("unchecked")
+	public Pagination<AppDiscoveryBo> listTypeNews(Integer type,Integer pageNo, Integer pageSize) {
+		Map<String, Object> params=new HashMap<>();
+		if (pageNo == null || pageNo < 1)pageNo = 1;
+		if (pageSize == null || pageSize < 1 )pageSize = 10;
+		if(type!=null)params.put("type", type);
+		Pagination<AppDiscoveryBo>p= (Pagination<AppDiscoveryBo>) findPage("selectTypeNewsList", "selectTypeNewsCount", params, pageNo, pageSize);
+		List<AppDiscoveryBo> l=(List<AppDiscoveryBo>) p.getList();
+		for (AppDiscoveryBo a : l) {
+			a.setContent(a.getContent().replaceAll("<p>", "").replaceAll("</p>", ""));
+		}
+		return p;
+	}