mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 20:49:00 +08:00
♻️ Refactoring code. 使用openapi3 替代swagger2
This commit is contained in:
1 parent
032c1b54d3
commit
eb3387da9f
165 files changed
+1188
-1635
No files matched your search
+2
-2
@@ -20,7 +20,7 @@ package com.pig4cloud.pigx.codegen;
|
||||
import com.pig4cloud.pigx.common.datasource.annotation.EnableDynamicDataSource;
|
||||
import com.pig4cloud.pigx.common.feign.annotation.EnablePigxFeignClients;
|
||||
import com.pig4cloud.pigx.common.security.annotation.EnablePigxResourceServer;
|
||||
import com.pig4cloud.pigx.common.swagger.annotation.EnablePigxSwagger2;
|
||||
import com.pig4cloud.pigx.common.swagger.annotation.EnableOpenApi;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
@@ -30,7 +30,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
* @date 2018/07/29 代码生成模块
|
||||
*/
|
||||
@EnableDynamicDataSource
|
||||
@EnablePigxSwagger2
|
||||
@EnableOpenApi("gen")
|
||||
@EnablePigxFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@EnablePigxResourceServer
|
||||
|
||||
+5
-2
@@ -5,8 +5,10 @@ import com.pig4cloud.pigx.codegen.service.GenDynamicService;
|
||||
import com.pig4cloud.pigx.codegen.util.SqlDto;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -22,7 +24,8 @@ import java.util.List;
|
||||
@Inner(value = false)
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/dynamic")
|
||||
@Api(value = "dynamic", tags = "无代码管理")
|
||||
@Tag(description = "dynamic", name = "无代码管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class GenDynamicController {
|
||||
|
||||
private final GenDynamicService dynamicService;
|
||||
|
||||
+12
-9
@@ -25,9 +25,11 @@ import com.pig4cloud.pigx.codegen.service.GenFormConfService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pigx.common.security.annotation.Inner;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -40,7 +42,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/form")
|
||||
@Api(value = "form", tags = "表单管理")
|
||||
@Tag(description = "form", name = "表单管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class GenFormConfController {
|
||||
|
||||
private final GenFormConfService genRecordService;
|
||||
@@ -51,7 +54,7 @@ public class GenFormConfController {
|
||||
* @param formConf 生成记录
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
public R getGenFormConfPage(Page page, GenFormConf formConf) {
|
||||
return R.ok(genRecordService.page(page, Wrappers.query(formConf)));
|
||||
@@ -62,7 +65,7 @@ public class GenFormConfController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(genRecordService.getById(id));
|
||||
@@ -74,7 +77,7 @@ public class GenFormConfController {
|
||||
* @param tableName tableName
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过tableName查询表单信息")
|
||||
@Operation(summary = "通过tableName查询表单信息")
|
||||
@Inner(value = false)
|
||||
@GetMapping("/info")
|
||||
public R form(String dsName, String tableName) {
|
||||
@@ -86,7 +89,7 @@ public class GenFormConfController {
|
||||
* @param formConf 生成记录
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增生成记录", notes = "新增生成记录")
|
||||
@Operation(summary = "新增生成记录", description = "新增生成记录")
|
||||
@SysLog("新增生成记录")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('gen_form_add')")
|
||||
@@ -100,7 +103,7 @@ public class GenFormConfController {
|
||||
* @param formConf 生成记录
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改生成记录", notes = "修改生成记录")
|
||||
@Operation(summary = "修改生成记录", description = "修改生成记录")
|
||||
@SysLog("修改生成记录")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('gen_form_edit')")
|
||||
@@ -113,7 +116,7 @@ public class GenFormConfController {
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除生成记录", notes = "通过id删除生成记录")
|
||||
@Operation(summary = "通过id删除生成记录", description = "通过id删除生成记录")
|
||||
@SysLog("通过id删除生成记录")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('gen_form_del')")
|
||||
|
||||
+6
-7
@@ -19,8 +19,7 @@ package com.pig4cloud.pigx.codegen.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -35,7 +34,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@TableName("gen_form_conf")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "生成记录")
|
||||
@Schema(description = "生成记录")
|
||||
public class GenFormConf extends Model<GenFormConf> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -44,19 +43,19 @@ public class GenFormConf extends Model<GenFormConf> {
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
@Schema(description = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 表名称
|
||||
*/
|
||||
@ApiModelProperty(value = "表名称")
|
||||
@Schema(description = "表名称")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 表单信息
|
||||
*/
|
||||
@ApiModelProperty(value = "表单信息")
|
||||
@Schema(description = "表单信息")
|
||||
private String formInfo;
|
||||
|
||||
/**
|
||||
@@ -81,7 +80,7 @@ public class GenFormConf extends Model<GenFormConf> {
|
||||
/**
|
||||
* 所属租户
|
||||
*/
|
||||
@ApiModelProperty(value = "所属租户", hidden = true)
|
||||
@Schema(description = "所属租户", hidden = true)
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
@@ -41,7 +41,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/${pathName}" )
|
||||
@Api(value = "${pathName}", tags = "${comments}管理")
|
||||
@Tag(description = "${pathName}", name = "${comments}管理")
|
||||
public class ${className}Controller {
|
||||
|
||||
private final ${className}Service ${classname}Service;
|
||||
@@ -52,7 +52,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "分页查询")
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_view')" )
|
||||
public R get${className}Page(Page page, ${className} ${classname}) {
|
||||
@@ -65,7 +65,7 @@ public class ${className}Controller {
|
||||
* @param ${pk.lowerAttrName} id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id查询", notes = "通过id查询")
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{${pk.lowerAttrName}}" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_view')" )
|
||||
public R getById(@PathVariable("${pk.lowerAttrName}" ) ${pk.attrType} ${pk.lowerAttrName}) {
|
||||
@@ -77,7 +77,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "新增${comments}", notes = "新增${comments}")
|
||||
@Operation(summary = "新增${comments}", description = "新增${comments}")
|
||||
@SysLog("新增${comments}" )
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_add')" )
|
||||
@@ -90,7 +90,7 @@ public class ${className}Controller {
|
||||
* @param ${classname} ${comments}
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "修改${comments}", notes = "修改${comments}")
|
||||
@Operation(summary = "修改${comments}", description = "修改${comments}")
|
||||
@SysLog("修改${comments}" )
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_edit')" )
|
||||
@@ -103,7 +103,7 @@ public class ${className}Controller {
|
||||
* @param ${pk.lowerAttrName} id
|
||||
* @return R
|
||||
*/
|
||||
@ApiOperation(value = "通过id删除${comments}", notes = "通过id删除${comments}")
|
||||
@Operation(summary = "通过id删除${comments}", description = "通过id删除${comments}")
|
||||
@SysLog("通过id删除${comments}" )
|
||||
@DeleteMapping("/{${pk.lowerAttrName}}" )
|
||||
@PreAuthorize("@pms.hasPermission('${moduleName}_${pathName}_del')" )
|
||||
|
||||
@@ -41,7 +41,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "${comments}")
|
||||
@Schema(description = "${comments}")
|
||||
public class ${className} extends Model<${className}> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -53,7 +53,7 @@ public class ${className} extends Model<${className}> {
|
||||
#if($column.columnName == $pk.columnName)
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
#end
|
||||
@ApiModelProperty(value="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
@Schema(value="$column.comments"#if($column.hidden),hidden=$column.hidden#end)
|
||||
private $column.attrType $column.lowerAttrName;
|
||||
|
||||
#end
|
||||
|
||||
Reference in new issue
Block a user