package com.gkhy.hazmat.admin.controller.system;
|
|
|
import com.gkhy.hazmat.common.annotation.Anonymous;
|
import com.gkhy.hazmat.common.annotation.Log;
|
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
|
import com.gkhy.hazmat.common.api.CommonResult;
|
import com.gkhy.hazmat.common.enums.BusinessType;
|
import com.gkhy.hazmat.system.domain.SysCompany;
|
import com.gkhy.hazmat.system.service.SysCompanyService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* <p>
|
* 企业表 前端控制器
|
* </p>
|
*
|
* @author kzy
|
* @since 2024-06-05 08:43:11
|
*/
|
@Api(tags = "企业前端控制器")
|
@RestController
|
@RequestMapping("/system/company")
|
public class SysCompanyController {
|
@Autowired
|
private SysCompanyService companyService;
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@ApiOperation(value = "企业列表(分页)")
|
@ApiImplicitParams({
|
@ApiImplicitParam(paramType = "query", name = "pageNum", dataType = "int", required = false, value = "当前页,默认1"),
|
@ApiImplicitParam(paramType = "query", name = "pageSize", dataType = "int", required = false, value = "每页数目,默认10")
|
})
|
@GetMapping("/list")
|
public CommonResult list(SysCompany company){
|
return CommonResult.success(companyService.selectCompanyList(company));
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@ApiOperation(value = "根据公司id获取公司信息")
|
@GetMapping(value = { "/{companyId}" })
|
public CommonResult getCompanyInfo(@PathVariable(value = "companyId", required = true) Long companyId)
|
{
|
return CommonResult.success(companyService.selectCompanyById(companyId));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "企业管理", businessType = BusinessType.INSERT)
|
@ApiOperation(value = "新增企业")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody SysCompany company){
|
return CommonResult.success(companyService.insertCompany(company));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "企业管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "编辑企业")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody SysCompany company){
|
return CommonResult.success(companyService.updateCompany(company));
|
}
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@Log(title = "企业管理", businessType = BusinessType.UPDATE)
|
@ApiOperation(value = "删除企业")
|
@DeleteMapping(value = { "/{companyId}" })
|
public CommonResult delete(@PathVariable(value = "companyId", required = true) Long companyId){
|
return CommonResult.success(companyService.deleteCompanyById(companyId));
|
}
|
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
@ApiOperation(value = "校验公司名称是否唯一")
|
@PostMapping("/checkNameUnique")
|
public CommonResult checkNameUnique(@RequestBody SysCompany company)
|
{
|
return CommonResult.success(companyService.checkNameUnique(company));
|
}
|
|
|
@ApiOperation(value = "生成表测试")
|
@GetMapping("/createProductTables")
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system')")
|
public CommonResult createProductTables(Long companyId)
|
{
|
companyService.createProductTables(companyId);
|
return CommonResult.success();
|
}
|
|
}
|