Commit cef23b7f by 吴迪

Merge remote-tracking branch 'origin/master'

parents 31eed3e5 db8c4476
......@@ -380,16 +380,26 @@ public class NewsController extends AbstractController {
@Login
@GetMapping("/api/knowledgeinfo/{id}")
public R getInfo(@PathVariable("id") Integer id) {
KnowledgeinfoEntity retMap = this.knowledgeinfoService.getById(id);
return R.ok().put("data", retMap);
}
/**资讯排行TOP10*/
@Login
@GetMapping("/api/newsTop10")
KnowledgeinfoEntity retMap = this.knowledgeinfoService.getById(id);
return R.ok().put("data", retMap);
}
/**资讯排行TOP10*/
@Login
@GetMapping("/api/newsTop10")
public R newsTop10() {
List<NewsEntity> list = this.newsService.newsTop10();
return R.ok().put("data", list);
}
/**知识检索分页列表*/
@Login
@PostMapping("/api/searchKnowledgePageList")
public R searchKnowledgePageList(@RequestBody NewsParams params) {
Page<List<Map<String, Object>>> page = this.newsService.searchKnowledgePageList(params,
new Page(params.getPage(), params.getLimit()));
PageUtils pageUtils = new PageUtils(page);
return R.ok().put("data", pageUtils);
}
}
......@@ -74,4 +74,5 @@ public interface NewsDao extends BaseMapper<NewsEntity> {
List<NewsEntity> newsTop10();
List<Map<String, Object>> searchKnowledgeInfoNewList(@Param("params") Map<String, Object> map, Page page);
}
......@@ -73,5 +73,6 @@ public interface NewsService extends IService<NewsEntity> {
List<NewsEntity> newsTop10();
Page<List<Map<String, Object>>> searchKnowledgePageList(NewsParams params, Page page);
}
......@@ -2,6 +2,7 @@ package io.office.modules.manage.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiniu.util.StringUtils;
import io.office.common.utils.R;
import io.office.modules.manage.entity.*;
import io.office.modules.manage.entity.dto.NewsParams;
......@@ -10,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -216,6 +218,9 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
@Override
public List<GlossaryEntity> glossaryList(NewsParams newsParams) {
List<GlossaryEntity> list = this.newsDao.glossaryList(newsParams);
if("4".equals(newsParams.getType())){
list = list.stream().filter(item->item.getTitleEn().substring(0,1).equals(newsParams.getTitle())).collect(Collectors.toList());
}
return list;
}
......@@ -359,6 +364,106 @@ public class NewsServiceImpl extends ServiceImpl<NewsDao, NewsEntity> implements
return list;
}
@Override
public Page<List<Map<String, Object>>> searchKnowledgePageList(NewsParams newsParams, Page page) {
Map<String,Object> map = new HashMap<>();
if("sptm".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","40");
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","sptm");
map.put("title",newsParams.getTitle());
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("ewtm".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","45");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","ewtm");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("zxcbm".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","93");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","zxcbm");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("dwbm".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","94");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","dwbm");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("gln".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","95");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","gln");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("epc".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","83");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("rfid".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","77");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("gds".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","85");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","gds");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("ecr".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","81");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","ecr");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}else if("ebXML".equals(newsParams.getType())){
map = new HashMap<>();
map.put("name","79");
map.put("title",newsParams.getTitle());
List<String> child = getChild(map);
map.put("list",child);
map.put("typeName","ebXML");
List<Map<String, Object>> dataList = getDataListNew(map,page);
page.setRecords(dataList);
}
return page;
}
private List<Map<String, Object>> getDataListNew(Map<String, Object> map, Page page) {
List<Map<String,Object>> list = this.newsDao.searchKnowledgeInfoNewList(map,page);
return list;
}
private List<Map<String,Object>> getDataList(Map<String, Object> map) {
List<Map<String,Object>> list = this.newsDao.searchKnowledgeInfo(map);
return list;
......
......@@ -478,4 +478,19 @@
ORDER BY
hits DESC
</select>
<select id="searchKnowledgeInfoNewList" resultType="java.util.Map">
SELECT
Title,knowledgeInfoID,#{params.typeName} as type
FROM
knowledgeInfo t
LEFT JOIN knowledgeCategory tt ON t.knowledgeCategoryID = tt.knowledgeCategoryID
where 1=1
<if test="params.title !=null and params.title !=''">
and t.Title like concat(concat('%',#{title}),'%')
</if>
and t.knowledgeCategoryID in
<foreach collection="params.list" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment