Browse Source

最热话题、最新话题后台查询列表接口

dev
尹作梅 6 years ago
parent
commit
73eb30fd1f
  1. 86
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/result/TopicResultDTO.java
  2. 71
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/controller/TopicController.java
  3. 53
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/dao/TopicDao.java
  4. 49
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/service/TopicService.java
  5. 59
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/service/impl/TopicServiceImpl.java
  6. 90
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/topic/TopicDao.xml

86
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-client/src/main/java/com/elink/esua/epdc/dto/result/TopicResultDTO.java

@ -0,0 +1,86 @@
package com.elink.esua.epdc.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Description 最热话题列表DTO
* @Author yinzuomei
* @Date 2020/2/10 11:31
*/
@Data
public class TopicResultDTO implements Serializable {
private static final long serialVersionUID = -1938141144074477454L;
/**
* 主键
*/
private String id;
/**
* 话题摘要
*/
private String topicContent;
/**
* 父所有部门ID
*/
private String parentDeptIds;
/**
* 父所有部门
*/
private String parentDeptNames;
/**
* 所有部门ID
*/
private String allDeptIds;
/**
* 所有部门
*/
private String allDeptNames;
/**
* 网格
*/
private String grid;
/**
* 网格ID
*/
private Long gridId;
/**
* 网格来源群名称
*/
private String groupName;
/**
* 话题发布人姓名
*/
private String nickname;
/**
* 发布时间
*/
private Date releaseTime;
/**
* 评论数评论+回复
*/
private Integer commentNum;
/**
* 浏览数
*/
private Integer browseNum;
/**
* 表达态度评论+回复+浏览
*/
private Integer expressAttitudeNum;
}

71
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/controller/TopicController.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.topic.controller;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.dto.result.TopicResultDTO;
import com.elink.esua.epdc.modules.topic.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* 话题相关接口
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-10-10
*/
@RestController
@RequestMapping("topic")
public class TopicController {
@Autowired
private TopicService topicService;
/**
* @param params
* @return com.elink.esua.epdc.dto.result.TopicResultDTO
* @Author yinzuomei
* @Description 最热话题列表查询
* @Date 2020/2/10 11:34
**/
@GetMapping("pageHottestTopic")
public Result<PageData<TopicResultDTO>> pageHottestTopic(@RequestParam Map<String, Object> params) {
PageData<TopicResultDTO> page = topicService.listHottestTopic(params);
return new Result<PageData<TopicResultDTO>>().ok(page);
}
/**
* @param params
* @return com.elink.esua.epdc.dto.result.TopicResultDTO
* @Author yinzuomei
* @Description 最新话题列表查询
* @Date 2020/2/10 12:50
**/
@GetMapping("pageLatestTopic")
public Result<PageData<TopicResultDTO>> pageLatestTopic(@RequestParam Map<String, Object> params) {
PageData<TopicResultDTO> page = topicService.listLatestTopic(params);
return new Result<PageData<TopicResultDTO>>().ok(page);
}
}

53
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/dao/TopicDao.java

@ -0,0 +1,53 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.topic.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.elink.esua.epdc.dto.result.TopicResultDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
/**
* 话题表 话题表
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-10-10
*/
@Mapper
public interface TopicDao extends BaseMapper<TopicResultDTO> {
/**
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.result.TopicResultDTO>
* @Author yinzuomei
* @Description 最热话题列表查询
* @Date 2020/2/10 11:52
**/
List<TopicResultDTO> selectListHottestTopicDTO(Map<String, Object> params);
/**
* @param params
* @return java.util.List<com.elink.esua.epdc.dto.result.TopicResultDTO>
* @Author yinzuomei
* @Description 最新话题列表查询
* @Date 2020/2/10 12:51
**/
List<TopicResultDTO> selectListLatesttTopicDTO(Map<String, Object> params);
}

49
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/service/TopicService.java

@ -0,0 +1,49 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.elink.esua.epdc.modules.topic.service;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.dto.result.TopicResultDTO;
import java.util.Map;
/**
* 话题相关Service
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2019-10-10
*/
public interface TopicService {
/**
* @param params
* @return com.elink.esua.epdc.dto.result.TopicResultDTO
* @Author yinzuomei
* @Description 最热话题列表查询
* @Date 2020/2/10 11:34
**/
PageData<TopicResultDTO> listHottestTopic(Map<String, Object> params);
/**
* @param params
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.result.TopicResultDTO>
* @Author yinzuomei
* @Description 最新话题列表查询
* @Date 2020/2/10 12:50
**/
PageData<TopicResultDTO> listLatestTopic(Map<String, Object> params);
}

59
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/java/com/elink/esua/epdc/modules/topic/service/impl/TopicServiceImpl.java

@ -0,0 +1,59 @@
package com.elink.esua.epdc.modules.topic.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.datasources.DataSourceNames;
import com.elink.esua.epdc.datasources.annotation.DataSource;
import com.elink.esua.epdc.dto.result.TopicResultDTO;
import com.elink.esua.epdc.modules.topic.dao.TopicDao;
import com.elink.esua.epdc.modules.topic.service.TopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* @Description 话题相关Service
* @Author yinzuomei
* @Date 2020/2/10 10:56
*/
@Service
public class TopicServiceImpl extends BaseServiceImpl<TopicDao, TopicResultDTO> implements TopicService {
@Autowired
private TopicDao topicDao;
/**
* @param params
* @return com.elink.esua.epdc.dto.result.HottestTopicResultDTO
* @Author yinzuomei
* @Description 最热话题列表查询
* @Date 2020/2/10 12:53
**/
@DataSource(name = DataSourceNames.FIFTH)
@Override
public PageData<TopicResultDTO> listHottestTopic(Map<String, Object> params) {
IPage<TopicResultDTO> page = getPage(params);
List<TopicResultDTO> list = topicDao.selectListHottestTopicDTO(params);
return new PageData<>(list, page.getTotal());
}
/**
* @param params
* @return com.elink.esua.epdc.dto.result.LatestTopicResultDTO
* @Author yinzuomei
* @Description 最新话题列表查询
* @Date 2020/2/10 12:53
**/
@DataSource(name = DataSourceNames.FIFTH)
@Override
public PageData<TopicResultDTO> listLatestTopic(Map<String, Object> params) {
IPage<TopicResultDTO> page = getPage(params);
List<TopicResultDTO> list = topicDao.selectListLatesttTopicDTO(params);
return new PageData<>(list, page.getTotal());
}
}

90
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/topic/TopicDao.xml

@ -0,0 +1,90 @@
<?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.elink.esua.epdc.modules.topic.dao.TopicDao">
<!-- 最热话题列表查询 -->
<select id="selectListHottestTopicDTO" resultType="com.elink.esua.epdc.dto.result.TopicResultDTO">
select
et.ID,
et.TOPIC_CONTENT,
et.PARENT_DEPT_IDS,
et.PARENT_DEPT_NAMES,
et.ALL_DEPT_IDS,
et.ALL_DEPT_NAMES,
et.GRID_ID,
et.GRID,
et.GROUP_NAME,
et.NICKNAME,
et.CREATED_TIME as releaseTime,
et.COMMENT_NUM,
et.BROWSE_NUM,
et.COMMENT_NUM+et.BROWSE_NUM as expressAttitudeNum
from epdc_topic et
where et.DEL_FLAG='0'
<if test="topicContent != null and topicContent != ''">
and et.TOPIC_CONTENT like concat('%', #{topicContent}, '%')
</if>
<if test="streetId != null and streetId != ''">
AND (find_in_set(#{streetId},et.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},et.ALL_DEPT_IDS))
</if>
<if test="communityId != null and communityId != ''">
AND (find_in_set(#{communityId},et.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},et.ALL_DEPT_IDS))
</if>
<if test="gridId != null and gridId != ''">
AND (et.GRID_ID = #{gridId}
OR find_in_set(#{gridId},et.ALL_DEPT_IDS))
</if>
<if test="startTime != null and startTime != ''">
and DATE_FORMAT( et.CREATED_TIME, '%Y-%m-%d' ) &gt;=#{startTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT( et.CREATED_TIME, '%Y-%m-%d' ) &lt;=#{endTime}
</if>
order by expressAttitudeNum desc
</select>
<!-- 最新话题列表查询 -->
<select id="selectListLatesttTopicDTO" resultType="com.elink.esua.epdc.dto.result.TopicResultDTO">
select
et.ID,
et.TOPIC_CONTENT,
et.PARENT_DEPT_IDS,
et.PARENT_DEPT_NAMES,
et.ALL_DEPT_IDS,
et.ALL_DEPT_NAMES,
et.GRID_ID,
et.GRID,
et.GROUP_NAME,
et.NICKNAME,
et.CREATED_TIME as releaseTime,
et.COMMENT_NUM,
et.BROWSE_NUM,
et.COMMENT_NUM+et.BROWSE_NUM as expressAttitudeNum
from epdc_topic et
where et.DEL_FLAG='0'
<if test="topicContent != null and topicContent != ''">
and et.TOPIC_CONTENT like concat('%', #{topicContent}, '%')
</if>
<if test="streetId != null and streetId != ''">
AND (find_in_set(#{streetId},et.PARENT_DEPT_IDS)
OR find_in_set(#{streetId},et.ALL_DEPT_IDS))
</if>
<if test="communityId != null and communityId != ''">
AND (find_in_set(#{communityId},et.PARENT_DEPT_IDS)
OR find_in_set(#{communityId},et.ALL_DEPT_IDS))
</if>
<if test="gridId != null and gridId != ''">
AND (et.GRID_ID = #{gridId}
OR find_in_set(#{gridId},et.ALL_DEPT_IDS))
</if>
<if test="startTime != null and startTime != ''">
and DATE_FORMAT( et.CREATED_TIME, '%Y-%m-%d' ) &gt;=#{startTime}
</if>
<if test="endTime != null and endTime != ''">
and DATE_FORMAT( et.CREATED_TIME, '%Y-%m-%d' ) &lt;=#{endTime}
</if>
order by expressAttitudeNum desc,releaseTime desc
</select>
</mapper>
Loading…
Cancel
Save