|
@@ -0,0 +1,49 @@
|
|
|
+package com.hfln.portal.application.controller.web;
|
|
|
+
|
|
|
+
|
|
|
+import cn.hfln.framework.catchlog.CatchAndLog;
|
|
|
+import cn.hfln.framework.dto.ApiResult;
|
|
|
+import com.hfln.portal.common.dto.data.role.RoleListDTO;
|
|
|
+import com.hfln.portal.common.request.web.AddRoleParam;
|
|
|
+import com.hfln.portal.domain.gateway.WebGateway;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@CatchAndLog
|
|
|
+@Tag(name = "web端角色相关")
|
|
|
+@Slf4j
|
|
|
+@RequestMapping("/web/role")
|
|
|
+public class WebRoleController {
|
|
|
+ @Autowired
|
|
|
+ private WebGateway webGateway;
|
|
|
+
|
|
|
+ @PostMapping("/add")
|
|
|
+ @Operation(summary = "新增角色")
|
|
|
+ public ApiResult<Void> addRole(@RequestBody @Valid AddRoleParam params) {
|
|
|
+
|
|
|
+ webGateway.addRole(params);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/delete")
|
|
|
+ @Operation(summary = "禁用角色")
|
|
|
+ public ApiResult<Void> deleteRole(@RequestParam Long roleId) {
|
|
|
+
|
|
|
+ webGateway.deleteRole(roleId);
|
|
|
+ return ApiResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/queryList")
|
|
|
+ @Operation(summary = "获取角色列表")
|
|
|
+ public ApiResult<List<RoleListDTO>> roleList() {
|
|
|
+ List<RoleListDTO> roleList = webGateway.roleList();
|
|
|
+ return ApiResult.success(roleList);
|
|
|
+ }
|
|
|
+}
|