All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.ape9527.core.controller.SysDeptController Maven / Gradle / Ivy

The newest version!
package com.ape9527.core.controller;

import com.ape9527.auth.annotation.LoginAuth;
import com.ape9527.auth.entity.SysDept;
import com.ape9527.auth.service.SysDeptService;
import com.ape9527.core.model.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 系统部门 控制层
 *
 * @author YuanShuai[[email protected]]
 */
@Api(tags = "SysDeptController", description = "系统部门控制层")
@RestController
@RequestMapping("/api/sys/dept")
public class SysDeptController extends BaseController {

    private final SysDeptService sysDeptService;

    public SysDeptController(SysDeptService sysDeptService){
        this.sysDeptService = sysDeptService;
    }

    @ApiOperation("查询部门列表")
    @GetMapping("/list")
    @LoginAuth
    public AjaxResult deptList() {
        return AjaxResult.success(sysDeptService.queryDeptList());
    }

    @ApiOperation("查询部门树")
    @GetMapping("/tree")
    @LoginAuth
    public AjaxResult deptTree() {
        return AjaxResult.success(sysDeptService.queryDeptTree());
    }

    @ApiOperation("查询单个部门")
    @GetMapping("/{uuid}")
    @LoginAuth
    public AjaxResult deptOne(@PathVariable("uuid") String uuid) {
        return AjaxResult.success(sysDeptService.queryById(uuid));
    }

    @ApiOperation("保存部门")
    @PostMapping("/save")
    @LoginAuth
    public AjaxResult deptSave(@RequestBody SysDept sysDept) {
        return sysDeptService.save(sysDept)==1?AjaxResult.success():AjaxResult.error("保存失败!");
    }

    @ApiOperation("删除部门")
    @PostMapping("/del")
    @LoginAuth
    public AjaxResult menuDel(@RequestBody SysDept sysDept) {
        return sysDeptService.del(sysDept.getUuid())==1?AjaxResult.success():AjaxResult.error("删除失败!");
    }



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy