DepartmentDictController.java 3.02 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.department.GetDepartmentMembersDTO;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.service.DepartmentDictService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

/**
 * <p>
 * 部门字典表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2024-01-11
 */
@RestController
@Api(tags = "部门字典表")
@RequestMapping("/departmentDict")
public class DepartmentDictController {


    @Autowired
    private DepartmentDictService departmentDictService;

    @PostMapping("getDepartments")
    @ApiOperation("获取所有部门  companyId 企业id")
    @LoginRequired
    public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO));
    }

    @PostMapping("addDepartment")
    @ApiOperation("添加部门 companyId  departmentName leaderName parentId 父节点")
    @LoginRequired
    public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO));
    }

    @PostMapping("deleteDepartment")
    @ApiOperation("删除部门  id")
    @LoginRequired
    public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO));
    }

    @PostMapping("updateDepartment")
    @ApiOperation("编辑部门  id  companyId fullName departmentName leaderName parentId")
    @LoginRequired
    public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO));
    }

    @PostMapping("getDepartmentMembers")
    @ApiOperation("获取部门成员  companyId 公司id  departmentId  部门id  userName startDate  endDate")
    @LoginRequired
    public ResponseVO getDepartmentMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartmentMembers(getDepartmentMembersDTO));
    }

    @PostMapping("getMembers")
    @ApiOperation("获取成员(树) companyId 公司id  startDate endDate ")
//    @LoginRequired
    public ResponseVO getMembers(@RequestBody GetDepartmentMembersDTO getDepartmentMembersDTO){
        return ResponseData.generateCreatedResponse(0,departmentDictService.getMembers(getDepartmentMembersDTO));
    }


}