package com.mh.user.controller; import com.mh.common.http.HttpResult; import com.mh.user.model.SysDept; import com.mh.user.service.SysDeptService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * 机构控制器 * @author ljf * @date 2020-04-25 */ @RestController @RequestMapping("dept") public class SysDeptController { @Autowired private SysDeptService sysDeptService; @PreAuthorize("hasAuthority('sys:dept:add') AND hasAuthority('sys:dept:edit')") @PostMapping(value="/save") public HttpResult save(@RequestBody SysDept record) { return HttpResult.ok(sysDeptService.save(record)); } @PreAuthorize("hasAuthority('sys:dept:delete')") @PostMapping(value="/delete") public HttpResult delete(@RequestBody List records) { return HttpResult.ok(sysDeptService.delete(records)); } @PreAuthorize("hasAuthority('sys:dept:view')") @GetMapping(value="/findTree") public HttpResult findTree() { return HttpResult.ok(sysDeptService.findTree()); } }