1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- package com.fdkankan.fusion.controller;
- import cn.dev33.satoken.annotation.SaCheckPermission;
- import cn.hutool.core.util.ObjectUtil;
- import com.fdkankan.fusion.common.ResultData;
- import com.fdkankan.fusion.entity.TmDepartment;
- import com.fdkankan.fusion.service.ITmDepartmentService;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.CollectionUtils;
- import org.springframework.validation.annotation.Validated;
- import org.springframework.web.bind.annotation.*;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author
- * @since 2023-07-27
- */
- @RestController
- @RequestMapping("/web/department")
- public class TmDepartmentController {
- @Autowired
- private ITmDepartmentService departmentService;
- /**
- * 根据部门编号获取详细信息
- */
- @GetMapping(value = "deptId/{deptId}")
- public ResultData getInfo(@PathVariable String deptId)
- {
- return ResultData.ok(departmentService.getById(deptId));
- }
- /**
- * 获取部门下拉树列表
- */
- @GetMapping("/treeselect")
- public ResultData treeselect() {
- return ResultData.ok(departmentService.getDeptList());
- }
- /**
- * 新增部门
- */
- @PostMapping("/add")
- public ResultData add(@Validated @RequestBody TmDepartment dept) {
- departmentService.insertDept(dept);
- return ResultData.ok();
- }
- /**
- * 修改部门
- */
- @PostMapping("/edit")
- public ResultData edit(@Validated @RequestBody TmDepartment dept) {
- departmentService.updateDept(dept);
- return ResultData.ok();
- }
- /**
- * 删除部门
- */
- @PostMapping("/del/{deptId}")
- public ResultData remove(@PathVariable String deptId) {
- departmentService.deleteDeptById(deptId);
- return ResultData.ok();
- }
- }
|