From 12d120b1c802833a0122105f82cdad3df16c7dc3 Mon Sep 17 00:00:00 2001 From: ly19960718 <1622779752@qq.com> Date: Fri, 11 Jun 2021 09:56:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E7=AB=A0=E6=95=B0=E6=8D=AE=E5=B0=81?= =?UTF-8?q?=E8=A3=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentDataBaseController.java | 39 ++++++++++++++++++- .../DepartmentBaseController.java | 6 +++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/tenlion/twoduty/controller/api/contentdatabase/ContentDataBaseController.java b/src/main/java/com/tenlion/twoduty/controller/api/contentdatabase/ContentDataBaseController.java index a9987d9..2355c8f 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/contentdatabase/ContentDataBaseController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/contentdatabase/ContentDataBaseController.java @@ -4,11 +4,21 @@ package com.tenlion.twoduty.controller.api.contentdatabase; import ink.wgink.common.base.DefaultBaseController; import ink.wgink.common.component.SecurityComponent; import ink.wgink.interfaces.consts.ISystemConstant; -import io.swagger.annotations.Api; +import ink.wgink.module.article.pojo.dtos.content.ContentDTO; +import ink.wgink.module.article.service.content.IContentService; +import ink.wgink.pojo.ListPage; +import ink.wgink.pojo.result.ErrorResult; +import ink.wgink.pojo.result.SuccessResultList; +import ink.wgink.service.department.service.IDepartmentUserService; +import io.swagger.annotations.*; 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.RestController; +import java.util.List; +import java.util.Map; + /** * 文章数据封装 * @author liuyang @@ -24,10 +34,37 @@ public class ContentDataBaseController extends DefaultBaseController { @Autowired protected SecurityComponent securityComponent; + @Autowired + private IContentService contentService; + @Autowired + private IDepartmentUserService departmentUserService; + + private final String CATEGORYID = "9c74d8a7-2686-45fc-a77f-a3ce1ffd8cfe"; + @ApiOperation(value = "组织文章内容分页列表", notes = "组织文章内容分页列表接口") + @ApiImplicitParams({ + @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), + @ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"), + @ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String"), + @ApiImplicitParam(name = "departmentId", value = "部门ID", paramType = "query", dataType = "String") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("list-page-department") + public SuccessResultList> listPageDepartment(ListPage page){ + Map params = requestParams(); + page.setParams(params); + String departmentId = params.get("departmentId").toString(); + List userids = departmentUserService.listUserId(departmentId); + SuccessResultList> listSuccessResultList = contentService.listPageByUserIds(CATEGORYID,userids,page); + return listSuccessResultList; + } + + diff --git a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java index 5a70da6..b946b7a 100644 --- a/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java +++ b/src/main/java/com/tenlion/twoduty/controller/api/departmentbase/DepartmentBaseController.java @@ -126,6 +126,9 @@ public class DepartmentBaseController extends DefaultBaseController { } List listUsers = roleUserService.listUserId(roleDTO.getRoleId()); List userIds = departmentUserService.listUserId(departmentId, listUsers); + if(userIds.size() == 0){ + return list; + } list = userService.listByUserIds(userIds); for (UserDTO userDTO : list) { this.setUserParams(userDTO); @@ -141,6 +144,9 @@ public class DepartmentBaseController extends DefaultBaseController { public List listUser(@PathVariable("departmentId") String departmentId){ List list = new ArrayList<>(); List userIds = departmentUserService.listUserId(departmentId); + if(userIds.size() == 0){ + return list; + } list = userService.listByUserIds(userIds); for (UserDTO userDTO : list) { this.setUserParams(userDTO);