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);