ToDoController.java 3.5 KB
package com.skua.modules.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.modules.system.service.ISysUserService;
import com.skua.modules.system.vo.ToDoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import springfox.documentation.annotations.ApiIgnore;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
* 待办事项
*/
@Slf4j
@Api(tags="待办事项")
@RestController
@ApiIgnore
@RequestMapping("/v1/system/todo")
public class ToDoController {

    @Autowired
    private ISysUserService sysUserService;

   /**
     * 待办事项
    * @param toDoVO
    * @param pageNo
    * @param pageSize
    * @param req
    * @return
    */
   @AutoLog(value = "待办事项分页列表")
   @ApiOperation(value="待办事项分页列表", notes="待办事项分页列表")
   @GetMapping(value = "/list")
   public Result<IPage<ToDoVO>> queryPageList(ToDoVO toDoVO,
                                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                                   HttpServletRequest req) {
       Result<IPage<ToDoVO>> result = new Result<IPage<ToDoVO>>();
       Page<ToDoVO> pageList = new Page<ToDoVO>(pageNo,pageSize);
       pageList = sysUserService.queryToDoPageList(pageList,toDoVO);//自定义查询
       result.setSuccess(true);
       result.setResult(pageList);
       return result;
   }

    @AutoLog(value = "待办事项分页列表")
    @ApiOperation(value="待办事项分页列表", notes="待办事项分页列表")
    @GetMapping(value = "/deskList")
    public Result<Map<String,Object>> queryDeskList(ToDoVO toDoVO,
                                               @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                               @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                               HttpServletRequest req) {
        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
        Map<String, Object> map = new HashMap<>();
        Map<String, Object> countMap = new HashMap<>();
        Page<ToDoVO> pageList = new Page<ToDoVO>(pageNo,pageSize);
        pageList = sysUserService.queryDeskList(pageList,toDoVO);//自定义查询
        countMap = sysUserService.dataCount(toDoVO);
        map.put("list",pageList);
        map.put("count",countMap);
        result.setSuccess(true);
        result.setResult(map);
        return result;
    }

    @AutoLog(value = "待办事项详细")
    @ApiOperation(value="待办事项详细", notes="待办事项详细")
    @GetMapping(value = "/getToDoInfo")
    public Result<Map<String,Object>> getToDoInfo(String reportId, String dataId, String toDoType){
        Result<Map<String,Object>> result = new Result<Map<String,Object>>();
        Map<String, Object> map = new HashMap<>();
        map = sysUserService.getToDoInfo(reportId, dataId, toDoType);
        result.setResult(map);
        result.setSuccess(true);
        return result;
    }

}