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


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.service.DepartmentDictService;
import com.subsidy.util.ConstantUtils;
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 DengMin
 * @since 2021-10-11
 */
@RestController
@Api(tags = "部门字典表")
@RequestMapping("/departmentDict")
public class DepartmentDictController {

    @Autowired
    private DepartmentDictService departmentDictService;

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

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

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

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



}