对齐 boot 与 cloud 的代码
This commit is contained in:
@@ -7,6 +7,8 @@ import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataGetBySqlReqVO;
|
||||
import cn.iocoder.yudao.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
|
||||
import cn.iocoder.yudao.module.report.service.goview.GoViewDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -16,13 +18,12 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
//@Tag(name = "管理后台 - GoView 数据", description = "提供 SQL、HTTP 等数据查询的能力")
|
||||
@Tag(name = "管理后台 - GoView 数据", description = "提供 SQL、HTTP 等数据查询的能力")
|
||||
@RestController
|
||||
@RequestMapping("/report/go-view/data")
|
||||
@Validated
|
||||
@@ -32,7 +33,7 @@ public class GoViewDataController {
|
||||
private GoViewDataService goViewDataService;
|
||||
|
||||
@RequestMapping("/get-by-sql")
|
||||
// @Operation(summary = "使用 SQL 查询数据")
|
||||
@Operation(summary = "使用 SQL 查询数据")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-sql')")
|
||||
@OperateLog(enable = false) // 不记录操作日志,因为不需要
|
||||
public CommonResult<GoViewDataRespVO> getDataBySQL(@Valid @RequestBody GoViewDataGetBySqlReqVO reqVO) {
|
||||
@@ -40,7 +41,7 @@ public class GoViewDataController {
|
||||
}
|
||||
|
||||
@RequestMapping("/get-by-http")
|
||||
// @Operation(summary = "使用 HTTP 查询数据", description = "这个只是示例接口,实际应该每个查询,都要写一个接口")
|
||||
@Operation(summary = "使用 HTTP 查询数据", description = "这个只是示例接口,实际应该每个查询,都要写一个接口")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-http')")
|
||||
@OperateLog(enable = false) // 不记录操作日志,因为不需要
|
||||
public CommonResult<GoViewDataRespVO> getDataByHttp(
|
||||
|
||||
@@ -9,6 +9,9 @@ import cn.iocoder.yudao.module.report.controller.admin.goview.vo.project.GoViewP
|
||||
import cn.iocoder.yudao.module.report.convert.goview.GoViewProjectConvert;
|
||||
import cn.iocoder.yudao.module.report.dal.dataobject.goview.GoViewProjectDO;
|
||||
import cn.iocoder.yudao.module.report.service.goview.GoViewProjectService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -19,7 +22,7 @@ import javax.validation.Valid;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
//@Tag(name = "管理后台 - GoView 项目")
|
||||
@Tag(name = "管理后台 - GoView 项目")
|
||||
@RestController
|
||||
@RequestMapping("/report/go-view/project")
|
||||
@Validated
|
||||
@@ -29,14 +32,14 @@ public class GoViewProjectController {
|
||||
private GoViewProjectService goViewProjectService;
|
||||
|
||||
@PostMapping("/create")
|
||||
// @Operation(summary = "创建项目")
|
||||
@Operation(summary = "创建项目")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:create')")
|
||||
public CommonResult<Long> createProject(@Valid @RequestBody GoViewProjectCreateReqVO createReqVO) {
|
||||
return success(goViewProjectService.createProject(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
// @Operation(summary = "更新项目")
|
||||
@Operation(summary = "更新项目")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:update')")
|
||||
public CommonResult<Boolean> updateProject(@Valid @RequestBody GoViewProjectUpdateReqVO updateReqVO) {
|
||||
goViewProjectService.updateProject(updateReqVO);
|
||||
@@ -44,8 +47,8 @@ public class GoViewProjectController {
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
// @Operation(summary = "删除 GoView 项目")
|
||||
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@Operation(summary = "删除 GoView 项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:delete')")
|
||||
public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) {
|
||||
goViewProjectService.deleteProject(id);
|
||||
@@ -53,8 +56,8 @@ public class GoViewProjectController {
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
// @Operation(summary = "获得项目")
|
||||
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@Operation(summary = "获得项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
|
||||
public CommonResult<GoViewProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||
GoViewProjectDO project = goViewProjectService.getProject(id);
|
||||
@@ -62,7 +65,7 @@ public class GoViewProjectController {
|
||||
}
|
||||
|
||||
@GetMapping("/my-page")
|
||||
// @Operation(summary = "获得我的项目分页")
|
||||
@Operation(summary = "获得我的项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
|
||||
public CommonResult<PageResult<GoViewProjectRespVO>> getMyProjectPage(@Valid PageParam pageVO) {
|
||||
PageResult<GoViewProjectDO> pageResult = goViewProjectService.getMyProjectPage(
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package cn.iocoder.yudao.module.report.controller.admin.goview.vo.data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
//@Schema(description = "管理后台 - GoView 使用 SQL 查询数据 Request VO")
|
||||
@Schema(description = "管理后台 - GoView 使用 SQL 查询数据 Request VO")
|
||||
@Data
|
||||
public class GoViewDataGetBySqlReqVO {
|
||||
|
||||
// @Schema(description = "SQL 语句", requiredMode = Schema.RequiredMode.REQUIRED, example = "SELECT * FROM user")
|
||||
@Schema(description = "SQL 语句", requiredMode = Schema.RequiredMode.REQUIRED, example = "SELECT * FROM user")
|
||||
@NotEmpty(message = "SQL 语句不能为空")
|
||||
private String sql;
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package cn.iocoder.yudao.module.report.controller.admin.goview.vo.data;
|
||||
|
||||
//import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
//@Schema(description = "管理后台 - GoView 数据 Response VO")
|
||||
@Schema(description = "管理后台 - GoView 数据 Response VO")
|
||||
@Data
|
||||
public class GoViewDataRespVO {
|
||||
|
||||
// @Schema(description = "数据维度", requiredMode = Schema.RequiredMode.REQUIRED, example = "['product', 'data1', 'data2']")
|
||||
@Schema(description = "数据维度", requiredMode = Schema.RequiredMode.REQUIRED, example = "['product', 'data1', 'data2']")
|
||||
private List<String> dimensions;
|
||||
|
||||
// @Schema(description = "数据明细列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "数据明细列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<Map<String, Object>> source;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
//@Schema(description = "管理后台 - GoView 项目创建 Request VO")
|
||||
@Schema(description = "管理后台 - GoView 项目创建 Request VO")
|
||||
@Data
|
||||
public class GoViewProjectCreateReqVO {
|
||||
|
||||
// @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@NotEmpty(message = "项目名称不能为空")
|
||||
private String name;
|
||||
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
//@Schema(description = "管理后台 - GoView 项目 Response VO")
|
||||
@Schema(description = "管理后台 - GoView 项目 Response VO")
|
||||
@Data
|
||||
public class GoViewProjectRespVO {
|
||||
|
||||
// @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18993")
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18993")
|
||||
private Long id;
|
||||
|
||||
// @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String name;
|
||||
|
||||
// @Schema(description = "发布状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@Schema(description = "发布状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Integer status;
|
||||
|
||||
// @Schema(description = "报表内容") // JSON 格式
|
||||
@Schema(description = "报表内容") // JSON 格式
|
||||
private String content;
|
||||
|
||||
// @Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
|
||||
@Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
|
||||
private String picUrl;
|
||||
|
||||
// @Schema(description = "项目备注", example = "你猜")
|
||||
@Schema(description = "项目备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
// @Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
@Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||
private String creator;
|
||||
|
||||
// @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,32 +2,33 @@ package cn.iocoder.yudao.module.report.controller.admin.goview.vo.project;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
//@Schema(description = "管理后台 - GoView 项目更新 Request VO")
|
||||
@Schema(description = "管理后台 - GoView 项目更新 Request VO")
|
||||
@Data
|
||||
public class GoViewProjectUpdateReqVO {
|
||||
|
||||
// @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18993")
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18993")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
// @Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String name;
|
||||
|
||||
// @Schema(description = "发布状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@Schema(description = "发布状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "发布状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
// @Schema(description = "报表内容") // JSON 格式
|
||||
@Schema(description = "报表内容") // JSON 格式
|
||||
private String content;
|
||||
|
||||
// @Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
|
||||
@Schema(description = "预览图片 URL", example = "https://www.iocoder.cn")
|
||||
private String picUrl;
|
||||
|
||||
// @Schema(description = "项目备注", example = "你猜")
|
||||
@Schema(description = "项目备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user