package com.gkhy.hazmat.admin.controller.system;
|
|
|
import com.gkhy.hazmat.common.annotation.RepeatSubmit;
|
import com.gkhy.hazmat.common.api.CommonResult;
|
import com.gkhy.hazmat.system.domain.SysDept;
|
import com.gkhy.hazmat.system.service.SysDeptService;
|
import io.swagger.annotations.Api;
|
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-08-05 14:41:40
|
*/
|
@Api(tags = "部门前端控制器")
|
@RestController
|
@RequestMapping("/system/dept")
|
public class SysDeptController {
|
@Autowired
|
private SysDeptService deptService;
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:system','hazmat:manage:company','hazmat:manage:common')")
|
@ApiOperation(value = "部门列表(树形结构)")
|
@GetMapping("/treeList")
|
public CommonResult list(SysDept dept){
|
return CommonResult.success(deptService.selectDeptTreeList(dept));
|
}
|
|
|
@RepeatSubmit
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company')")
|
@ApiOperation(value = "新增部门")
|
@PostMapping
|
public CommonResult add(@Validated @RequestBody SysDept dept){
|
return CommonResult.success(deptService.insertDept(dept));
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company')")
|
@RepeatSubmit
|
@ApiOperation(value = "编辑部门")
|
@PutMapping
|
public CommonResult edit(@Validated @RequestBody SysDept dept){
|
return CommonResult.success(deptService.updateDept(dept));
|
}
|
|
@PreAuthorize("hasAnyAuthority('hazmat:manage:company')")
|
@RepeatSubmit
|
@ApiOperation(value = "删除部门")
|
@PutMapping("/{deptId}")
|
public CommonResult delete(@PathVariable(value = "deptId" ,required = true)Long deptId){
|
return CommonResult.success(deptService.deleteDeptById(deptId));
|
}
|
}
|