12 changed files with 311 additions and 13 deletions
@ -0,0 +1,88 @@ |
|||
package com.elink.esua.epdc.dto.item.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Description 项目列表DTO |
|||
* @Author yinzuomei |
|||
* @Date 2020/2/10 13:44 |
|||
*/ |
|||
@Data |
|||
public class ItemResultDTO implements Serializable { |
|||
/** |
|||
* epdc_item表主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 议题内容-项目摘要 |
|||
*/ |
|||
private String itemContent; |
|||
|
|||
/** |
|||
* 父所有部门ID |
|||
*/ |
|||
private String parentDeptIds; |
|||
|
|||
/** |
|||
* 父所有部门 |
|||
*/ |
|||
private String parentDeptNames; |
|||
|
|||
/** |
|||
* 所有部门ID |
|||
*/ |
|||
private String allDeptIds; |
|||
|
|||
/** |
|||
* 所有部门 |
|||
*/ |
|||
private String allDeptNames; |
|||
|
|||
/** |
|||
* 网格 |
|||
*/ |
|||
private String grid; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private Long gridId; |
|||
|
|||
/** |
|||
* 发布人用户昵称 |
|||
*/ |
|||
private String nickName; |
|||
/** |
|||
* 发布时间 |
|||
*/ |
|||
private Date releaseTime; |
|||
|
|||
/** |
|||
* 支持-点赞次数 |
|||
*/ |
|||
private Integer approveNum; |
|||
|
|||
/** |
|||
* 反对-踩次数 |
|||
*/ |
|||
private Integer opposeNum; |
|||
|
|||
/** |
|||
* 评论数 |
|||
*/ |
|||
private Integer commentNum; |
|||
|
|||
/** |
|||
* 浏览数 |
|||
*/ |
|||
private Integer browseNum; |
|||
|
|||
/** |
|||
* 表达态度(评论+回复+浏览) |
|||
*/ |
|||
private Integer expressAttitudeNum; |
|||
} |
@ -0,0 +1,59 @@ |
|||
/** |
|||
* 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.item.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.item.result.ItemResultDTO; |
|||
import com.elink.esua.epdc.modules.item.service.ItemService; |
|||
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 yujintao yujintao@elink-cn.com |
|||
* @since v1.0.0 2019-09-04 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("item") |
|||
public class ItemController { |
|||
|
|||
@Autowired |
|||
private ItemService itemService; |
|||
|
|||
/** |
|||
* @param params |
|||
* @return com.elink.esua.epdc.dto.item.result.ItemResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 最热项目列表查询 |
|||
* @Date 2020/2/10 13:45 |
|||
**/ |
|||
@GetMapping("pageHottestItem") |
|||
public Result<PageData<ItemResultDTO>> pageHottestItem(@RequestParam Map<String, Object> params) { |
|||
PageData<ItemResultDTO> page = itemService.listItemResultDTO(params); |
|||
return new Result<PageData<ItemResultDTO>>().ok(page); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
/** |
|||
* 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.item.dao; |
|||
|
|||
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; |
|||
import com.elink.esua.epdc.dto.item.result.ItemResultDTO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description 项目模块 |
|||
* @Author yinzuomei |
|||
* @Date 2020/2/10 13:43 |
|||
*/ |
|||
@Mapper |
|||
public interface ItemDao extends BaseDao<ItemResultDTO> { |
|||
/** |
|||
* @param params |
|||
* @return java.util.List<com.elink.esua.epdc.dto.item.result.ItemResultDTO> |
|||
* @Author yinzuomei |
|||
* @Description 最热项目列表查询 |
|||
* @Date 2020/2/10 13:53 |
|||
**/ |
|||
List<ItemResultDTO> selectListHottestItemResultDTO(Map<String, Object> params); |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.elink.esua.epdc.modules.item.service; |
|||
|
|||
import com.elink.esua.epdc.commons.tools.page.PageData; |
|||
import com.elink.esua.epdc.dto.item.result.ItemResultDTO; |
|||
|
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 项目模块 |
|||
* |
|||
* @Author yinzuomei |
|||
* @Date 2020/2/10 13:43 |
|||
*/ |
|||
public interface ItemService { |
|||
|
|||
/** |
|||
* @param params |
|||
* @return com.elink.esua.epdc.dto.item.result.ItemResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 最热项目列表查询 |
|||
* @Date 2020/2/10 13:46 |
|||
**/ |
|||
PageData<ItemResultDTO> listItemResultDTO(Map<String, Object> params); |
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.elink.esua.epdc.modules.item.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.item.result.ItemResultDTO; |
|||
import com.elink.esua.epdc.modules.item.dao.ItemDao; |
|||
import com.elink.esua.epdc.modules.item.service.ItemService; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* @Description 项目模块 |
|||
* @Author yinzuomei |
|||
* @Date 2020/2/10 13:43 |
|||
*/ |
|||
@Service |
|||
public class ItemServiceImpl extends BaseServiceImpl<ItemDao, ItemResultDTO> implements ItemService { |
|||
/** |
|||
* @param params |
|||
* @return com.elink.esua.epdc.dto.item.result.ItemResultDTO |
|||
* @Author yinzuomei |
|||
* @Description 最热项目列表查询 |
|||
* @Date 2020/2/10 13:47 |
|||
**/ |
|||
@DataSource(name = DataSourceNames.FOURTH) |
|||
@Override |
|||
public PageData<ItemResultDTO> listItemResultDTO(Map<String, Object> params) { |
|||
IPage<ItemResultDTO> page = getPage(params); |
|||
List<ItemResultDTO> list = baseDao.selectListHottestItemResultDTO(params); |
|||
return new PageData<>(list, page.getTotal()); |
|||
} |
|||
} |
@ -0,0 +1,51 @@ |
|||
<?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.item.dao.ItemDao"> |
|||
<select id="selectListHottestItemResultDTO" resultType="com.elink.esua.epdc.dto.item.result.ItemResultDTO"> |
|||
SELECT |
|||
ei.id, |
|||
ei.ITEM_CONTENT, |
|||
ei.PARENT_DEPT_IDS, |
|||
ei.PARENT_DEPT_NAMES, |
|||
ei.ALL_DEPT_IDS, |
|||
ei.ALL_DEPT_NAMES, |
|||
ei.GRID_ID, |
|||
ei.GRID, |
|||
ei.NICK_NAME, |
|||
ei.CREATED_TIME AS releaseTime, |
|||
ee.APPROVE_NUM, |
|||
ee.OPPOSE_NUM, |
|||
ee.COMMENT_NUM, |
|||
ee.BROWSE_NUM, |
|||
(ee.APPROVE_NUM + ee.OPPOSE_NUM + ee.COMMENT_NUM + ee.BROWSE_NUM ) AS expressAttitudeNum |
|||
FROM |
|||
epdc_item ei |
|||
LEFT JOIN epdc_events ee ON ( ei.EVENT_ID = ee.ID ) |
|||
WHERE |
|||
ei.DEL_FLAG = '0' |
|||
AND ee.DEL_FLAG = '0' |
|||
<if test='searchContent != null and searchContent != ""'> |
|||
AND ei.ITEM_CONTENT LIKE CONCAT('%',#{searchContent},'%') |
|||
</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> |
|||
ORDER BY expressAttitudeNum DESC |
|||
</select> |
|||
</mapper> |
Loading…
Reference in new issue