刘力
3 years ago
7 changed files with 93 additions and 13 deletions
-
19system/src/main/java/com/canvas/web/modules/system/controller/MenuController.java
-
58system/src/main/java/com/canvas/web/modules/system/controller/OrgController.java
-
2system/src/main/java/com/canvas/web/modules/system/controller/RoleController.java
-
2system/src/main/java/com/canvas/web/modules/system/service/MenuService.java
-
5system/src/main/java/com/canvas/web/modules/system/service/OrgService.java
-
9system/src/main/java/com/canvas/web/modules/system/service/impl/MenuServiceImpl.java
-
11system/src/main/java/com/canvas/web/modules/system/service/impl/OrgServiceImpl.java
@ -0,0 +1,58 @@ |
|||
package com.canvas.web.modules.system.controller; |
|||
|
|||
|
|||
import com.canvas.web.base.BaseEntity; |
|||
import com.canvas.web.enums.ResponseEnum; |
|||
import com.canvas.web.exception.BaseException; |
|||
import com.canvas.web.modules.logging.annotation.Log; |
|||
import com.canvas.web.modules.system.domain.Org; |
|||
import com.canvas.web.modules.system.service.OrgService; |
|||
import com.canvas.web.modules.system.service.dto.OrgDto; |
|||
import com.canvas.web.modules.system.service.dto.OrgQueryCriteria; |
|||
import com.canvas.web.utils.Response; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@Api("机构管理") |
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@RequestMapping("/api/org/") |
|||
public class OrgController { |
|||
|
|||
private final OrgService orgService; |
|||
|
|||
|
|||
@Log("新增机构") |
|||
@ApiOperation("新增机构") |
|||
@PostMapping("create") |
|||
//@PreAuthorize("") :TODO:超级管理员权限设置 |
|||
public Response<Object> create(@Validated @RequestBody OrgDto orgDto){ |
|||
|
|||
if (orgDto.getId() !=null){ |
|||
throw new BaseException("新的机构不能包含id"); |
|||
} |
|||
orgService.create(orgDto); |
|||
return Response.success(ResponseEnum.CREATED); |
|||
} |
|||
|
|||
@ApiOperation("查询机构列表") |
|||
@GetMapping("list") |
|||
//@PreAuthorize("") TODO:超级管理员权限查询 |
|||
public Response<Object> queryList(OrgQueryCriteria criteria, Pageable pageable){ |
|||
return Response.success(orgService.queryAll(criteria,pageable)); |
|||
} |
|||
|
|||
@ApiOperation("修改机构") |
|||
@Log("修改机构") |
|||
@PostMapping("edit") |
|||
//@PreAuthorize("") //TODO:超级管理员权限修改 |
|||
public Response<Object> update(@Validated @RequestBody OrgDto orgDto){ |
|||
orgService.update(orgDto); |
|||
return Response.success(ResponseEnum.UPDATE_SUCCESS); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue