CompanyDictController.java 2.96 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.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.service.CompanyDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
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;

/**
 * <p>
 * 企业字典表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-10-25
 */
@RestController
@Api(tags = "企业字典表")
@RequestMapping("/companyDict")
public class CompanyDictController {

    @Autowired
    private CompanyDictService companyDictService;

    @PostMapping("/administers")
    @ApiOperation("查询所有企业  {id companyName fieldId 行业id pageNum  pageSize }")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
        return ResponseData.generateCreatedResponse(0,companyDictService.operators(operatorsDTO));
    }

    @PostMapping("addCompany")
    @ApiOperation("添加企业  {accountName:账号 companyName:企业名称 address 企业所在地 shortName 简称 banner:标语 field[]:领域  role  1:超级管理员  2:普通成员}")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addOperator(@RequestBody AddCompanyDTO addCompanyDTO){
        return ResponseData.generateCreatedResponse(0,companyDictService.addOperator(addCompanyDTO));
    }

    @PostMapping("deleteCompany")
    @ApiOperation("删除企业  id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO deleteAdminister(@RequestBody  CompanyDictDO companyDictDO){
        return ResponseData.generateCreatedResponse(0,companyDictService.deleteAdminister(companyDictDO));
    }

    @PostMapping("updateCompany")
    @ApiOperation("修改企业  id accountName:账号 logo companyName:企业名称  address 企业所在地 shortName 简称  banner:标语 field[]:领域   role  1:超级管理员  2:普通成员")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateAdminister(@RequestBody  AddCompanyDTO addCompanyDTO){
        return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO));
    }

    @PostMapping("getAllCompany")
    @ApiOperation("获取全部企业  {companyName}")
    public ResponseVO  getAllCompany(@RequestBody CompanyDictDO companyDictDO){
        return ResponseData.generateCreatedResponse(0,companyDictService.getAllCompany(companyDictDO));
    }

}