12 changed files with 395 additions and 64 deletions
@ -0,0 +1,64 @@ |
|||||
|
package com.elink.esua.epdc.dto.issue.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
/** |
||||
|
* @Description 议题列表DTO |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 15:58 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class IssueResultDTO implements Serializable { |
||||
|
/** |
||||
|
* epdc_issue主键 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 议题内容 |
||||
|
*/ |
||||
|
private String issueContent; |
||||
|
|
||||
|
/** |
||||
|
* 来源网格-所有部门 |
||||
|
*/ |
||||
|
private String allDeptNames; |
||||
|
|
||||
|
/** |
||||
|
* 用户昵称 |
||||
|
*/ |
||||
|
private String nickName; |
||||
|
|
||||
|
/** |
||||
|
* 发布时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 支持-点赞次数 |
||||
|
*/ |
||||
|
private Integer approveNum; |
||||
|
|
||||
|
/** |
||||
|
* 反对-踩次数 |
||||
|
*/ |
||||
|
private Integer opposeNum; |
||||
|
|
||||
|
/** |
||||
|
* 评论数 |
||||
|
*/ |
||||
|
private Integer commentNum; |
||||
|
|
||||
|
/** |
||||
|
* 浏览数 |
||||
|
*/ |
||||
|
private Integer browseNum; |
||||
|
|
||||
|
/** |
||||
|
* 表达态度(评论+回复+浏览) |
||||
|
*/ |
||||
|
private Integer expressAttitudeNum; |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.elink.esua.epdc.modules.issue.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.issue.result.IssueResultDTO; |
||||
|
import com.elink.esua.epdc.modules.issue.service.IssueService; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* @Description 议题相关 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("issue") |
||||
|
public class IssueController { |
||||
|
@Autowired |
||||
|
private IssueService issueService; |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.dto.issue.result.IssueResultDTO |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最热议题列表 |
||||
|
* @Date 2020/2/10 16:15 |
||||
|
**/ |
||||
|
@GetMapping("pageHottestIssue") |
||||
|
public Result<PageData<IssueResultDTO>> pageHottestIssue(@RequestParam Map<String, Object> params) { |
||||
|
PageData<IssueResultDTO> page = issueService.listHottestIssue(params); |
||||
|
return new Result<PageData<IssueResultDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.dto.issue.result.IssueResultDTO |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最新议题列表 |
||||
|
* @Date 2020/2/10 16:15 |
||||
|
**/ |
||||
|
@GetMapping("pageLatestIssue") |
||||
|
public Result<PageData<IssueResultDTO>> pageLatestIssue(@RequestParam Map<String, Object> params) { |
||||
|
PageData<IssueResultDTO> page = issueService.listLatestIssue(params); |
||||
|
return new Result<PageData<IssueResultDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
/** |
||||
|
* 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.issue.dao; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
||||
|
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 议题相关 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface IssueDao extends BaseDao<IssueResultDTO> { |
||||
|
/** |
||||
|
* @param params |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最热议题列表 |
||||
|
* @Date 2020/2/10 16:19 |
||||
|
**/ |
||||
|
List<IssueResultDTO> selectListHottestIssue(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return java.util.List<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最新议题列表 |
||||
|
* @Date 2020/2/10 16:19 |
||||
|
**/ |
||||
|
List<IssueResultDTO> selectListLatestIssue(Map<String, Object> params); |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.elink.esua.epdc.modules.issue.service; |
||||
|
|
||||
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
||||
|
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Description 议题相关 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
public interface IssueService { |
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最热议题列表 |
||||
|
* @Date 2020/2/10 16:16 |
||||
|
**/ |
||||
|
PageData<IssueResultDTO> listHottestIssue(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最新议题列表 |
||||
|
* @Date 2020/2/10 16:16 |
||||
|
**/ |
||||
|
PageData<IssueResultDTO> listLatestIssue(Map<String, Object> params); |
||||
|
} |
@ -0,0 +1,59 @@ |
|||||
|
package com.elink.esua.epdc.modules.issue.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.commons.tools.security.user.SecurityUser; |
||||
|
import com.elink.esua.epdc.commons.tools.security.user.UserDetail; |
||||
|
import com.elink.esua.epdc.datasources.DataSourceNames; |
||||
|
import com.elink.esua.epdc.datasources.annotation.DataSource; |
||||
|
import com.elink.esua.epdc.dto.issue.result.IssueResultDTO; |
||||
|
import com.elink.esua.epdc.modules.issue.dao.IssueDao; |
||||
|
import com.elink.esua.epdc.modules.issue.service.IssueService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Description 议题相关 |
||||
|
* @Author yinzuomei |
||||
|
* @Date 2020/2/10 16:06 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class IssueServiceImpl extends BaseServiceImpl<IssueDao, IssueResultDTO> implements IssueService { |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最热议题列表 |
||||
|
* @Date 2020/2/10 16:17 |
||||
|
**/ |
||||
|
@DataSource(name = DataSourceNames.FOURTH) |
||||
|
@Override |
||||
|
public PageData<IssueResultDTO> listHottestIssue(Map<String, Object> params) { |
||||
|
UserDetail userDetail= SecurityUser.getUser(); |
||||
|
params.put("deptIdList",userDetail.getDeptIdList()); |
||||
|
IPage<IssueResultDTO> page = getPage(params); |
||||
|
List<IssueResultDTO> list = baseDao.selectListHottestIssue(params); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @param params |
||||
|
* @return com.elink.esua.epdc.commons.tools.page.PageData<com.elink.esua.epdc.dto.issue.result.IssueResultDTO> |
||||
|
* @Author yinzuomei |
||||
|
* @Description 最新议题列表 |
||||
|
* @Date 2020/2/10 16:17 |
||||
|
**/ |
||||
|
@DataSource(name = DataSourceNames.FOURTH) |
||||
|
@Override |
||||
|
public PageData<IssueResultDTO> listLatestIssue(Map<String, Object> params) { |
||||
|
UserDetail userDetail= SecurityUser.getUser(); |
||||
|
params.put("deptIdList",userDetail.getDeptIdList()); |
||||
|
IPage<IssueResultDTO> page = getPage(params); |
||||
|
List<IssueResultDTO> list = baseDao.selectListLatestIssue(params); |
||||
|
return new PageData<>(list, page.getTotal()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,106 @@ |
|||||
|
<?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.issue.dao.IssueDao"> |
||||
|
<!-- 最热议题列表 --> |
||||
|
<select id="selectListHottestIssue" resultType="com.elink.esua.epdc.dto.issue.result.IssueResultDTO"> |
||||
|
SELECT |
||||
|
ei.ID, |
||||
|
ei.ISSUE_CONTENT, |
||||
|
ei.ALL_DEPT_NAMES, |
||||
|
ei.NICK_NAME, |
||||
|
ei.CREATED_TIME, |
||||
|
ee.APPROVE_NUM, |
||||
|
ee.OPPOSE_NUM, |
||||
|
ee.COMMENT_NUM, |
||||
|
ee.BROWSE_NUM, |
||||
|
( ee.COMMENT_NUM + ee.BROWSE_NUM + ee.APPROVE_NUM + ee.OPPOSE_NUM ) AS expressAttitudeNum |
||||
|
FROM |
||||
|
esua_epdc_events.epdc_issue ei |
||||
|
LEFT JOIN esua_epdc_events.epdc_events ee ON ee.ID = ei.EVENT_ID |
||||
|
AND ee.DEL_FLAG = '0' |
||||
|
<if test="issueContent != null and issueContent != ''"> |
||||
|
AND ei.ISSUE_CONTENT LIKE CONCAT('%',#{issueContent},'%') |
||||
|
</if> |
||||
|
<if test="streetId != null and streetId != ''"> |
||||
|
AND (find_in_set(#{streetId},ei.PARENT_DEPT_IDS) |
||||
|
OR find_in_set(#{streetId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="communityId != null and communityId != ''"> |
||||
|
AND (find_in_set(#{communityId},ei.PARENT_DEPT_IDS) |
||||
|
OR find_in_set(#{communityId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="gridId != null and gridId != ''"> |
||||
|
AND (ei.GRID_ID = #{gridId} |
||||
|
OR find_in_set(#{gridId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( ei.CREATED_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( ei.CREATED_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
<if test="deptIdList!=null and deptIdList.size()>0"> |
||||
|
and ei.GRID_ID in |
||||
|
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")"> |
||||
|
#{deptId} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
WHERE |
||||
|
ei.DEL_FLAG = '0' |
||||
|
AND ei.ISSUE_STATE IN ( 0, 2 ) |
||||
|
ORDER BY |
||||
|
expressAttitudeNum DESC |
||||
|
</select> |
||||
|
|
||||
|
<!-- 最新议题列表 --> |
||||
|
<select id="selectListLatestIssue" resultType="com.elink.esua.epdc.dto.issue.result.IssueResultDTO"> |
||||
|
SELECT |
||||
|
ei.ID, |
||||
|
ei.ISSUE_CONTENT, |
||||
|
ei.ALL_DEPT_NAMES, |
||||
|
ei.NICK_NAME, |
||||
|
ei.CREATED_TIME, |
||||
|
ee.APPROVE_NUM, |
||||
|
ee.OPPOSE_NUM, |
||||
|
ee.COMMENT_NUM, |
||||
|
ee.BROWSE_NUM, |
||||
|
( ee.COMMENT_NUM + ee.BROWSE_NUM + ee.APPROVE_NUM + ee.OPPOSE_NUM ) AS expressAttitudeNum |
||||
|
FROM |
||||
|
esua_epdc_events.epdc_issue ei |
||||
|
LEFT JOIN esua_epdc_events.epdc_events ee ON ee.ID = ei.EVENT_ID |
||||
|
AND ee.DEL_FLAG = '0' |
||||
|
<if test="issueContent != null and issueContent != ''"> |
||||
|
AND ei.ISSUE_CONTENT LIKE CONCAT('%',#{issueContent},'%') |
||||
|
</if> |
||||
|
<if test="streetId != null and streetId != ''"> |
||||
|
AND (find_in_set(#{streetId},ei.PARENT_DEPT_IDS) |
||||
|
OR find_in_set(#{streetId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="communityId != null and communityId != ''"> |
||||
|
AND (find_in_set(#{communityId},ei.PARENT_DEPT_IDS) |
||||
|
OR find_in_set(#{communityId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="gridId != null and gridId != ''"> |
||||
|
AND (ei.GRID_ID = #{gridId} |
||||
|
OR find_in_set(#{gridId},ei.ALL_DEPT_IDS)) |
||||
|
</if> |
||||
|
<if test="startTime != null and startTime != ''"> |
||||
|
and DATE_FORMAT( ei.CREATED_TIME, '%Y-%m-%d' ) >=#{startTime} |
||||
|
</if> |
||||
|
<if test="endTime != null and endTime != ''"> |
||||
|
and DATE_FORMAT( ei.CREATED_TIME, '%Y-%m-%d' ) <=#{endTime} |
||||
|
</if> |
||||
|
<if test="deptIdList!=null and deptIdList.size()>0"> |
||||
|
and ei.GRID_ID in |
||||
|
<foreach collection="deptIdList" index="index" item="deptId" open="(" separator="," close=")"> |
||||
|
#{deptId} |
||||
|
</foreach> |
||||
|
</if> |
||||
|
WHERE |
||||
|
ei.DEL_FLAG = '0' |
||||
|
AND ei.ISSUE_STATE IN ( 0, 2 ) |
||||
|
ORDER BY |
||||
|
expressAttitudeNum DESC,CREATED_TIME desc |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue