package com.ycl.controller.depart;
import com.ycl.api.CommonResult;
import com.ycl.entity.depart.SccgDepart;
import com.ycl.entity.user.UmsMenu;
import com.ycl.service.depart.SccgDepartService;
import com.ycl.service.user.UmsMenuService;
import com.ycl.vo.depart.DepartVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
*
* 部门表 前端控制器
*
*
* @author lyq
* @since 2022-09-07
*/
@RestController
@Api(tags = "部门管理模块")
@RequestMapping("/depart")
public class DepartController {
@Autowired
private SccgDepartService departService;
@ApiOperation("添加部门")
@PostMapping(value = "/create")
public CommonResult create(@Validated @RequestBody DepartVO.AddDepartVO addDepartVO) {
departService.create(addDepartVO);
return CommonResult.success(null);
}
@ApiOperation("删除")
@PostMapping(value = "/delete")
public CommonResult delete(@Validated @RequestBody DepartVO.IdDepartVO params) {
departService.delete(params.getId());
return CommonResult.success(null);
}
@ApiOperation("详情")
@PostMapping(value = "/detail")
public CommonResult detail(@Validated @RequestBody DepartVO.IdDepartVO params) {
SccgDepart sccgDepart = departService.loadDepartById(params.getId());
return CommonResult.success(sccgDepart);
}
@ApiOperation("树结构")
@GetMapping(value = "/tree")
public CommonResult> tree() {
List tree = departService.tree();
return CommonResult.success(tree);
}
@ApiOperation("修改部门状态")
@PostMapping(value = "/status")
public CommonResult status(@Validated @RequestBody DepartVO.StatusDepartVO params) {
departService.updateStatus(params);
return CommonResult.success(null);
}
}