Compare commits
No commits in common. "ad3c2bcaba4ad6bedf55e5d8eed70d728fcdf214" and "9e993b2b0415e2f0cd9153a47365a75ac509f1c8" have entirely different histories.
ad3c2bcaba
...
9e993b2b04
|
@ -7,7 +7,7 @@
|
|||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>generator-v1</artifactId>
|
||||
<artifactId>common-generator</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>common-utils</name>
|
||||
|
@ -18,34 +18,6 @@
|
|||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.bunny</groupId>
|
||||
<artifactId>dao</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
<!-- hutool -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql连接驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
|
@ -21,45 +21,45 @@ import java.util.List;
|
|||
* @author Bunny
|
||||
* @since ${date}
|
||||
*/
|
||||
@Tag(name = "${classTitle}" , description = "${classTitle}相关接口" )
|
||||
@Tag(name = "${classTitle}", description = "${classTitle}相关接口")
|
||||
@RestController
|
||||
@RequestMapping("admin/${lowercaseName}" )
|
||||
@RequestMapping("admin/${lowercaseName}")
|
||||
public class ${originalName}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${originalName}Service ${lowercaseName}Service;
|
||||
|
||||
@Operation(summary = "分页查询${classTitle}" , description = "分页查询${classTitle}" )
|
||||
@GetMapping("get${originalName}List/{page}/{limit}" )
|
||||
@Operation(summary = "分页查询${classTitle}", description = "分页查询${classTitle}")
|
||||
@GetMapping("get${originalName}List/{page}/{limit}")
|
||||
public Mono<Result<PageResult<${originalName}Vo>>> get${originalName}List(
|
||||
@Parameter(name = "page" , description = "当前页" , required = true)
|
||||
@PathVariable("page" ) Integer page,
|
||||
@Parameter(name = "limit" , description = "每页记录数" , required = true)
|
||||
@PathVariable("limit" ) Integer limit,
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page") Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit") Integer limit,
|
||||
${originalName}Dto dto) {
|
||||
Page<${originalName}> pageParams = new Page<>(page, limit);
|
||||
PageResult<${originalName}Vo> pageResult = ${lowercaseName}Service.get${originalName}List(pageParams, dto);
|
||||
return Mono.just(Result.success(pageResult));
|
||||
}
|
||||
|
||||
@Operation(summary = "添加${classTitle}" , description = "添加${classTitle}" )
|
||||
@PostMapping("add${originalName}" )
|
||||
@Operation(summary = "添加${classTitle}", description = "添加${classTitle}")
|
||||
@PostMapping("add${originalName}")
|
||||
public Mono<Result<String>> add${originalName}(@Valid @RequestBody ${originalName}AddDto dto) {
|
||||
${lowercaseName}Service.add${originalName}(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新${classTitle}" , description = "更新${classTitle}" )
|
||||
@PutMapping("update${originalName}" )
|
||||
@Operation(summary = "更新${classTitle}", description = "更新${classTitle}")
|
||||
@PutMapping("update${originalName}")
|
||||
public Mono<Result<String>> update${originalName}(@Valid @RequestBody ${originalName}UpdateDto dto) {
|
||||
${lowercaseName}Service.update${originalName}(dto);
|
||||
return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除${classTitle}" , description = "删除${classTitle}" )
|
||||
@DeleteMapping("delete${originalName}" )
|
||||
@Operation(summary = "删除${classTitle}", description = "删除${classTitle}")
|
||||
@DeleteMapping("delete${originalName}")
|
||||
public Mono<Result<String>> delete${originalName}(@RequestBody List<Long> ids) {
|
||||
${lowercaseName}Service.delete${originalName}(ids);
|
||||
return Mono.just(Result.success(ResultCodeEnum.DELETE_SUCCESS));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.bunny</groupId>
|
||||
<artifactId>auth-server-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>generator-code</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>generator-code</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.xerial</groupId>
|
||||
<artifactId>sqlite-jdbc</artifactId>
|
||||
<version>3.49.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.6.14</version>
|
||||
</dependency>
|
||||
<!-- fastjson2 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
|
@ -1,13 +0,0 @@
|
|||
package cn.bunny;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication
|
||||
public class GeneratorCodeMainApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GeneratorCodeMainApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package cn.bunny.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer;
|
||||
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 去除前端传递的空格
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class ControllerStringParamTrimConfig {
|
||||
|
||||
/**
|
||||
* 创建 String trim 编辑器
|
||||
* 构造方法中 boolean 参数含义为如果是空白字符串,是否转换为null
|
||||
* 即如果为true,那么 " " 会被转换为 null,否者为 ""
|
||||
*/
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder binder) {
|
||||
StringTrimmerEditor propertyEditor = new StringTrimmerEditor(false);
|
||||
// 为 String 类对象注册编辑器
|
||||
binder.registerCustomEditor(String.class, propertyEditor);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
|
||||
return jacksonObjectMapperBuilder -> {
|
||||
// 为 String 类型自定义反序列化操作
|
||||
jacksonObjectMapperBuilder
|
||||
.deserializerByType(String.class, new StdScalarDeserializer<String>(String.class) {
|
||||
@Override
|
||||
public String deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {
|
||||
// // 去除全部空格
|
||||
// return StringUtils.trimAllWhitespace(jsonParser.getValueAsString());
|
||||
|
||||
// 仅去除前后空格
|
||||
return jsonParser.getValueAsString().trim();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package cn.bunny.config;
|
||||
|
||||
import io.swagger.v3.oas.models.ExternalDocumentation;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.info.Contact;
|
||||
import io.swagger.v3.oas.models.info.Info;
|
||||
import io.swagger.v3.oas.models.info.License;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springdoc.core.models.GroupedOpenApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class Knife4jConfig {
|
||||
@Bean
|
||||
public OpenAPI openAPI() {
|
||||
// 作者等信息
|
||||
Contact contact = new Contact().name("Bunny" ).email("1319900154@qq.com" ).url("http://localhost:9999" );
|
||||
// 使用协议
|
||||
License license = new License().name("MIT" ).url("https://mit-license.org" );
|
||||
// 相关信息
|
||||
Info info = new Info().title("Bunny-Admin" )
|
||||
.contact(contact).license(license)
|
||||
.description("Bunny代码生成器" )
|
||||
.summary("Bunny的代码生成器" )
|
||||
.termsOfService("http://localhost:9999" )
|
||||
.version("v1.0.0" );
|
||||
|
||||
return new OpenAPI().info(info).externalDocs(new ExternalDocumentation());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi all() {
|
||||
return GroupedOpenApi.builder().group("全部请求接口" ).pathsToMatch("/api/**" ).build();
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package cn.bunny.config;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
@Component
|
||||
public class VmsHolder {
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
Properties prop = new Properties();
|
||||
prop.put("file.resource.loader.class" , "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader" );
|
||||
Velocity.init(prop);
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
@Controller
|
||||
public class IndexController {
|
||||
|
||||
@GetMapping("/")
|
||||
public String index() {
|
||||
return "index";
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.result.Result;
|
||||
import cn.bunny.dao.vo.TableInfoVo;
|
||||
import cn.bunny.service.TableService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "数据库表控制器" , description = "数据库表信息接口" )
|
||||
@RestController
|
||||
@RequestMapping("/api/table" )
|
||||
public class TableController {
|
||||
|
||||
private final TableService tableService;
|
||||
|
||||
public TableController(TableService tableService) {
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
@Operation(summary = "获取所有表" , description = "获取所有表" )
|
||||
@GetMapping("getAllTableMetaData" )
|
||||
public Result<List<TableInfoVo>> getAllTableMetaData() {
|
||||
List<TableInfoVo> list = tableService.getAllTableMetaData();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取表属性" , description = "获取表属性" )
|
||||
@GetMapping("getTableMetaData" )
|
||||
public Result<TableInfoVo> getTableMetaData(String tableName) {
|
||||
TableInfoVo tableMetaData = tableService.getTableMetaData(tableName);
|
||||
return Result.success(tableMetaData);
|
||||
}
|
||||
|
||||
@Operation(summary = "获取列属性" , description = "获取列属性" )
|
||||
@GetMapping("getColumnInfo" )
|
||||
public Result<List<ColumnMetaData>> getColumnInfo(String tableName) {
|
||||
List<ColumnMetaData> columnInfo = tableService.getColumnInfo(tableName);
|
||||
return Result.success(columnInfo);
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package cn.bunny.controller;
|
||||
|
||||
import cn.bunny.dao.dto.VmsArgumentDto;
|
||||
import cn.bunny.dao.result.Result;
|
||||
import cn.bunny.dao.vo.GeneratorVo;
|
||||
import cn.bunny.dao.vo.VmsPathVo;
|
||||
import cn.bunny.service.VmsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Tag(name = "生成器", description = "代码生成器接口")
|
||||
@RestController
|
||||
@RequestMapping("/api/vms")
|
||||
public class VmsController {
|
||||
|
||||
private final VmsService vmsService;
|
||||
|
||||
public VmsController(VmsService vmsService) {
|
||||
this.vmsService = vmsService;
|
||||
}
|
||||
|
||||
@Operation(summary = "获取vms文件路径", description = "获取所有vms下的文件路径")
|
||||
@GetMapping("getVmsPathList")
|
||||
public Result<Map<String, List<VmsPathVo>>> getVmsPathList() {
|
||||
Map<String, List<VmsPathVo>> list = vmsService.getVmsPathList();
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Operation(summary = "生成控制器", description = "生成控制器代码")
|
||||
@PostMapping("generator")
|
||||
public Result<List<GeneratorVo>> generator(@Valid @RequestBody VmsArgumentDto dto) {
|
||||
List<GeneratorVo> list = vmsService.generator(dto);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package cn.bunny.dao.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VmsArgumentDto {
|
||||
|
||||
/* 作者名称 */
|
||||
String author = "Bunny";
|
||||
|
||||
/* 包名称 */
|
||||
String packageName = "cn.bunny.services";
|
||||
|
||||
/* requestMapping 名称 */
|
||||
String requestMapping = "/api";
|
||||
|
||||
/* 类名称,格式为:xxx xxx_xxx */
|
||||
@NotBlank(message = "类名称不能为空")
|
||||
@NotNull(message = "类名称不能为空")
|
||||
@Pattern(regexp = "^(?:[a-z][a-z0-9_]*|[_a-z][a-z0-9_]*)$", message = "类名称不合法")
|
||||
private String className;
|
||||
|
||||
/* 表名称 */
|
||||
@NotBlank(message = "表名称不能为空")
|
||||
@NotNull(message = "表名称不能为空")
|
||||
@Pattern(regexp = "^(?:[a-z][a-z0-9_]*|[_a-z][a-z0-9_]*)$", message = "表名称不合法")
|
||||
private String tableName;
|
||||
|
||||
/* 时间格式 */
|
||||
private String simpleDateFormat = "yyyy-MM-dd HH:mm:ss";
|
||||
|
||||
/* 去除表前缀 */
|
||||
private String tablePrefixes = "t_,sys_,qrtz_,log_";
|
||||
|
||||
/* 路径 */
|
||||
private List<String> path;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package cn.bunny.dao.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ColumnMetaData {
|
||||
|
||||
/* 列名称 */
|
||||
private String columnName;
|
||||
|
||||
/* 字段名称 */
|
||||
private String fieldName;
|
||||
|
||||
/* 数据库字段类型 */
|
||||
private String jdbcType;
|
||||
|
||||
/* Java类型 */
|
||||
private String javaType;
|
||||
|
||||
/* Javascript类型 */
|
||||
private String javascriptType;
|
||||
|
||||
/* 是否为主键 */
|
||||
private Boolean isPrimaryKey;
|
||||
|
||||
/* 字段注释 */
|
||||
private String comment;
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package cn.bunny.dao.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TableMetaData {
|
||||
|
||||
/* 表目录 */
|
||||
private String tableCat;
|
||||
|
||||
/* 表模式(可能为null) */
|
||||
private String tableSchem;
|
||||
|
||||
/* 表类型(通常是"TABLE") */
|
||||
private String tableType;
|
||||
|
||||
/* 类型的目录(可能为null) */
|
||||
private String typeCat;
|
||||
|
||||
/* 类型的模式(可能为null) */
|
||||
private String typeSchem;
|
||||
|
||||
/* 类型名称(可能为null) */
|
||||
private String typeName;
|
||||
|
||||
/* 自引用列名(可能为null) */
|
||||
private String selfReferencingColName;
|
||||
|
||||
/* 引用生成(可能为null) */
|
||||
private String refGeneration;
|
||||
|
||||
/* 表名 */
|
||||
private String tableName;
|
||||
|
||||
/* 类名 */
|
||||
private String className;
|
||||
|
||||
/* 注释内容 */
|
||||
private String comment;
|
||||
|
||||
/* 列名称 */
|
||||
private List<ColumnMetaData> columns;
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package cn.bunny.dao.result;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 封装分页查询结果
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
@Schema(name = "PageResult 对象" , title = "分页返回结果" , description = "分页返回结果" )
|
||||
public class PageResult<T> implements Serializable {
|
||||
|
||||
@Schema(name = "pageNo" , title = "当前页" )
|
||||
private Long pageNo;
|
||||
|
||||
@Schema(name = "pageSize" , title = "每页记录数" )
|
||||
private Long pageSize;
|
||||
|
||||
@Schema(name = "total" , title = "总记录数" )
|
||||
private Long total;
|
||||
|
||||
@Schema(name = "list" , title = "当前页数据集合" )
|
||||
private List<T> list;
|
||||
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
package cn.bunny.dao.result;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class Result<T> {
|
||||
// 状态码
|
||||
private Integer code;
|
||||
// 返回消息
|
||||
private String message;
|
||||
// 返回数据
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* * 自定义返回体
|
||||
*
|
||||
* @param data 返回体
|
||||
* @return Result<T>
|
||||
*/
|
||||
protected static <T> Result<T> build(T data) {
|
||||
Result<T> result = new Result<>();
|
||||
result.setData(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 自定义返回体,使用ResultCodeEnum构建
|
||||
*
|
||||
* @param body 返回体
|
||||
* @param codeEnum 返回状态码
|
||||
* @return Result<T>
|
||||
*/
|
||||
public static <T> Result<T> build(T body, ResultCodeEnum codeEnum) {
|
||||
Result<T> result = build(body);
|
||||
result.setCode(codeEnum.getCode());
|
||||
result.setMessage(codeEnum.getMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 自定义返回体
|
||||
*
|
||||
* @param body 返回体
|
||||
* @param code 返回状态码
|
||||
* @param message 返回消息
|
||||
* @return Result<T>
|
||||
*/
|
||||
public static <T> Result<T> build(T body, Integer code, String message) {
|
||||
Result<T> result = build(body);
|
||||
result.setCode(code);
|
||||
result.setMessage(message);
|
||||
result.setData(null);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作成功
|
||||
*
|
||||
* @return Result<T>
|
||||
*/
|
||||
public static <T> Result<T> success() {
|
||||
return success(null, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作成功
|
||||
*
|
||||
* @param data baseCategory1List
|
||||
*/
|
||||
public static <T> Result<T> success(T data) {
|
||||
return build(data, ResultCodeEnum.SUCCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作成功-状态码
|
||||
*
|
||||
* @param codeEnum 状态码
|
||||
*/
|
||||
public static <T> Result<T> success(ResultCodeEnum codeEnum) {
|
||||
return success(null, codeEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作成功-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param codeEnum 状态码
|
||||
*/
|
||||
public static <T> Result<T> success(T data, ResultCodeEnum codeEnum) {
|
||||
return build(data, codeEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public static <T> Result<T> success(T data, String message) {
|
||||
return build(data, 200, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param code 状态码
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public static <T> Result<T> success(T data, Integer code, String message) {
|
||||
return build(data, code, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败
|
||||
*/
|
||||
public static <T> Result<T> error() {
|
||||
return Result.build(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据
|
||||
*
|
||||
* @param data 返回体
|
||||
*/
|
||||
public static <T> Result<T> error(T data) {
|
||||
return build(data, ResultCodeEnum.FAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-状态码
|
||||
*
|
||||
* @param codeEnum 状态码
|
||||
*/
|
||||
public static <T> Result<T> error(ResultCodeEnum codeEnum) {
|
||||
return build(null, codeEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param codeEnum 状态码
|
||||
*/
|
||||
public static <T> Result<T> error(T data, ResultCodeEnum codeEnum) {
|
||||
return build(data, codeEnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param code 状态码
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public static <T> Result<T> error(T data, Integer code, String message) {
|
||||
return build(data, code, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* * 操作失败-自定义返回数据和状态码
|
||||
*
|
||||
* @param data 返回体
|
||||
* @param message 错误信息
|
||||
*/
|
||||
public static <T> Result<T> error(T data, String message) {
|
||||
return build(null, 500, message);
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
package cn.bunny.dao.result;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 统一返回结果状态信息类
|
||||
*/
|
||||
@Getter
|
||||
public enum ResultCodeEnum {
|
||||
// 成功操作 200
|
||||
SUCCESS(200, "操作成功" ),
|
||||
ADD_SUCCESS(200, "添加成功" ),
|
||||
UPDATE_SUCCESS(200, "修改成功" ),
|
||||
DELETE_SUCCESS(200, "删除成功" ),
|
||||
SORT_SUCCESS(200, "排序成功" ),
|
||||
SUCCESS_UPLOAD(200, "上传成功" ),
|
||||
SUCCESS_LOGOUT(200, "退出成功" ),
|
||||
LOGOUT_SUCCESS(200, "退出成功" ),
|
||||
EMAIL_CODE_REFRESH(200, "邮箱验证码已刷新" ),
|
||||
EMAIL_CODE_SEND_SUCCESS(200, "邮箱验证码已发送" ),
|
||||
|
||||
// 验证错误 201
|
||||
USERNAME_OR_PASSWORD_NOT_EMPTY(201, "用户名或密码不能为空" ),
|
||||
EMAIL_CODE_NOT_EMPTY(201, "邮箱验证码不能为空" ),
|
||||
SEND_EMAIL_CODE_NOT_EMPTY(201, "请先发送邮箱验证码" ),
|
||||
EMAIL_CODE_NOT_MATCHING(201, "邮箱验证码不匹配" ),
|
||||
LOGIN_ERROR(500, "账号或密码错误" ),
|
||||
LOGIN_ERROR_USERNAME_PASSWORD_NOT_EMPTY(201, "登录信息不能为空" ),
|
||||
GET_BUCKET_EXCEPTION(201, "获取文件信息失败" ),
|
||||
SEND_MAIL_CODE_ERROR(201, "邮件发送失败" ),
|
||||
EMAIL_CODE_EMPTY(201, "邮箱验证码过期或不存在" ),
|
||||
EMAIL_EXIST(201, "邮箱已存在" ),
|
||||
REQUEST_IS_EMPTY(201, "请求数据为空" ),
|
||||
DATA_TOO_LARGE(201, "请求数据为空" ),
|
||||
UPDATE_NEW_PASSWORD_SAME_AS_OLD_PASSWORD(201, "新密码与密码相同" ),
|
||||
|
||||
// 数据相关 206
|
||||
ILLEGAL_REQUEST(206, "非法请求" ),
|
||||
REPEAT_SUBMIT(206, "重复提交" ),
|
||||
DATA_ERROR(206, "数据异常" ),
|
||||
EMAIL_USER_TEMPLATE_IS_EMPTY(206, "邮件模板为空" ),
|
||||
EMAIL_TEMPLATE_IS_EMPTY(206, "邮件模板为空" ),
|
||||
EMAIL_USER_IS_EMPTY(206, "关联邮件用户配置为空" ),
|
||||
DATA_EXIST(206, "数据已存在" ),
|
||||
DATA_NOT_EXIST(206, "数据不存在" ),
|
||||
ALREADY_USER_EXCEPTION(206, "用户已存在" ),
|
||||
USER_IS_EMPTY(206, "用户不存在" ),
|
||||
FILE_NOT_EXIST(206, "文件不存在" ),
|
||||
NEW_PASSWORD_SAME_OLD_PASSWORD(206, "新密码不能和旧密码相同" ),
|
||||
MISSING_TEMPLATE_FILES(206, "缺少模板文件" ),
|
||||
|
||||
// 身份过期 208
|
||||
LOGIN_AUTH(208, "请先登陆" ),
|
||||
AUTHENTICATION_EXPIRED(208, "身份验证过期" ),
|
||||
SESSION_EXPIRATION(208, "会话过期" ),
|
||||
|
||||
// 209
|
||||
THE_SAME_USER_HAS_LOGGED_IN(209, "相同用户已登录" ),
|
||||
|
||||
// 提示错误
|
||||
UPDATE_ERROR(216, "修改失败" ),
|
||||
URL_ENCODE_ERROR(216, "URL编码失败" ),
|
||||
ILLEGAL_CALLBACK_REQUEST_ERROR(217, "非法回调请求" ),
|
||||
FETCH_USERINFO_ERROR(219, "获取用户信息失败" ),
|
||||
ILLEGAL_DATA_REQUEST(219, "非法数据请求" ),
|
||||
CLASS_NOT_FOUND(219, "类名不存在" ),
|
||||
ADMIN_ROLE_CAN_NOT_DELETED(219, "无法删除admin角色" ),
|
||||
ROUTER_RANK_NEED_LARGER_THAN_THE_PARENT(219, "设置路由等级需要大于或等于父级的路由等级" ),
|
||||
|
||||
// 无权访问 403
|
||||
FAIL_NO_ACCESS_DENIED(403, "无权访问" ),
|
||||
FAIL_NO_ACCESS_DENIED_USER_OFFLINE(403, "用户强制下线" ),
|
||||
TOKEN_PARSING_FAILED(403, "token解析失败" ),
|
||||
FAIL_NO_ACCESS_DENIED_USER_LOCKED(403, "该账户已封禁" ),
|
||||
|
||||
// 系统错误 500
|
||||
UNKNOWN_EXCEPTION(500, "服务异常" ),
|
||||
SERVICE_ERROR(500, "服务异常" ),
|
||||
UPLOAD_ERROR(500, "上传失败" ),
|
||||
FAIL(500, "失败" ),
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
private final String message;
|
||||
|
||||
ResultCodeEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package cn.bunny.dao.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GeneratorVo {
|
||||
|
||||
/* 生成的代码 */
|
||||
private String code;
|
||||
|
||||
/* 表名 */
|
||||
private String tableName;
|
||||
|
||||
/* 注释内容 */
|
||||
private String comment;
|
||||
|
||||
/* 生成类型路径 */
|
||||
private String path;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package cn.bunny.dao.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TableInfoVo {
|
||||
|
||||
/* 表目录 */
|
||||
private String tableCat;
|
||||
|
||||
/* 表模式(可能为null) */
|
||||
private String tableSchem;
|
||||
|
||||
/* 表类型(通常是"TABLE") */
|
||||
private String tableType;
|
||||
|
||||
/* 类型的目录(可能为null) */
|
||||
private String typeCat;
|
||||
|
||||
/* 类型的模式(可能为null) */
|
||||
private String typeSchem;
|
||||
|
||||
/* 类型名称(可能为null) */
|
||||
private String typeName;
|
||||
|
||||
/* 自引用列名(可能为null) */
|
||||
private String selfReferencingColName;
|
||||
|
||||
/* 引用生成(可能为null) */
|
||||
private String refGeneration;
|
||||
|
||||
/* 表名 */
|
||||
private String tableName;
|
||||
|
||||
/* 类名 */
|
||||
private String className;
|
||||
|
||||
/* 注释内容 */
|
||||
private String comment;
|
||||
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package cn.bunny.dao.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class VmsPathVo {
|
||||
|
||||
/* 路径名称 */
|
||||
private String name;
|
||||
|
||||
/* 显示的label */
|
||||
private String label;
|
||||
|
||||
/* 文件夹最上级目录名称 */
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package cn.bunny.exception;
|
||||
|
||||
import cn.bunny.dao.result.ResultCodeEnum;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Getter
|
||||
@ToString
|
||||
@Slf4j
|
||||
public class AuthCustomerException extends RuntimeException {
|
||||
// 状态码
|
||||
Integer code;
|
||||
|
||||
// 描述信息
|
||||
String message = "服务异常";
|
||||
|
||||
// 返回结果状态
|
||||
ResultCodeEnum resultCodeEnum;
|
||||
|
||||
|
||||
public AuthCustomerException(Integer code, String message) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AuthCustomerException(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public AuthCustomerException(ResultCodeEnum codeEnum) {
|
||||
super(codeEnum.getMessage());
|
||||
this.code = codeEnum.getCode();
|
||||
this.message = codeEnum.getMessage();
|
||||
this.resultCodeEnum = codeEnum;
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
package cn.bunny.exception;
|
||||
|
||||
|
||||
import cn.bunny.dao.result.Result;
|
||||
import cn.bunny.dao.result.ResultCodeEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import java.nio.file.AccessDeniedException;
|
||||
import java.sql.SQLIntegrityConstraintViolationException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 全局异常拦截器
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
@Slf4j
|
||||
public class GlobalExceptionHandler {
|
||||
// 自定义异常信息
|
||||
@ExceptionHandler(AuthCustomerException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> exceptionHandler(AuthCustomerException exception) {
|
||||
Integer code = exception.getCode() != null ? exception.getCode() : 500;
|
||||
return Result.error(null, code, exception.getMessage());
|
||||
}
|
||||
|
||||
// 运行时异常信息
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> exceptionHandler(RuntimeException exception) {
|
||||
String message = exception.getMessage();
|
||||
message = StringUtils.hasText(message) ? message : "服务器异常";
|
||||
exception.printStackTrace();
|
||||
|
||||
// 解析异常
|
||||
String jsonParseError = "JSON parse error (.*)";
|
||||
Matcher jsonParseErrorMatcher = Pattern.compile(jsonParseError).matcher(message);
|
||||
if (jsonParseErrorMatcher.find()) {
|
||||
return Result.error(null, 500, "JSON解析异常 " + jsonParseErrorMatcher.group(1));
|
||||
}
|
||||
|
||||
// 数据过大
|
||||
String dataTooLongError = "Data too long for column (.*?) at row 1";
|
||||
Matcher dataTooLongErrorMatcher = Pattern.compile(dataTooLongError).matcher(message);
|
||||
if (dataTooLongErrorMatcher.find()) {
|
||||
return Result.error(null, 500, dataTooLongErrorMatcher.group(1) + " 字段数据过大" );
|
||||
}
|
||||
|
||||
// 主键冲突
|
||||
String primaryKeyError = "Duplicate entry '(.*?)' for key .*";
|
||||
Matcher primaryKeyErrorMatcher = Pattern.compile(primaryKeyError).matcher(message);
|
||||
if (primaryKeyErrorMatcher.find()) {
|
||||
return Result.error(null, 500, "[" + primaryKeyErrorMatcher.group(1) + "]已存在" );
|
||||
}
|
||||
|
||||
// corn表达式错误
|
||||
String cronExpression = "CronExpression '(.*?)' is invalid";
|
||||
Matcher cronExpressionMatcher = Pattern.compile(cronExpression).matcher(message);
|
||||
if (cronExpressionMatcher.find()) {
|
||||
return Result.error(null, 500, "表达式 " + cronExpressionMatcher.group(1) + " 不合法" );
|
||||
}
|
||||
|
||||
log.error("GlobalExceptionHandler===>运行时异常信息:{}" , message);
|
||||
return Result.error(null, 500, message);
|
||||
}
|
||||
|
||||
// 表单验证字段
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
public Result<String> handleValidationExceptions(MethodArgumentNotValidException ex) {
|
||||
String errorMessage = ex.getBindingResult().getFieldErrors().stream()
|
||||
.map(DefaultMessageSourceResolvable::getDefaultMessage)
|
||||
.collect(Collectors.joining(", " ));
|
||||
return Result.error(null, 201, errorMessage);
|
||||
}
|
||||
|
||||
// 特定异常处理
|
||||
@ExceptionHandler(ArithmeticException.class)
|
||||
@ResponseBody
|
||||
public Result<Object> error(ArithmeticException exception) {
|
||||
log.error("GlobalExceptionHandler===>特定异常信息:{}" , exception.getMessage());
|
||||
|
||||
return Result.error(null, 500, exception.getMessage());
|
||||
}
|
||||
|
||||
// spring security异常
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
@ResponseBody
|
||||
public Result<String> error(AccessDeniedException exception) throws AccessDeniedException {
|
||||
log.error("GlobalExceptionHandler===>spring security异常:{}" , exception.getMessage());
|
||||
|
||||
return Result.error(ResultCodeEnum.SERVICE_ERROR);
|
||||
}
|
||||
|
||||
// 处理SQL异常
|
||||
@ExceptionHandler(SQLIntegrityConstraintViolationException.class)
|
||||
@ResponseBody
|
||||
public Result<String> exceptionHandler(SQLIntegrityConstraintViolationException exception) {
|
||||
log.error("GlobalExceptionHandler===>处理SQL异常:{}" , exception.getMessage());
|
||||
|
||||
String message = exception.getMessage();
|
||||
if (message.contains("Duplicate entry" )) {
|
||||
// 错误信息
|
||||
return Result.error(ResultCodeEnum.USER_IS_EMPTY);
|
||||
} else {
|
||||
return Result.error(ResultCodeEnum.UNKNOWN_EXCEPTION);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.vo.TableInfoVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface TableService {
|
||||
|
||||
/**
|
||||
* 获取表属性
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @return 表属性
|
||||
*/
|
||||
TableInfoVo getTableMetaData(String tableName);
|
||||
|
||||
/**
|
||||
* 获取所有表
|
||||
*
|
||||
* @return 所有表信息
|
||||
*/
|
||||
List<TableInfoVo> getAllTableMetaData();
|
||||
|
||||
/**
|
||||
* 获取列属性
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @return 当前表所有的列内容
|
||||
*/
|
||||
List<ColumnMetaData> getColumnInfo(String tableName);
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package cn.bunny.service;
|
||||
|
||||
import cn.bunny.dao.dto.VmsArgumentDto;
|
||||
import cn.bunny.dao.vo.GeneratorVo;
|
||||
import cn.bunny.dao.vo.VmsPathVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface VmsService {
|
||||
/**
|
||||
* 生成服务端代码
|
||||
*
|
||||
* @param dto VmsArgumentDto
|
||||
* @return 生成内容
|
||||
*/
|
||||
List<GeneratorVo> generator(VmsArgumentDto dto);
|
||||
|
||||
/**
|
||||
* 获取vms文件路径
|
||||
*
|
||||
* @return vms下的文件路径
|
||||
*/
|
||||
Map<String, List<VmsPathVo>> getVmsPathList();
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.entity.TableMetaData;
|
||||
import cn.bunny.dao.vo.TableInfoVo;
|
||||
import cn.bunny.service.TableService;
|
||||
import cn.bunny.utils.DbInfoUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
||||
public class TableServiceImpl implements TableService {
|
||||
|
||||
private final DbInfoUtil dbInfoUtil;
|
||||
|
||||
public TableServiceImpl(DbInfoUtil dbInfoUtil) {
|
||||
this.dbInfoUtil = dbInfoUtil;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表属性
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @return 表属性
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public TableInfoVo getTableMetaData(String tableName) {
|
||||
TableInfoVo tableInfoVo = new TableInfoVo();
|
||||
|
||||
TableMetaData tableMetaData = dbInfoUtil.tableInfo(tableName);
|
||||
BeanUtils.copyProperties(tableMetaData, tableInfoVo);
|
||||
|
||||
return tableInfoVo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有表
|
||||
*
|
||||
* @return 所有表信息
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<TableInfoVo> getAllTableMetaData() {
|
||||
List<TableMetaData> allTableInfo = dbInfoUtil.getAllTableInfo();
|
||||
|
||||
return allTableInfo.stream().map(tableMetaData -> {
|
||||
TableInfoVo tableInfoVo = new TableInfoVo();
|
||||
BeanUtils.copyProperties(tableMetaData, tableInfoVo);
|
||||
|
||||
return tableInfoVo;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列属性
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @return 当前表所有的列内容
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public List<ColumnMetaData> getColumnInfo(String tableName) {
|
||||
return dbInfoUtil.columnInfo(tableName);
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.dao.dto.VmsArgumentDto;
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.vo.GeneratorVo;
|
||||
import cn.bunny.dao.vo.TableInfoVo;
|
||||
import cn.bunny.dao.vo.VmsPathVo;
|
||||
import cn.bunny.service.TableService;
|
||||
import cn.bunny.service.VmsService;
|
||||
import cn.bunny.utils.ResourceFileUtil;
|
||||
import cn.bunny.utils.VmsUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
|
||||
public class VmsServiceImpl implements VmsService {
|
||||
private final TableService tableService;
|
||||
|
||||
public VmsServiceImpl(TableService tableService) {
|
||||
this.tableService = tableService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成服务端代码
|
||||
*
|
||||
* @param dto VmsArgumentDto
|
||||
* @return 生成内容
|
||||
*/
|
||||
@Override
|
||||
public List<GeneratorVo> generator(VmsArgumentDto dto) {
|
||||
String tableName = dto.getTableName();
|
||||
|
||||
return dto.getPath().stream().map(path -> {
|
||||
StringWriter writer = new StringWriter();
|
||||
|
||||
// 表格属性名 和 列信息
|
||||
TableInfoVo tableMetaData = tableService.getTableMetaData(tableName);
|
||||
List<ColumnMetaData> columnInfoList = tableService.getColumnInfo(tableName);
|
||||
List<String> list = columnInfoList.stream().map(ColumnMetaData::getColumnName).toList();
|
||||
|
||||
// 添加要生成的属性
|
||||
VelocityContext context = new VelocityContext();
|
||||
|
||||
// 当前的表名
|
||||
context.put("tableName", tableMetaData.getTableName());
|
||||
|
||||
// 表字段的注释内容
|
||||
context.put("comment", tableMetaData.getComment());
|
||||
|
||||
// 设置包名称
|
||||
context.put("package", dto.getPackageName());
|
||||
|
||||
// 当前表的列信息
|
||||
context.put("columnInfoList", columnInfoList);
|
||||
|
||||
// 数据库sql列
|
||||
context.put("baseColumnList", String.join(",", list));
|
||||
|
||||
VmsUtil.commonVms(writer, context, "vms/" + path, dto);
|
||||
|
||||
return GeneratorVo.builder()
|
||||
.code(writer.toString())
|
||||
.comment(tableMetaData.getComment())
|
||||
.tableName(tableMetaData.getTableName())
|
||||
.path(path)
|
||||
.build();
|
||||
}).toList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取vms文件路径
|
||||
*
|
||||
* @return vms下的文件路径
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public Map<String, List<VmsPathVo>> getVmsPathList() {
|
||||
List<String> vmsRelativeFiles;
|
||||
|
||||
vmsRelativeFiles = ResourceFileUtil.getRelativeFiles("vms");
|
||||
|
||||
return vmsRelativeFiles.stream().map(vmFile -> {
|
||||
String[] filepathList = vmFile.split("/");
|
||||
String filename = filepathList[filepathList.length - 1].replace(".vm", "");
|
||||
|
||||
return VmsPathVo.builder().name(vmFile).label(filename).type(filepathList[0]).build();
|
||||
}).collect(Collectors.groupingBy(VmsPathVo::getType));
|
||||
}
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
public class ConvertUtil {
|
||||
/**
|
||||
* 将数据库类型转换为Java类型
|
||||
*/
|
||||
public static String convertToJavaType(String columnType) {
|
||||
if (columnType == null) return "Object";
|
||||
|
||||
columnType = columnType.toLowerCase();
|
||||
return switch (columnType) {
|
||||
case "varchar" , "char" , "text" , "longtext" , "mediumtext" , "tinytext" -> "String";
|
||||
case "int" , "integer" , "tinyint" , "smallint" -> "Integer";
|
||||
case "bigint" -> "Long";
|
||||
case "decimal" , "numeric" -> "BigDecimal";
|
||||
case "float" -> "Float";
|
||||
case "double" -> "Double";
|
||||
case "boolean" , "bit" , "tinyint unsigned" -> "Boolean";
|
||||
case "date" , "year" -> "Date";
|
||||
case "time" -> "Time";
|
||||
case "datetime" , "timestamp" -> "LocalDateTime";
|
||||
case "blob" , "longblob" , "mediumblob" , "tinyblob" -> "byte[]";
|
||||
default -> "Object";
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 下划线命名转驼峰命名
|
||||
*/
|
||||
public static String convertToCamelCase(String name) {
|
||||
return convertToCamelCase(name, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下划线命名转驼峰命名
|
||||
*
|
||||
* @param name 原始名称
|
||||
* @param firstLetterCapital 首字母是否大写
|
||||
*/
|
||||
public static String convertToCamelCase(String name, boolean firstLetterCapital) {
|
||||
if (name == null || name.isEmpty()) return name;
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
String[] parts = name.split("_" );
|
||||
|
||||
for (int i = 0; i < parts.length; i++) {
|
||||
String part = parts[i];
|
||||
if (part.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i == 0 && !firstLetterCapital) {
|
||||
result.append(part.toLowerCase());
|
||||
} else {
|
||||
result.append(Character.toUpperCase(part.charAt(0)))
|
||||
.append(part.substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 辅助方法:将列名转换为字段名(如user_name -> userName)
|
||||
*
|
||||
* @param columnName 列名称
|
||||
* @return 列名称
|
||||
*/
|
||||
public static String convertToFieldName(String columnName) {
|
||||
String[] parts = columnName.split("_" );
|
||||
StringBuilder fieldName = new StringBuilder(parts[0].toLowerCase());
|
||||
for (int i = 1; i < parts.length; i++) {
|
||||
fieldName.append(parts[i].substring(0, 1).toUpperCase())
|
||||
.append(parts[i].substring(1).toLowerCase());
|
||||
}
|
||||
return fieldName.toString();
|
||||
}
|
||||
}
|
|
@ -1,169 +0,0 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.entity.TableMetaData;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class DbInfoUtil {
|
||||
|
||||
private final DataSource dataSource;
|
||||
|
||||
public DbInfoUtil(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表的所有主键列名
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @return 主键列名的集合
|
||||
*/
|
||||
public Set<String> getPrimaryKeyColumns(String tableName) throws SQLException {
|
||||
Set<String> primaryKeys = new HashSet<>();
|
||||
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet pkResultSet = metaData.getPrimaryKeys(null, null, tableName);
|
||||
|
||||
while (pkResultSet.next()) {
|
||||
primaryKeys.add(pkResultSet.getString("COLUMN_NAME").toLowerCase());
|
||||
}
|
||||
|
||||
return primaryKeys;
|
||||
}
|
||||
}
|
||||
|
||||
public List<TableMetaData> getAllTableInfo() throws SQLException {
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(null, null, "%", new String[]{"TABLE"});
|
||||
|
||||
List<TableMetaData> list = new ArrayList<>();
|
||||
|
||||
while (tables.next()) {
|
||||
String tableName = tables.getString("TABLE_NAME");
|
||||
TableMetaData tableMetaData = tableInfo(tableName);
|
||||
list.add(tableMetaData);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取表注释信息
|
||||
*
|
||||
* @param tableName 数据库表名
|
||||
* @return 表信息
|
||||
* @throws SQLException SQLException
|
||||
*/
|
||||
public TableMetaData tableInfo(String tableName) throws SQLException {
|
||||
TableMetaData tableMetaData;
|
||||
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet tables = metaData.getTables(null, null, tableName, new String[]{"TABLE"});
|
||||
|
||||
// 获取表的注释信息
|
||||
if (tables.next()) {
|
||||
String remarks = tables.getString("REMARKS");
|
||||
String tableCat = tables.getString("TABLE_CAT");
|
||||
String tableSchem = tables.getString("TABLE_SCHEM");
|
||||
String tableType = tables.getString("TABLE_TYPE");
|
||||
String typeCat = tables.getString("TYPE_CAT");
|
||||
String typeSchem = tables.getString("TYPE_SCHEM");
|
||||
String typeName = tables.getString("TYPE_NAME");
|
||||
String selfReferencingColName = tables.getString("SELF_REFERENCING_COL_NAME");
|
||||
String refGeneration = tables.getString("REF_GENERATION");
|
||||
|
||||
tableMetaData = TableMetaData.builder()
|
||||
.tableName(tableName)
|
||||
.comment(remarks)
|
||||
.tableCat(tableCat)
|
||||
.tableSchem(tableSchem)
|
||||
.tableType(tableType)
|
||||
.typeCat(typeCat)
|
||||
.typeSchem(typeSchem)
|
||||
.typeName(typeName)
|
||||
.selfReferencingColName(selfReferencingColName)
|
||||
.refGeneration(refGeneration)
|
||||
.build();
|
||||
} else {
|
||||
throw new RuntimeException("数据表不存在");
|
||||
}
|
||||
|
||||
return tableMetaData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库列信息
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @return 列表信息
|
||||
* @throws SQLException SQLException
|
||||
*/
|
||||
public List<ColumnMetaData> columnInfo(String tableName) throws SQLException {
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
List<ColumnMetaData> columns = new ArrayList<>();
|
||||
|
||||
Set<String> primaryKeyColumns = getPrimaryKeyColumns(tableName);
|
||||
|
||||
try (ResultSet columnsRs = metaData.getColumns(null, null, tableName, null)) {
|
||||
while (columnsRs.next()) {
|
||||
ColumnMetaData column = new ColumnMetaData();
|
||||
String columnName = columnsRs.getString("COLUMN_NAME");
|
||||
|
||||
String javaType = ConvertUtil.convertToJavaType(column.getJdbcType());
|
||||
|
||||
column.setColumnName(columnName);
|
||||
column.setFieldName(ConvertUtil.convertToFieldName(column.getColumnName()));
|
||||
column.setJdbcType(columnsRs.getString("TYPE_NAME"));
|
||||
column.setJavaType(javaType);
|
||||
column.setJavascriptType(StringUtils.uncapitalize(javaType));
|
||||
column.setComment(columnsRs.getString("REMARKS"));
|
||||
|
||||
// 确保 primaryKeyColumns 不为空
|
||||
if (!primaryKeyColumns.isEmpty()) {
|
||||
column.setIsPrimaryKey(primaryKeyColumns.contains(columnName));
|
||||
}
|
||||
|
||||
columns.add(column);
|
||||
}
|
||||
}
|
||||
|
||||
columns.get(0).setIsPrimaryKey(true);
|
||||
|
||||
return columns;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据库所有的信息
|
||||
*
|
||||
* @param tableName 表名
|
||||
* @return 表内容
|
||||
* @throws SQLException SQLException
|
||||
*/
|
||||
public TableMetaData dbInfo(String tableName) throws SQLException {
|
||||
List<ColumnMetaData> columnMetaData = columnInfo(tableName);
|
||||
TableMetaData tableMetaData = tableInfo(tableName);
|
||||
|
||||
tableMetaData.setColumns(columnMetaData);
|
||||
|
||||
return tableMetaData;
|
||||
}
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ResourceFileUtil {
|
||||
/**
|
||||
* 获取目标文件夹下所有文件完整路径
|
||||
*
|
||||
* @param dirname 文件夹名称
|
||||
* @return 目标文件完整路径
|
||||
* @throws IOException IOException
|
||||
*/
|
||||
public static List<String> getAbsoluteFiles(String dirname) throws IOException {
|
||||
List<String> fileNames = new ArrayList<>();
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
Enumeration<URL> urls = classLoader.getResources(dirname);
|
||||
|
||||
while (urls.hasMoreElements()) {
|
||||
URL url = urls.nextElement();
|
||||
if (url.getProtocol().equals("file")) {
|
||||
// 文件系统
|
||||
File file = new File(url.getFile());
|
||||
if (file.isDirectory()) {
|
||||
addFullFilesFromDirectory(file, fileNames);
|
||||
}
|
||||
} else if (url.getProtocol().equals("jar")) {
|
||||
// JAR文件
|
||||
String jarPath = url.getPath().substring(5, url.getPath().indexOf("!"));
|
||||
try (JarFile jar = new JarFile(jarPath)) {
|
||||
Enumeration<JarEntry> entries = jar.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
String name = entries.nextElement().getName();
|
||||
if (name.startsWith(dirname + "/") && !name.endsWith("/")) {
|
||||
fileNames.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文件
|
||||
* 获取目标文件夹下所有文件完整路径
|
||||
*
|
||||
* @param directory 文件夹
|
||||
* @param fileNames 文件名称
|
||||
*/
|
||||
private static void addFullFilesFromDirectory(File directory, List<String> fileNames) {
|
||||
File[] files = directory.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (file.isFile()) {
|
||||
fileNames.add(file.getPath());
|
||||
} else if (file.isDirectory()) {
|
||||
addFullFilesFromDirectory(file, fileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相对文件夹路径
|
||||
*
|
||||
* @return 相对当前的文件夹路径
|
||||
* @throws IOException IOException
|
||||
* @throws URISyntaxException URISyntaxException
|
||||
*/
|
||||
public static List<String> getRelativeFiles(String dirname) throws IOException, URISyntaxException {
|
||||
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
|
||||
URL resource = classLoader.getResource(dirname);
|
||||
|
||||
if (resource == null) return Collections.emptyList();
|
||||
|
||||
// 处理JAR包内的情况
|
||||
if (resource.getProtocol().equals("jar")) {
|
||||
return getFilesFromJar(resource, dirname);
|
||||
} else {
|
||||
// 处理文件系统情况
|
||||
return getFilesFromFileSystem(resource);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> getFilesFromJar(URL jarUrl, String dirname) throws IOException {
|
||||
List<String> fileNames = new ArrayList<>();
|
||||
String jarPath = jarUrl.getPath().substring(5, jarUrl.getPath().indexOf("!"));
|
||||
|
||||
try (JarFile jar = new JarFile(jarPath)) {
|
||||
jar.entries().asIterator()
|
||||
.forEachRemaining(entry -> {
|
||||
String name = entry.getName();
|
||||
String prefix = dirname + "/";
|
||||
|
||||
if (name.startsWith(prefix) && !name.endsWith("/")) {
|
||||
fileNames.add(name.substring(prefix.length()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
private static List<String> getFilesFromFileSystem(URL resource) throws IOException, URISyntaxException {
|
||||
Path filepath = Paths.get(resource.toURI());
|
||||
|
||||
try (Stream<Path> paths = Files.walk(filepath)) {
|
||||
return paths.filter(Files::isRegularFile)
|
||||
.map(filepath::relativize)
|
||||
.map(Path::toString)
|
||||
// 统一使用/作为分隔符
|
||||
.map(s -> s.replace('\\', '/'))
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
import cn.bunny.dao.dto.VmsArgumentDto;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.app.Velocity;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class VmsUtil {
|
||||
|
||||
/**
|
||||
* @param writer 写入字符串内容
|
||||
* @param context Velocity上下文
|
||||
* @param templateName 模板名称
|
||||
* @param dto 类名称可以自定义,格式为 xxx_xxx
|
||||
*/
|
||||
public static void commonVms(StringWriter writer, VelocityContext context, String templateName, VmsArgumentDto dto) {
|
||||
String className = dto.getClassName();
|
||||
String tablePrefixes = dto.getTablePrefixes();
|
||||
String author = dto.getAuthor();
|
||||
String requestMapping = dto.getRequestMapping();
|
||||
|
||||
AtomicReference<String> replaceTableName = new AtomicReference<>(className);
|
||||
for (String prefix : tablePrefixes.split("[,,]" )) {
|
||||
replaceTableName.set(className.replace(prefix, "" ));
|
||||
}
|
||||
|
||||
String date = new SimpleDateFormat(dto.getSimpleDateFormat()).format(new Date());
|
||||
context.put("leftBrace", "{" );
|
||||
context.put("date", date);
|
||||
context.put("author", author);
|
||||
context.put("requestMapping", requestMapping);
|
||||
context.put("classLowercaseName", ConvertUtil.convertToCamelCase(replaceTableName.get()));
|
||||
context.put("classUppercaseName", ConvertUtil.convertToCamelCase(replaceTableName.get(), true));
|
||||
|
||||
Template servicePathTemplate = Velocity.getTemplate(templateName, "UTF-8" );
|
||||
servicePathTemplate.merge(context, writer);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
bunny:
|
||||
master:
|
||||
host: 192.168.3.137
|
||||
port: 3306
|
||||
database: auth_admin
|
||||
username: root
|
||||
password: "123456"
|
||||
connect:
|
||||
url: jdbc:sqlite::resource:database.sqlite
|
||||
username: root
|
||||
password: "123456"
|
|
@ -1,17 +0,0 @@
|
|||
server:
|
||||
port: 9999
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
application:
|
||||
name: generator-code
|
||||
thymeleaf:
|
||||
check-template-location: false
|
||||
|
||||
datasource:
|
||||
type: com.zaxxer.hikari.HikariDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://${bunny.master.host}:${bunny.master.port}/${bunny.master.database}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
||||
username: ${bunny.master.username}
|
||||
password: ${bunny.master.password}
|
|
@ -1,10 +0,0 @@
|
|||
_ _
|
||||
| |__ _ _ _ __ _ __ _ _ (_) __ ___ ____ _
|
||||
| '_ \| | | | '_ \| '_ \| | | | | |/ _` \ \ / / _` |
|
||||
| |_) | |_| | | | | | | | |_| | | | (_| |\ V | (_| |
|
||||
|_.__/ \__,_|_| |_|_| |_|\__, | _/ |\__,_| \_/ \__,_|
|
||||
|___/ |__/
|
||||
|
||||
Service Name${spring.application.name}
|
||||
SpringBoot Version: ${spring-boot.version}${spring-boot.formatted-version}
|
||||
SpringActive:${spring.profiles.active}
|
|
@ -1,69 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<contextName>logback</contextName>
|
||||
|
||||
<!-- 格式化 年-月-日 输出 -->
|
||||
<timestamp key="datetime" datePattern="yyyy-MM-dd"/>
|
||||
|
||||
<!--编码-->
|
||||
<property name="ENCODING" value="UTF-8"/>
|
||||
|
||||
<!-- 控制台日志 -->
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 临界值过滤器 -->
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>INFO</level>
|
||||
</filter>
|
||||
<encoder>
|
||||
<pattern>%cyan([%thread %d{yyyy-MM-dd HH:mm:ss}]) %yellow(%-5level) %green(%logger{100}).%boldRed(%method)-%boldMagenta(%line)-%blue(%msg%n)
|
||||
</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 文件日志 -->
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>logs/${datetime}/financial-server.log</file>
|
||||
<append>true</append>
|
||||
<encoder>
|
||||
<pattern>%date{yyyy-MM-dd HH:mm:ss} [%-5level] %thread %file:%line %logger %msg%n</pattern>
|
||||
<charset>${ENCODING}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 让SpringBoot内部日志ERROR级别 减少日志输出 -->
|
||||
<logger name="org.springframework" level="ERROR" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 让mybatis整合包日志ERROR 减少日志输出 -->
|
||||
<logger name="org.mybatis" level="ERROR" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 让ibatis 日志ERROR 减少日志输出 -->
|
||||
<logger name="org.apache.ibatis" level="ERROR" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 让 tomcat包打印日志 日志ERROR 减少日志输出 -->
|
||||
<logger name="org.apache" level="ERROR" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 我们自己开发的程序为DEBUG -->
|
||||
<logger name="cn.bunny" level="DEBUG" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<logger name="com.baomidou" level="ERROR" additivity="false">
|
||||
<appender-ref ref="STOUT"/>
|
||||
</logger>
|
||||
|
||||
<!-- 根日志记录器:INFO级别 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>400 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 400 - Bad Request</h1>
|
||||
<dl>
|
||||
<dt>错误说明:因为错误的语法导致服务器无法理解请求信息。</dt>
|
||||
<dt>原因1:客户端发起的请求不符合服务器对请求的某些限制,或者请求本身存在一定的错误。</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>链接中有特殊字符或者链接长度过长导致,请对应修改.</dd>
|
||||
<dt>原因2:request header 或者 cookie 过大所引起</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>crtl+shift+delete 快捷键清除cookie.</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>403 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>403 - Forbidden 禁止访问: 访问被拒绝</h1>
|
||||
<dl>
|
||||
<dt>错误说明:禁止访问,服务器拒绝访问</dt>
|
||||
<dt>原因1:未找到默认的索引文件</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>IIS中【启用默认内容文档】选项中将默认打开文档修改为程序首页文件格式,如:index.html或者index.php</dd>
|
||||
<dt>原因2:文件夹安全权限导致</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>程序文件-右击-属性-安全-Users-修改为读取和执行权限</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,78 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>404 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 50px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>404 - Page Not Found 未找到</h1>
|
||||
<dl>
|
||||
<dt>错误说明:请求的页面不存在</dt>
|
||||
<dt>原因1:访问的文档权限不够</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>修改文件权限为755,windos系统修改目录权限为可写可读。</dd>
|
||||
<dt>原因2:防火墙的原因</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>先关闭让防火墙通过WWW服务。</dd>
|
||||
<dt>原因3:站点根目录无默认访问文件</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>在根目录中创建index.html或者创建index.php。</dd>
|
||||
<dt>原因4:站点配置目录不正确</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>将网站应用程序复制到站点目录中,或者修改站点配置目录指定到应用程序目录中。</dd>
|
||||
<dt>原因5:站点使用了伪静态</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>将伪静态规则删除,或者重新编写正确的伪静态规则,或关闭伪静态配置。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-cmn-Hans">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>500 - 服务器错误</title>
|
||||
<meta content="width=device-width, maximum-scale=1, initial-scale=1" name="viewport"/>
|
||||
<style>
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
color: #333;
|
||||
margin: auto;
|
||||
padding: 1em;
|
||||
display: table;
|
||||
user-select: none;
|
||||
box-sizing: border-box;
|
||||
font: lighter 20px "微软雅黑";
|
||||
}
|
||||
|
||||
a {
|
||||
color: #3498db;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: 0;
|
||||
font-size: 3.5em;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.btn {
|
||||
color: #fff;
|
||||
padding: .75em 1em;
|
||||
background: #3498db;
|
||||
border-radius: 1.5em;
|
||||
display: inline-block;
|
||||
transition: opacity .3s, transform .3s;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.btn:active {
|
||||
opacity: .7;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<h1>:'(</h1>
|
||||
<p>服务器开小差啦!管理员正在修理中...</p>
|
||||
<p>还请阁下静候站点恢复~</p>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>501 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 501 - Not Implemented</h1>
|
||||
<dl>
|
||||
<dt>错误说明:服务器没有相应的执行动作来完成当前请求。</dt>
|
||||
<dt>原因1:Web 服务器不支持实现此请求所需的功能</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>可以用来HttpWebRequest指定一个UserAgent来试试的,有时候你可以换电脑来测试一下的。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,80 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>502 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 50px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 502 - Bad Gateway 没有响应</h1>
|
||||
<dl>
|
||||
<dt>错误说明:坏的网关,http向后端节点请求,没有响应</dt>
|
||||
<dt>原因1:DNS 缓冲</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>在dos窗口运行 ipconfig /flushdns,该命令会刷新DNS缓冲。</dd>
|
||||
<dt>原因2:浏览器代理</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>关掉代理。</dd>
|
||||
<dt>原因3:dns 被劫持了,即使使用国外的dns,也会被劫持</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>
|
||||
去掉VPN服务器的DNS。切换另外的dns。在windows系统中,可以在本地网络连接的属性中,去掉默认的dns,选用国外的dns,比如google的或opendns。
|
||||
</dd>
|
||||
<dt>原因4:php执行超时</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>修改/usr/local/php/etc/php.ini 将max_execution_time 改为300。</dd>
|
||||
<dt>原因5:nginx等待时间超时</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>适当增加nginx.conf配置文件中FastCGI的timeout时间。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>503 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 503 - Service Unavailable 服务不可用</h1>
|
||||
<dl>
|
||||
<dt>错误说明:服务当前不可用</dt>
|
||||
<dt>原因1:服务不可用状态</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>服务器或许就是正在维护或者暂停了,你可以联系一下服务器空间商。</dd>
|
||||
<dt>原因2:程序占用资源太多</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>通过设置应用程序池把账户改为NetworkService即可解决。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,81 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>504 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 50px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 504 - Gateway Timeout 网关超时</h1>
|
||||
<dl>
|
||||
<dt>错误说明:网关超时,服务器响应时间,达到超出设定的范围</dt>
|
||||
<dt>原因1:后端电脑之间 IP 通讯缓慢而产生</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>如果您的 Web 服务器由某一网站托管, 只有负责那个网站设置的人员才能解决这个问题。</dd>
|
||||
<dt>原因2:由于nginx默认的fastcgi进程响应的缓冲区太小造成的错误</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>一般默认的fastcgi进程响应的缓冲区是8K,这时可以设置大一点,在nginx.conf里,加入:fastcgi_buffers 8
|
||||
128k这表示设置fastcgi缓冲区为8块128k大小的空间。当然如果在进行某一项即时的操作, 可能需要nginx的超时参数调大点,
|
||||
例如设置成60秒:send_timeout 60;经过这两个参数的调整,一般不会再提示“504 Gateway Time-out”错误,问题基本解决。
|
||||
</dd>
|
||||
<dt>原因3:PHP环境的配置问题</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>更改php-fpm的几处配置: 把max_children由之前的10改为现在的30,这样就可以保证有充足的php-cgi进程可以被使用;
|
||||
把request_terminate_timeout由之前的0s改为60s,这样php-cgi进程 处理脚本的超时时间就是60秒,可以防止进程都被挂起,提高利用效率。
|
||||
接着再更改nginx的几个配置项,减少FastCGI的请求次数,尽量维持buffers不变: fastcgi_buffers由 4 64k 改为 2
|
||||
256k; fastcgi_buffer_size 由 64k 改为 128K; fastcgi_busy_buffers_size 由 128K 改为 256K;
|
||||
fastcgi_temp_file_write_size 由 128K 改为 256K。 重新加载php-fpm和nginx的配置,再次测试,如果没有出现“504
|
||||
Gateway Time-out”错误,问题解决。
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,72 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>505 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 505 - HTTP Version Not Supported</h1>
|
||||
<dl>
|
||||
<dt>错误说明:HTTP 版本不受支持。</dt>
|
||||
<dt>原因1:您的 Web 服务器不支持,或拒绝支持客户端(如您的浏览器)在发送给服务器的 HTTP 请求数据流中指定的 HTTP
|
||||
协议版本
|
||||
</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>升级您的 Web 服务器软件。</dd>
|
||||
<dt>原因2:http请求格式的错误</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>对照一下自己的代码,从打印的信息中终于找到问题所在。可能在请求后面多加了一个空格。http协议真是很严格了。
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>506 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 506 - Variant Also Negotiates</h1>
|
||||
<dl>
|
||||
<dt>错误说明:</dt>
|
||||
<dt>原因1:服务器存在内部配置错误</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>被请求的协商变元资源被配置为在透明内容协商中使用自己,因此在一个协商处理中不是一个合适的重点。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>507 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 507 - Insufficient Storage</h1>
|
||||
<dl>
|
||||
<dt>错误说明:</dt>
|
||||
<dt>原因1:服务器无法存储完成请求所必须的内容</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>这个状况被认为是临时的。WebDAV (RFC 4918)。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>509 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 509 - Bandwidth Limit Exceeded</h1>
|
||||
<dl>
|
||||
<dt>错误说明:</dt>
|
||||
<dt>原因1:网站流量已经超出您所购买的方案限制即服务器达到带宽限制</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>1.升级方案 2.等到下个月后流量重新计算,网站即可正常浏览。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,66 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>510 错误 - phpstudy</title>
|
||||
<meta content="" name="keywords">
|
||||
<meta content="" name="description">
|
||||
<meta content="webkit" name="renderer">
|
||||
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport">
|
||||
<meta content="black" name="apple-mobile-web-app-status-bar-style">
|
||||
<meta content="yes" name="apple-mobile-web-app-capable">
|
||||
<meta content="telephone=no" name="format-detection">
|
||||
<meta CONTENT="no-cache" HTTP-EQUIV="pragma">
|
||||
<meta CONTENT="no-store, must-revalidate" HTTP-EQUIV="Cache-Control">
|
||||
<meta CONTENT="Wed, 26 Feb 1997 08:21:57 GMT" HTTP-EQUIV="expires">
|
||||
<meta CONTENT="0" HTTP-EQUIV="expires">
|
||||
<style>
|
||||
body {
|
||||
font: 16px arial, 'Microsoft Yahei', 'Hiragino Sans GB', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
color: #3a87ad;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 45%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
.content > div {
|
||||
margin-top: 200px;
|
||||
padding: 20px;
|
||||
background: #d9edf7;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.content dl {
|
||||
color: #2d6a88;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
.content div div {
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="content">
|
||||
<div>
|
||||
<h1>HTTP 510 - Not Extended</h1>
|
||||
<dl>
|
||||
<dt>错误说明:</dt>
|
||||
<dt>原因1:获取资源所需要的策略并没有被满足</dt>
|
||||
<dd>解决办法:</dd>
|
||||
<dd>需要请求有额外的扩展内容,服务器才能处理请求。</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
|
@ -1 +0,0 @@
|
|||
.page-container[data-v-128c8218]{display:flex;padding:100px}.page-container .pic-404[data-v-128c8218]{width:600px;overflow:hidden}.page-container .pic-404__parent[data-v-128c8218]{width:100%}.page-container .pic-404__child.left[data-v-128c8218]{top:17px;left:220px;width:80px;opacity:0;animation-name:cloudLeft-128c8218;animation-duration:2s;animation-timing-function:linear;animation-delay:1s;animation-fill-mode:forwards}.page-container .pic-404__child.mid[data-v-128c8218]{top:10px;left:420px;width:46px;opacity:0;animation-name:cloudMid-128c8218;animation-duration:2s;animation-timing-function:linear;animation-delay:1.2s;animation-fill-mode:forwards}.page-container .pic-404__child.right[data-v-128c8218]{top:100px;left:500px;width:62px;opacity:0;animation-name:cloudRight-128c8218;animation-duration:2s;animation-timing-function:linear;animation-delay:1s;animation-fill-mode:forwards}@keyframes cloudLeft-128c8218{0%{top:17px;left:220px;opacity:0}20%{top:33px;left:188px;opacity:1}80%{top:81px;left:92px;opacity:1}to{top:97px;left:60px;opacity:0}}@keyframes cloudMid-128c8218{0%{top:10px;left:420px;opacity:0}20%{top:40px;left:360px;opacity:1}70%{top:130px;left:180px;opacity:1}to{top:160px;left:120px;opacity:0}}@keyframes cloudRight-128c8218{0%{top:100px;left:500px;opacity:0}20%{top:120px;left:460px;opacity:1}80%{top:180px;left:340px;opacity:1}to{top:200px;left:300px;opacity:0}}.page-container .bullshit[data-v-128c8218]{width:300px;padding:30px 0;overflow:hidden}.page-container .bullshit__oops[data-v-128c8218]{margin-bottom:20px;font-size:32px;font-weight:700;line-height:40px;color:#1482f0;opacity:0;animation-name:slideUp-128c8218;animation-duration:.5s;animation-fill-mode:forwards}.page-container .bullshit__headline[data-v-128c8218]{margin-bottom:10px;font-size:20px;font-weight:700;line-height:24px;color:#222;opacity:0;animation-name:slideUp-128c8218;animation-duration:.5s;animation-delay:.1s;animation-fill-mode:forwards}.page-container .bullshit__info[data-v-128c8218]{margin-bottom:30px;font-size:13px;line-height:21px;color:gray;opacity:0;animation-name:slideUp-128c8218;animation-duration:.5s;animation-delay:.2s;animation-fill-mode:forwards}.page-container .bullshit__return-home[data-v-128c8218]{display:block;float:left;width:110px;height:36px;font-size:14px;line-height:36px;color:#fff;text-align:center;cursor:pointer;background:#1482f0;border-radius:100px;opacity:0;animation-name:slideUp-128c8218;animation-duration:.5s;animation-delay:.3s;animation-fill-mode:forwards}@keyframes slideUp-128c8218{0%{opacity:0;transform:translateY(60px)}to{opacity:1;transform:translateY(0)}}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +0,0 @@
|
|||
import{g as v,c as a,o as f,n as s,a as t,p as e,q as l,i as c}from"./vendor-BkJtItE3.js";import{_ as d}from"./index-Cu3qqaMR.js";const i="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJgAAACKCAMAAABhAnODAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAMAUExURUdwTPf6/v////f6/v////////////z9//////////////////7+//v///f6/v////f5/vz///////////////j6/vf7/v////////////v8//////j7/v7+//////////////////////////////////////v8/+nx/fv9//b6/vr7/v////f5/vj7//////j7/vj7//f5/vD2/f///////////////+jy/P////////j6//////f6/v////f7/vj6/vf6/vL3/f////////j7/vv8//////3///f6/vf6/vb6/v////r8//f7/fL3/P///////////+jw/PT4/v3+//////////////7+//b6/v///////+jx/P///+jy/f////f6/uz0/eny/PT9/+jx/PT4/uz0/f////f6/vb6/vv9//z9//////3+//r8//f6/vj7/+ny/P////f6/////////+jw/Pf6/v////f6/vj7/v////f6/fT4//j7//b7//////b6/evy/P///+vz/P////////T3/v///+jx/P3+/////+nx+/f6/v///////+jw/Pj6/v///+nx/P///+vz/P////////////j7/vj7//H2/P///+zz/Pb6/v////////////P3/v39/////+/1/v///+jx++jx/Pj6/unx/ff6/+fx/Pf6/+jx/Ony/Ojx/Pz+//H3/v////7+//b6/vj8//7+//b5/v////b6/uz0/ff6/fj6//v8//j5/fb7//////v9/vn8//v8//f5//f6/vP3/Ojx/ez0/u31/v////f5/f///////////+z0/Pz9/+rz/+nw++30/Or0/fj//+jx/f////////f7//v9/+fw++nw/f////b4/v///+jw/f////P4/vj//+fz+/r8/u/2/unw//////f5/fb6/vb7//////b6/f3+//////L3/vr9/+/1/fT3/ff7/v////n8/vf6/v///+fw+/b5/fP4/f////T4/lxP5j4AAAD6dFJOUwD+9P3lAfb9pvsC/BIO+gnmDM3h7/PtBMLqvPn0NU5AId3+gajrK8T0Fc2/29/S4sXC47/4W8ho+psHMMD8GLvN97nyGfG++h74yMsGbJ/Dddjx5L5E1t/XN9PUjvzo7dHh2uge/sLBtdjs7r/s48rW08bFtMrE8NxS2cAKpy18c2OR0SPPiCnLvv35mdS9bV7z1Tlbl8woy7ToVMuw1c+63qLFM3zOD9i20N+6+GSqT5pLvOfb0Uifrn/ux5e3z4s7G41QVlrEvnzMx7GCaYXt4vw+icDeJG0alHj2jGl56FB5rcAmQfXBInOF13KSlNCEtNSBpOo946pl6lljAAAF7ElEQVR42u3ceVQTRxwH8AVCyk0gUAhKqwFRFAKIgALhEgS5WlBUsCCHCNJntYBCDQL6tGKtVbxqRUXrgYp4lko98BZ7n/a+Sy97X7QO62uRPHgBdjeTzcxm+l6+/2f4PDKZ3+zsb5eiMOdyw8UAZ9/I87VXqx0oQmJ/qfb2eFojkoDUmuvuNgZFvXf9lyQ7mjlnk5bVeBnA1JRRU15Cc+Xwr0CUIKjJqvpo6kYTThQd7S8FPZkl2DfqffKHp+JobZEEpAN1yuzxm5LdU5b50hBRLJSD/rxihRWVcO2K/1QYFG3XkQYG5ElsKNuU1PE0ZLrGycDgnMEFe4GmzSQKf5UqcamW2bVo9ATAkOV4XLWafzpufqIqUjU2j2HxUvo7AuZY34fDdUnJOJPyolTtRwIU2/tWjXvdpIA14k0Ylgct06srK6C9PbLDbTLgyoKnka+lkTBTXukHtEQaixj2KtRvcSHQmlxbpK7TJjCujQAia5IRuuaWwLicR8HAgKc5MpdLItQXeQHAZT8y2ApUE0wdC1SuBiiXxFRo2NdxMC6TGUBgmL0C6h82GggNS4VyLbUUGnYUyhU9EwgMC4tG/UUigv3lC7PmJwHBYd2FzUW/H8ni3k2XyAwAU6dia0xM0lk2WDAwGKw32fnfnepg2JapgIFh6sx5KXDej5o7al9TMmC9mZh/rrNRXRHscgFBMHUKDjyQJHED5MF6s5ZU2D1GmBFmhBlhRpgR9n+FiUV9sbAiCobkJBszDHiQCgOvkQqTP0YoDEy4n1AYSA8jFAZEIwiFAR9vQmFgmwOhMLCbVJilEWaEGWGQ2bS1nkCY/XLHno8oAle1EAVbeeWN/r1wVOC6bDJgVieL5QM/6pR482ChoWE2t0Yyfly292azAWH72sQcQzzSWTTNELDkIIhD+9bpRQXCwhJeh73HIf/jVGmFULCMndY6jRZ/IeZcPXaY7fo0PiOKy+VYYV5bTHkN6LMYAHwwl2vh/IaTlskBPljsGRG/wXKWWAJUkQ1h/e0Zz28oJ1cxMpbpb02DWBFtfjyHCk9Hxhr289Crt9u0WRRXIxrbUK6jkLGs2xh6d0+rWzkO62aTl4mQscBXqxmmfVV/M2uPDbo/IXgPOtZud8Zl4uKAFpjnoWyOaehYwSznPGFDuiGz3EZyDzU7Fx1r9hdse0HGprBHOWw+29Cx9mxgPRdOYe2udfNhGsovWI6M9VyKC2vRvszVfDV/ymCbDOEy7/RZFXd/Mnd7k6YN5TIvfryJa+91FaJjp3JKq3oo18nIWPEfRnDuCR0g28wrx7UOW7IAGUv+rLZTzRWw7e+0MgfdT3Gn1mda9imhYf8gY63J1H452wjtckbFWpwBceX4E7SLfhgNawbU/Y+5w6FdXUhY0g1wt//K4f9haxGwZOsh274b4F3b9Wel74c9w2+SQLvsECzz8E9wnRdu5sdv+QD+PC7TDNoVp+cyb7FSl9Z8hVAzP9xdp3PVj+BdJXotXLo+ghRTAusy0WcjGKJz30J3y8s3JJhnvqkHj8d37x61PbFqep5W11TeV7CTIvS5lbzrRiU37GOermdW690V8G7nIuS7Ckd+LQFD7g0VzMtiWdZ4XRHNDOL/yNHQ1um9jUo0a6vTrVDE3U1jdowd1K9vxuMw6SH9nmtma+o+UKe5SftW5/LjOYKicMDuLiK76vqugaMxlx/db4zm1/UWhrcwlx9ed2zf3PH5cNzlh9+t5O7uf3GXH76wO7jLD3YY3/KDGca//GCFSYPMKQJhTg+GUhR5MH3LDyaY/uUHD8zVnaIIhM3C8gIGvWE5IdjeP6IPDFn5YUo9b5j1pFgKY6o2H5rIC1aM/2VFNp+WFuoKQ1t+OA47v1ynCwx1+eFM9TvNkDD05UdLzN8+MUc7DEf5gTgtO35sDCcMT/mBisPmQ9msMNdMypDxfr+UEYat/OiQ7188OBiWE+JCEZGwT6ZpwMQexLw7j6KsvjlRoYZhLj88Enr8WEv3nWIvisDYdv5JGdOf/wBvCt5Mksy8ZAAAAABJRU5ErkJggg==",n={class:"page-container"},A={class:"bullshit"},j=d(v({__name:"404",setup(v){const d=l();return(v,l)=>(f(),a("div",n,[l[2]||(l[2]=s('<div class="pic-404" data-v-128c8218><img alt="404" class="pic-404__parent" src="/static/png/404-D6_y3Jr2.png" data-v-128c8218><img alt="404" class="pic-404__child left" src="'+i+'" data-v-128c8218><img alt="404" class="pic-404__child mid" src="'+i+'" data-v-128c8218><img alt="404" class="pic-404__child right" src="'+i+'" data-v-128c8218></div>',1)),t("div",A,[l[1]||(l[1]=s('<div class="bullshit__oops" data-v-128c8218>OOPS!</div><div class="bullshit__info" data-v-128c8218> All rights reserved <a href="https://wallstreetcn.com" style="color:#20a0ff;" target="_blank" data-v-128c8218>wallstreetcn</a></div><div class="bullshit__headline" data-v-128c8218>The webmaster said that you can not enter this page...</div><div class="bullshit__info" data-v-128c8218> Please check that the URL you entered is correct, or click the button below to return to the homepage. </div>',4)),t("a",{class:"bullshit__return-home",href:"/",onClick:l[0]||(l[0]=e((v=>c(d).replace("/")),["prevent"]))}," Back to home ")])]))}}),[["__scopeId","data-v-128c8218"]]);export{j as default};
|
|
@ -1 +0,0 @@
|
|||
import{g as a,A as e,q as s,c as r,o as t}from"./vendor-BkJtItE3.js";const o=a({__name:"index",setup(a){const o=e(),p=s(),{params:n,query:u}=o,{path:c}=n;return p.replace({path:"/"+c,query:u}),(a,e)=>(t(),r("div"))}});export{o as default};
|
File diff suppressed because one or more lines are too long
|
@ -1,2 +0,0 @@
|
|||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/js/404-CevxQWvM.js","static/js/vendor-BkJtItE3.js","static/css/vendor-D-laMJ-n.css","static/css/404-XvabTZcV.css","static/js/index-BpUqUWfK.js","static/js/index-DPBlXgzE.js","static/js/table-4Oe8H9vJ.js","static/js/index-CQCEdnrc.js"])))=>i.map(i=>d[i]);
|
||||
import{c as e,o as t,a as n,b as r,r as o,d as s,e as a,f as i,g as c,u as l,h as d,i as u,N as m,w as p,j as f,k as h,T as _,l as y,m as v}from"./vendor-BkJtItE3.js";!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),"use-credentials"===e.crossOrigin?t.credentials="include":"anonymous"===e.crossOrigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();const E={},g=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const e=document.querySelector("meta[property=csp-nonce]"),n=(null==e?void 0:e.nonce)||(null==e?void 0:e.getAttribute("nonce"));r=Promise.allSettled(t.map((e=>{if((e=function(e){return"/"+e}(e))in E)return;E[e]=!0;const t=e.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${e}"]${r}`))return;const o=document.createElement("link");return o.rel=t?"stylesheet":"modulepreload",t||(o.as="script"),o.crossOrigin="",o.href=e,n&&o.setAttribute("nonce",n),document.head.appendChild(o),t?new Promise(((t,n)=>{o.addEventListener("load",t),o.addEventListener("error",(()=>n(new Error(`Unable to preload CSS for ${e}`))))})):void 0})))}function o(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then((t=>{for(const e of t||[])"rejected"===e.status&&o(e.reason);return e().catch(o)}))},w=[{path:"/error",component:()=>g((()=>import("./404-CevxQWvM.js")),__vite__mapDeps([0,1,2,3])),meta:{hidden:!0}}],P=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n},b={class:"container m-auto"},L={class:"container mx-auto"};const O=P({},[["render",function(s,a){const i=o("router-view");return t(),e("div",b,[a[0]||(a[0]=n("h1",{class:"mt-4 text-center font-bold font-size-[22px] c-primary"},"代码生成器",-1)),n("main",L,[r(i)]),a[1]||(a[1]=n("footer",{class:"my-4 text-center"},[n("p",null,"© 2025 Bunny.保留所有权利.")],-1))])}]]),x=[...[{path:"/redirect",component:O,meta:{hidden:!0},children:[{path:"/redirect/:path(.*)",component:()=>g((()=>import("./index-BpUqUWfK.js")),__vite__mapDeps([4,1,2]))}]}],...[{path:"/",name:"/",component:O,redirect:"/home",meta:{transition:"fade"},children:[{path:"/home",name:"home",component:()=>g((()=>import("./index-DPBlXgzE.js")),__vite__mapDeps([5,6,1,2]))},{path:"/generator-code",name:"generatorCode",component:()=>g((()=>import("./index-CQCEdnrc.js")),__vite__mapDeps([7,1,2,6]))}]}],...w],A=s({history:a(),routes:x,scrollBehavior:()=>({left:0,top:0,behavior:"smooth"})}),j=i();const k={install(e){(e=>{e.use(A)})(e),function(e){e.use(j)}(e)}};const S=P(c({setup(){window.$message=l()}}),[["render",function(e,t,n,r,o,s){return" "}]]);v(c({__name:"App",setup:e=>(e,n)=>{const s=o("router-view");return t(),d(u(m),null,{default:p((()=>[r(u(f),null,{default:p((()=>[r(S),r(u(h),null,{default:p((()=>[r(s,null,{default:p((({Component:e,route:n})=>[r(_,{name:n.meta.transition||"fade-transform",mode:"out-in"},{default:p((()=>[(t(),d(y(e),{key:n.path}))])),_:2},1032,["name"])])),_:1})])),_:1})])),_:1})])),_:1})}})).use(k).mount("#app");export{P as _};
|
|
@ -1 +0,0 @@
|
|||
import{u as e}from"./table-4Oe8H9vJ.js";import{q as t,b as a,s as l,g as n,t as r,c as i,o as s,w as c,i as o,v as u,x as d,F as m,a as f,y as p,z as y}from"./vendor-BkJtItE3.js";function b(){const e=t(),n=t=>{e.replace({path:"/generator-code",query:{tableName:t.tableName}}).then()};return[{title:"序号",key:"no",titleAlign:"center",align:"center",render:(e,t)=>t+1},{title:"数据库名称",key:"tableCat",titleAlign:"center",align:"center",render:e=>a(l,{type:"primary"},{default:()=>[e.tableCat]})},{title:"表类型",key:"tableType",titleAlign:"center",align:"center",render:e=>a(l,null,{default:()=>[e.tableType]})},{title:"表名",key:"tableName",titleAlign:"center",align:"center",render:e=>a(l,{type:"info",onClick:()=>n(e)},{default:()=>[e.tableName]})},{title:"注释内容",key:"comment",titleAlign:"center",align:"center",render:e=>a(l,{type:"info",onClick:()=>n(e)},{default:()=>[e.comment]})}]}const g={class:"mt-2"},k=n({__name:"index",setup(t){const n=e();return r((()=>{n.getAllTableMetaData()})),(e,t)=>(s(),i(m,null,[a(o(u),{class:"my-2",title:"提示"},{default:c((()=>[f("p",null,[t[2]||(t[2]=p(" 点击 ")),a(o(l),null,{default:c((()=>t[0]||(t[0]=[p("表名")]))),_:1}),t[3]||(t[3]=p(" 或 ")),a(o(l),null,{default:c((()=>t[1]||(t[1]=[p("注释内容")]))),_:1}),t[4]||(t[4]=p(" 跳转 "))]),f("p",g,[t[5]||(t[5]=p(" 数据库共 ")),a(o(l),{type:"info"},{default:c((()=>[p(y(o(n).tableList.length),1)])),_:1}),t[6]||(t[6]=p(" 张表 "))])])),_:1}),a(o(d),{bordered:!0,columns:o(b)(),data:o(n).tableList},null,8,["columns","data"])],64))}});export{k as default};
|
|
@ -1 +0,0 @@
|
|||
var e=(e,t,a)=>new Promise(((r,s)=>{var o=e=>{try{l(a.next(e))}catch(t){s(t)}},n=e=>{try{l(a.throw(e))}catch(t){s(t)}},l=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,n);l((a=a.apply(e,t)).next())}));import{Z as t,_ as a,C as r}from"./vendor-BkJtItE3.js";const s=t.create({baseURL:"/api",timeout:5e4,headers:{"Content-Type":"application/json;charset=utf-8"},paramsSerializer:e=>a.stringify(e)});s.interceptors.request.use((e=>{const t=localStorage.getItem("accessToken");return t&&(e.headers.Authorization=t),e}),(e=>Promise.reject(e))),s.interceptors.response.use((e=>"blob"===e.config.responseType||"arraybuffer"===e.config.responseType?e:200===e.status?e.data:Promise.reject(e.data.message||"Error")),(e=>(e.response.data,Promise.reject(e.message))));const o=r("tableStore",{state:()=>({tableList:[]}),getters:{},actions:{getAllTableMetaData(){return e(this,null,(function*(){const e=yield s({url:"/table/getAllTableMetaData",method:"get"});200!==e.code&&window.$message.error(e.message),this.tableList=e.data}))},getTableMetaData(t){return e(this,null,(function*(){const e=yield(a={tableName:t},s({url:"/table/getTableMetaData",method:"get",params:a}));var a;return 200!==e.code?(window.$message.error(e.message),{}):e.data}))},getColumnInfo(t){return e(this,null,(function*(){const e=yield(a={tableName:t},s({url:"/table/getColumnInfo",method:"get",params:a}));var a;return 200!==e.code?(window.$message.error(e.message),{}):e.data}))}}});export{s,o as u};
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
|
@ -1,16 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8"/>
|
||||
<link href="/favicon.ico" rel="icon" type="image/svg+xml"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<title>代码生成器</title>
|
||||
<script type="module" crossorigin src="/static/js/index-Cu3qqaMR.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/static/js/vendor-BkJtItE3.js">
|
||||
<link rel="stylesheet" crossorigin href="/static/css/vendor-D-laMJ-n.css">
|
||||
<link rel="stylesheet" crossorigin href="/static/css/index-pFzuzMch.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,65 +0,0 @@
|
|||
package ${package}.controller;
|
||||
|
||||
import cn.bunny.dao.pojo.result.Result;
|
||||
import cn.bunny.dao.pojo.result.ResultCodeEnum;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${comment}表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Tag(name = "${comment}", description = "${comment}相关接口" )
|
||||
@RestController
|
||||
@RequestMapping("${requestMapping}/${classLowercaseName}" )
|
||||
public class ${classUppercaseName}Controller {
|
||||
|
||||
@Autowired
|
||||
private ${classUppercaseName}Service ${classLowercaseName}Service;
|
||||
|
||||
@Operation(summary = "分页查询${comment}", description = "分页查询${comment}" )
|
||||
@GetMapping("get${classUppercaseName}List/{page}/{limit}" )
|
||||
public Result<PageResult<${classUppercaseName}Vo>> get${classUppercaseName}List(
|
||||
@Parameter(name = "page", description = "当前页", required = true)
|
||||
@PathVariable("page" ) Integer page,
|
||||
@Parameter(name = "limit", description = "每页记录数", required = true)
|
||||
@PathVariable("limit" ) Integer limit,
|
||||
${classUppercaseName}Dto dto) {
|
||||
Page<${classUppercaseName}> pageParams = new Page<>(page, limit);
|
||||
PageResult<${classUppercaseName}Vo> pageResult = ${classLowercaseName}Service.get${classUppercaseName}List(pageParams, dto);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@Operation(summary = "添加${comment}", description = "添加${comment}" )
|
||||
@PostMapping("add${classUppercaseName}" )
|
||||
public Result<String> add${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}AddDto dto) {
|
||||
${classLowercaseName}Service.add${classUppercaseName}(dto);
|
||||
return Result.success(ResultCodeEnum.ADD_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "更新${comment}", description = "更新${comment}" )
|
||||
@PutMapping("update${classUppercaseName}" )
|
||||
public Result<String> update${classUppercaseName}(@Valid @RequestBody ${classUppercaseName}UpdateDto dto) {
|
||||
${classLowercaseName}Service.update${classUppercaseName}(dto);
|
||||
return Result.success(ResultCodeEnum.UPDATE_SUCCESS);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除${comment}", description = "删除${comment}" )
|
||||
@DeleteMapping("delete${classUppercaseName}" )
|
||||
public Result<String> delete${classUppercaseName}(@RequestBody List<Long> ids) {
|
||||
${classLowercaseName}Service.delete${classUppercaseName}(ids);
|
||||
return Result.success(ResultCodeEnum.DELETE_SUCCESS);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package ${package}.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${comment} Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author ${author}
|
||||
* @since ${date}
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${classUppercaseName}Mapper extends BaseMapper<${classUppercaseName}> {
|
||||
|
||||
/**
|
||||
* * 分页查询${comment}内容
|
||||
*
|
||||
* @param pageParams ${comment}分页参数
|
||||
* @param dto ${comment}查询表单
|
||||
* @return ${comment}分页结果
|
||||
*/
|
||||
IPage<${classUppercaseName}Vo> selectListByPage(@Param("page" ) Page<${classUppercaseName}> pageParams, @Param("dto" ) ${classUppercaseName}Dto dto);
|
||||
|
||||
/**
|
||||
* 物理删除${comment}
|
||||
*
|
||||
* @param ids 删除 id 列表
|
||||
*/
|
||||
void deleteBatchIdsWithPhysics(List<Long> ids);
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="${package}.mapper.${classUppercaseName}Mapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="${classUppercaseName}">
|
||||
#foreach($field in ${columnInfoList})
|
||||
<id column="${field.column}" property="${field.fieldName}"/>
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
${baseColumnList}
|
||||
</sql>
|
||||
|
||||
<!-- 分页查询${comment}内容 -->
|
||||
<select id="selectListByPage" resultType="${voClassType}">
|
||||
select
|
||||
base.*,
|
||||
create_user.username as create_username,
|
||||
update_user.username as update_username
|
||||
from $tableName base
|
||||
left join sys_user create_user on create_user.id = base.create_user
|
||||
left join sys_user update_user on update_user.id = base.update_user
|
||||
<where>
|
||||
base.is_deleted = 0
|
||||
#foreach($field in $columnInfoList)
|
||||
<if test="dto.${field.fieldName} != null and dto.${field.fieldName} != ''">
|
||||
and base.${field.columnName} like CONCAT('%',#{dto.${field.fieldName}},'%')
|
||||
</if>
|
||||
#end
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 物理删除${comment} -->
|
||||
<delete id="deleteBatchIdsWithPhysics">
|
||||
delete from ${tableName}
|
||||
where id in
|
||||
<foreach collection="ids" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
|
@ -1,49 +0,0 @@
|
|||
package ${package}.service;
|
||||
|
||||
import cn.bunny.dao.entity.system.MenuIcon;
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${comment} 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since ${date}
|
||||
*/
|
||||
public interface ${classUppercaseName}Service extends IService<${classUppercaseName}> {
|
||||
|
||||
/**
|
||||
* * 获取${comment}列表
|
||||
*
|
||||
* @return ${comment}返回列表
|
||||
*/
|
||||
PageResult<${classUppercaseName}Vo> get${classUppercaseName}List(Page<${classUppercaseName}> pageParams, ${classUppercaseName}Dto dto);
|
||||
|
||||
/**
|
||||
* * 添加${comment}
|
||||
*
|
||||
* @param dto 添加表单
|
||||
*/
|
||||
void add${classUppercaseName}(@Valid ${classUppercaseName}AddDto dto);
|
||||
|
||||
/**
|
||||
* * 更新${comment}
|
||||
*
|
||||
* @param dto 更新表单
|
||||
*/
|
||||
void update${classUppercaseName}(@Valid ${classUppercaseName}UpdateDto dto);
|
||||
|
||||
/**
|
||||
* * 删除|批量删除${comment}类型
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
void delete${classUppercaseName}(List<Long> ids);
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
package ${package}.service.impl;
|
||||
|
||||
import cn.bunny.dao.pojo.result.PageResult;
|
||||
import ${package}.mapper.${classUppercaseName}Mapper;
|
||||
import ${package}.service.${classUppercaseName}Service;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* ${comment} 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since ${date}
|
||||
*/
|
||||
@Service
|
||||
public class ${classUppercaseName}ServiceImpl extends ServiceImpl<${classUppercaseName}Mapper, ${classUppercaseName}> implements ${classUppercaseName}Service {
|
||||
|
||||
/**
|
||||
* * ${comment} 服务实现类
|
||||
*
|
||||
* @param pageParams ${comment}分页查询page对象
|
||||
* @param dto ${comment}分页查询对象
|
||||
* @return 查询分页${comment}返回对象
|
||||
*/
|
||||
@Override
|
||||
public PageResult<${classUppercaseName}Vo> get${classUppercaseName}List(Page<${classUppercaseName}> pageParams, ${classUppercaseName}Dto dto) {
|
||||
IPage<${classUppercaseName}Vo> page = baseMapper.selectListByPage(pageParams, dto);
|
||||
|
||||
return PageResult.<${classUppercaseName}Vo>builder()
|
||||
.list(page.getRecords())
|
||||
.pageNo(page.getCurrent())
|
||||
.pageSize(page.getSize())
|
||||
.total(page.getTotal())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加${comment}
|
||||
*
|
||||
* @param dto ${comment}添加
|
||||
*/
|
||||
@Override
|
||||
public void add${classUppercaseName}(@Valid ${classUppercaseName}AddDto dto) {
|
||||
// 保存数据
|
||||
${classUppercaseName} ${classLowercaseName} =new ${classUppercaseName}();
|
||||
BeanUtils.copyProperties(dto, ${classLowercaseName});
|
||||
save(${classLowercaseName});
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新${comment}
|
||||
*
|
||||
* @param dto ${comment}更新
|
||||
*/
|
||||
@Override
|
||||
public void update${classUppercaseName}(@Valid ${classUppercaseName}UpdateDto dto) {
|
||||
// 更新内容
|
||||
${classUppercaseName} ${classLowercaseName} =new ${classUppercaseName}();
|
||||
BeanUtils.copyProperties(dto, ${classLowercaseName});
|
||||
updateById(${classLowercaseName});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除|批量删除${comment}
|
||||
*
|
||||
* @param ids 删除id列表
|
||||
*/
|
||||
@Override
|
||||
public void delete${classUppercaseName}(List<Long> ids) {
|
||||
baseMapper.deleteBatchIdsWithPhysics(ids);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
import {http} from '@/api/service/request';
|
||||
import type {BaseResult, ResultTable} from '@/api/service/types';
|
||||
|
||||
/** ${comment}---获取${comment}列表 */
|
||||
export const fetchGet${classUppercaseName}List = (data: any) => {
|
||||
return http.request<BaseResult<ResultTable>>('get', `${classLowercaseName}/get${classUppercaseName}List/${data.currentPage}/${data.pageSize}`, {params: data});
|
||||
};
|
||||
|
||||
/** ${comment}---添加${comment} */
|
||||
export const fetchAdd${classUppercaseName} = (data: any) => {
|
||||
return http.request<BaseResult<any>>('post', '${classLowercaseName}/add${classUppercaseName}', {data});
|
||||
};
|
||||
|
||||
/** ${comment}---更新${comment} */
|
||||
export const fetchUpdate${classUppercaseName} = (data: any) => {
|
||||
return http.request<BaseResult<any>>('put', '${classLowercaseName}/update${classUppercaseName}', {data});
|
||||
};
|
||||
|
||||
/** ${comment}---删除${comment} */
|
||||
export const fetchDelete${classUppercaseName} = (data: any) => {
|
||||
return http.request<BaseResult<any>>('delete', '${classLowercaseName}/delete${classUppercaseName}', {data});
|
||||
};
|
|
@ -1,31 +0,0 @@
|
|||
import {reactive} from 'vue';
|
||||
import type {FormRules} from 'element-plus';
|
||||
import { $t } from '@/plugins/i18n';
|
||||
|
||||
export const columns: TableColumnList = [
|
||||
{type: 'selection', align: 'left'},
|
||||
{type: 'index', index: (index: number) => index + 1, label: '序号', width: 60},
|
||||
#foreach($field in $columnInfoList)
|
||||
// $field.comment
|
||||
{label: $t('$field.fieldName'), prop: '$field.fieldName'},
|
||||
#end
|
||||
{label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160},
|
||||
{label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160},
|
||||
{label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130},
|
||||
{label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 130},
|
||||
{label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation'},
|
||||
];
|
||||
|
||||
// 添加规则
|
||||
export const rules = reactive < FormRules > ({
|
||||
#foreach($field in $columnInfoList)
|
||||
// $field.comment
|
||||
$field.fieldName: [{
|
||||
required: true,
|
||||
message: `$leftBrace$t('input')}$leftBrace$t('${field.fieldName}')}`,
|
||||
trigger: 'blur'
|
||||
}],
|
||||
#end
|
||||
});
|
||||
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import {ref} from 'vue';
|
||||
import {FormInstance} from 'element-plus';
|
||||
import {FormProps} from '';
|
||||
|
||||
const props = withDefaults(defineProps<FormProps>(), {
|
||||
formInline: () => ({
|
||||
#foreach($item in $columnInfoList)
|
||||
#if(${item.fieldName})
|
||||
// $!{item.comment}
|
||||
${item.fieldName}: undefined,
|
||||
#end
|
||||
#end
|
||||
}),
|
||||
});
|
||||
|
||||
const formRef = ref<FormInstance>();
|
||||
const form = ref(props.formInline);
|
||||
|
||||
defineExpose({formRef});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="auto">
|
||||
#foreach($item in $columnInfoList)
|
||||
|
||||
<!-- $item.comment -->
|
||||
<el-form-item :label="$t('${item.fieldName}')" prop="$item.fieldName">
|
||||
<el-input v-model="form.$item.fieldName" autocomplete="off" type="text"
|
||||
:placeholder="$t('input') + $t('${item.fieldName}')"/>
|
||||
</el-form-item>
|
||||
#end
|
||||
</el-form>
|
||||
</template>
|
|
@ -1,124 +0,0 @@
|
|||
import {addDialog} from '@/components/BaseDialog/index';
|
||||
import {h, ref} from 'vue';
|
||||
import {message, messageBox} from '@/utils/message';
|
||||
import DeleteBatchDialog from "@/components/Table/DeleteBatchDialog.vue";
|
||||
|
||||
export const formRef = ref();
|
||||
// 删除ids
|
||||
export const deleteIds = ref([]);
|
||||
const ${classLowercaseName}Store = use${classUppercaseName}Store();
|
||||
|
||||
/** 搜索初始化${comment} */
|
||||
export async function onSearch() {
|
||||
${classLowercaseName}Store.loading = true;
|
||||
await ${classLowercaseName}Store.get${classUppercaseName}List();
|
||||
${classLowercaseName}Store.loading = false;
|
||||
}
|
||||
|
||||
/** 添加${comment} */
|
||||
export function onAdd() {
|
||||
addDialog({
|
||||
title: `$leftBrace $t("addNew")}$leftBrace$t("${classLowercaseName}")}`,
|
||||
width: '30%',
|
||||
props: {
|
||||
formInline: {
|
||||
#foreach($item in $columnInfoList)
|
||||
$!{item.fieldName}: undefined,
|
||||
#end
|
||||
},
|
||||
},
|
||||
draggable: true,
|
||||
fullscreenIcon: true,
|
||||
closeOnClickModal: false,
|
||||
contentRenderer: () => h(${classUppercaseName}Dialog, {ref: formRef}),
|
||||
beforeSure: (done, {options}) => {
|
||||
const form = options.props.formInline as FormItemProps;
|
||||
formRef.value.formRef.validate(async (valid: any) => {
|
||||
if (!valid) return;
|
||||
|
||||
const result = await ${classLowercaseName}Store.add${classUppercaseName}(form);
|
||||
if (!result) return;
|
||||
done();
|
||||
await onSearch();
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 更新${comment} */
|
||||
export function onUpdate(row: any) {
|
||||
addDialog({
|
||||
title: `$leftBrace$t("modify")}$leftBrace$t("${classLowercaseName}")}`,
|
||||
width: '30%',
|
||||
props: {
|
||||
formInline: {
|
||||
#foreach($item in $columnInfoList)
|
||||
$!{item.fieldName}: row.$!{item.fieldName},
|
||||
#end
|
||||
}
|
||||
},
|
||||
draggable: true,
|
||||
fullscreenIcon: true,
|
||||
closeOnClickModal: false,
|
||||
contentRenderer: () => h(${classUppercaseName}Dialog, {ref: formRef}),
|
||||
beforeSure: (done, {options}) => {
|
||||
const form = options.props.formInline as FormItemProps;
|
||||
formRef.value.formRef.validate(async (valid: any) => {
|
||||
if (!valid) return;
|
||||
|
||||
const result = await ${classLowercaseName}Store.update${classUppercaseName}({...form, id: row.id});
|
||||
if (!result) return;
|
||||
done();
|
||||
await onSearch();
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除${comment} */
|
||||
export const onDelete = async (row: any) => {
|
||||
const id = row.id;
|
||||
|
||||
// 是否确认删除
|
||||
const result = await messageBox({
|
||||
title: $t('confirmDelete'),
|
||||
showMessage: false,
|
||||
confirmMessage: undefined,
|
||||
cancelMessage: $t("cancel_delete"),
|
||||
});
|
||||
if (!result) return;
|
||||
|
||||
// 删除数据
|
||||
await ${classLowercaseName}Store.delete${classUppercaseName}([id]);
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
/** 批量删除 */
|
||||
export const onDeleteBatch = async () => {
|
||||
const ids = deleteIds.value;
|
||||
const formDeletedBatchRef = ref();
|
||||
|
||||
addDialog({
|
||||
title: $t('deleteBatchTip'),
|
||||
width: '30%',
|
||||
props: {formInline: {confirmText: ''}},
|
||||
draggable: true,
|
||||
fullscreenIcon: true,
|
||||
closeOnClickModal: false,
|
||||
contentRenderer: () => h(DeleteBatchDialog, {ref: formDeletedBatchRef}),
|
||||
beforeSure: (done, {options}) => {
|
||||
formDeletedBatchRef.value.formDeletedBatchRef.validate(async (valid: any) => {
|
||||
if (!valid) return;
|
||||
|
||||
const text = options.props.formInline.confirmText.toLowerCase();
|
||||
if (text === 'yes' || text === 'y') {
|
||||
// 删除数据
|
||||
await ${classLowercaseName}Store.delete${classUppercaseName}(ids);
|
||||
await onSearch();
|
||||
|
||||
done();
|
||||
} else message($t('deleteBatchTip'), {type: 'warning'});
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
|
@ -1,127 +0,0 @@
|
|||
<script lang="ts" setup>
|
||||
import {onMounted, ref} from 'vue';
|
||||
import {deleteIds, onSearch} from '';
|
||||
import {FormInstance} from "element-plus";
|
||||
|
||||
const tableRef = ref();
|
||||
const formRef = ref();
|
||||
const ${classLowercaseName}Store = use${classUppercaseName}Store();
|
||||
|
||||
/** 当前页改变时 */
|
||||
const onCurrentPageChange = async (value: number) => {
|
||||
${classLowercaseName}Store.pagination.currentPage = value;
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
/** 当分页发生变化 */
|
||||
const onPageSizeChange = async (value: number) => {
|
||||
${classLowercaseName}Store.pagination.pageSize = value;
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
/** 选择多行 */
|
||||
const onSelectionChange = (rows: Array<any>) => {
|
||||
deleteIds.value = rows.map((row: any) => row.id);
|
||||
};
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
await onSearch();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
onSearch();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="main">
|
||||
<el-form ref="formRef" :inline="true" :model="${classLowercaseName}Store.form"
|
||||
class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto">
|
||||
#foreach($item in $columnInfoList)
|
||||
|
||||
<!-- $item.comment -->
|
||||
<el-form-item :label="$t('${item.fieldName}')" prop="${item.fieldName}">
|
||||
<el-input v-model="${classLowercaseName}Store.form.${item.fieldName}"
|
||||
:placeholder="`$leftBrace$t('input')}$leftBrace$t('${item.fieldName}')}`"
|
||||
class="!w-[180px]" clearable/>
|
||||
</el-form-item>
|
||||
#end
|
||||
<el-form-item>
|
||||
<el-button :icon="useRenderIcon('ri:search-line')" :loading="${classLowercaseName}Store.loading" type="primary"
|
||||
@click="onSearch"> {{ $t('search')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)"> {{ $t('buttons.reset') }}</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<PureTableBar :columns="columns" title="${classDescription}" @fullscreen="tableRef.setAdaptive()"
|
||||
@refresh="onSearch">
|
||||
<template #buttons>
|
||||
<el-button :icon="useRenderIcon(AddFill)" type="primary" @click="onAdd"> {{ $t('addNew') }}</el-button>
|
||||
|
||||
<!-- 批量删除按钮 -->
|
||||
<el-button v-show="deleteIds.length > 0" :icon="useRenderIcon(Delete)" type="danger" @click="onDeleteBatch">
|
||||
{{ $t('delete_batches') }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template v-slot="{ size, dynamicColumns }">
|
||||
<pure-table
|
||||
ref="tableRef"
|
||||
:adaptiveConfig="{ offsetBottom: 96 }"
|
||||
:columns="dynamicColumns"
|
||||
:data="${classLowercaseName}Store.datalist"
|
||||
:header-cell-style="{ background: 'var(--el-fill-color-light)', color: 'var(--el-text-color-primary)' }"
|
||||
:loading="${classLowercaseName}Store.loading"
|
||||
:size="size"
|
||||
adaptive
|
||||
align-whole="center"
|
||||
border
|
||||
highlight-current-row
|
||||
row-key="id"
|
||||
showOverflowTooltip
|
||||
table-layout="auto"
|
||||
:pagination="${classLowercaseName}Store.pagination"
|
||||
@page-size-change="onPageSizeChange"
|
||||
@selection-change="onSelectionChange"
|
||||
@page-current-change="onCurrentPageChange"
|
||||
>
|
||||
|
||||
<template #createUser="{ row }">
|
||||
<el-button v-show="row.createUser" link type="primary" @click="selectUserinfo(row.createUser)">
|
||||
{{ row.createUsername }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #updateUser="{ row }">
|
||||
<el-button v-show="row.updateUser" link type="primary" @click="selectUserinfo(row.updateUser)">
|
||||
{{ row.updateUsername }}
|
||||
</el-button>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button :icon="useRenderIcon(EditPen)" :size="size" class="reset-margin" link type="primary"
|
||||
@click="onUpdate(row)"> {{ $t('modify')
|
||||
}}
|
||||
</el-button>
|
||||
<el-button :icon="useRenderIcon(AddFill)" :size="size" class="reset-margin" link type="primary"
|
||||
@click="onAdd"> {{ $t('addNew') }}
|
||||
</el-button>
|
||||
<!-- TODO 待完成 -->
|
||||
<el-popconfirm :title="`${leftBrace}$t('delete')}${row.email}?`" @confirm="onDelete(row)">
|
||||
<template #reference>
|
||||
<el-button :icon="useRenderIcon(Delete)" :size="size" class="reset-margin" link type="primary">
|
||||
{{ $t('delete') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</pure-table>
|
||||
</template>
|
||||
</PureTableBar>
|
||||
</div>
|
||||
</template>
|
|
@ -1,69 +0,0 @@
|
|||
import {defineStore} from 'pinia';
|
||||
import {fetchAdd${classUppercaseName}, fetchDelete${classUppercaseName}, fetchUpdate${classUppercaseName}} from '';
|
||||
import {pageSizes} from '@/enums/baseConstant';
|
||||
import {storeMessage} from '@/utils/message';
|
||||
import {storePagination} from '@/store/useStorePagination';
|
||||
|
||||
/**
|
||||
* ${comment} Store
|
||||
*/
|
||||
export const use${classUppercaseName}Store = defineStore('${lowercaseName}Store', {
|
||||
state() {
|
||||
return {
|
||||
// ${comment}列表
|
||||
datalist: [],
|
||||
// 查询表单
|
||||
form: {
|
||||
#foreach($item in $columnInfoList)
|
||||
// $!{item.comment}
|
||||
$!{item.fieldName}: undefined,
|
||||
#end
|
||||
},
|
||||
// 分页查询结果
|
||||
pagination: {
|
||||
currentPage: 1,
|
||||
pageSize: 30,
|
||||
total: 1,
|
||||
pageSizes,
|
||||
},
|
||||
// 加载
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
getters: {},
|
||||
actions: {
|
||||
/** 获取${comment} */
|
||||
async get${classUppercaseName}List() {
|
||||
// 整理请求参数
|
||||
const data = {...this.pagination, ...this.form};
|
||||
delete data.pageSizes;
|
||||
delete data.total;
|
||||
delete data.background;
|
||||
|
||||
// 获取${comment}列表
|
||||
const result = await fetchGet${classUppercaseName}List(data);
|
||||
|
||||
// 公共页面函数hook
|
||||
const pagination = storePagination.bind(this);
|
||||
return pagination(result);
|
||||
},
|
||||
|
||||
/** 添加${comment} */
|
||||
async add${classUppercaseName}(data: any) {
|
||||
const result = await fetchAdd${classUppercaseName}(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
|
||||
/** 修改${comment} */
|
||||
async update${classUppercaseName}(data: any) {
|
||||
const result = await fetchUpdate${classUppercaseName}(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
|
||||
/** 删除${comment} */
|
||||
async delete${classUppercaseName}(data: any) {
|
||||
const result = await fetchDelete${classUppercaseName}(data);
|
||||
return storeMessage(result);
|
||||
},
|
||||
},
|
||||
});
|
|
@ -1,16 +0,0 @@
|
|||
// 添加或者修改表单元素
|
||||
export interface FormItemProps {
|
||||
#foreach($field in $columnInfoList)
|
||||
// $field.comment
|
||||
#if($field.javascriptType == "object")
|
||||
$field.fieldName: any
|
||||
#else
|
||||
$field.fieldName: $field.javascriptType
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
||||
// 添加或修改表单Props
|
||||
export interface FormProps {
|
||||
formInline: FormItemProps;
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
package cn.bunny;
|
||||
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.entity.TableMetaData;
|
||||
import cn.bunny.utils.ConvertUtil;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
public class JDBCTest {
|
||||
|
||||
DatabaseMetaData metaData;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
metaData = connection.getMetaData();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testComment() throws SQLException {
|
||||
String tableName = "sys_i18n";
|
||||
TableMetaData tableMetaData;
|
||||
ResultSet tables = metaData.getTables(null, null, tableName, new String[]{"TABLE"});
|
||||
|
||||
// 获取表的注释信息
|
||||
if (tables.next()) {
|
||||
String remarks = tables.getString("REMARKS" );
|
||||
String tableCat = tables.getString("TABLE_CAT" );
|
||||
String tableSchem = tables.getString("TABLE_SCHEM" );
|
||||
String tableType = tables.getString("TABLE_TYPE" );
|
||||
String typeCat = tables.getString("TYPE_CAT" );
|
||||
String typeSchem = tables.getString("TYPE_SCHEM" );
|
||||
String typeName = tables.getString("TYPE_NAME" );
|
||||
String selfReferencingColName = tables.getString("SELF_REFERENCING_COL_NAME" );
|
||||
String refGeneration = tables.getString("REF_GENERATION" );
|
||||
|
||||
tableMetaData = TableMetaData.builder()
|
||||
.tableName(tableName)
|
||||
.comment(remarks)
|
||||
.tableCat(tableCat)
|
||||
.tableSchem(tableSchem)
|
||||
.tableType(tableType)
|
||||
.typeCat(typeCat)
|
||||
.typeSchem(typeSchem)
|
||||
.typeName(typeName)
|
||||
.selfReferencingColName(selfReferencingColName)
|
||||
.refGeneration(refGeneration)
|
||||
.build();
|
||||
|
||||
System.out.println(tableMetaData);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testAllTableComment() throws SQLException {
|
||||
ResultSet tables = metaData.getTables(null, null, "%" , new String[]{"TABLE"});
|
||||
List<TableMetaData> list = new ArrayList<>();
|
||||
|
||||
while (tables.next()) {
|
||||
String tableName = tables.getString("TABLE_NAME" );
|
||||
String remarks = tables.getString("REMARKS" );
|
||||
String tableCat = tables.getString("TABLE_CAT" );
|
||||
String tableSchem = tables.getString("TABLE_SCHEM" );
|
||||
String tableType = tables.getString("TABLE_TYPE" );
|
||||
String typeCat = tables.getString("TYPE_CAT" );
|
||||
String typeSchem = tables.getString("TYPE_SCHEM" );
|
||||
String typeName = tables.getString("TYPE_NAME" );
|
||||
String selfReferencingColName = tables.getString("SELF_REFERENCING_COL_NAME" );
|
||||
String refGeneration = tables.getString("REF_GENERATION" );
|
||||
|
||||
TableMetaData tableMetaData = TableMetaData.builder()
|
||||
.tableName(tableName).comment(remarks)
|
||||
.tableCat(tableCat)
|
||||
.tableSchem(tableSchem)
|
||||
.tableType(tableType)
|
||||
.typeCat(typeCat)
|
||||
.typeSchem(typeSchem)
|
||||
.typeName(typeName)
|
||||
.selfReferencingColName(selfReferencingColName)
|
||||
.refGeneration(refGeneration)
|
||||
.build();
|
||||
list.add(tableMetaData);
|
||||
}
|
||||
|
||||
System.out.println(list);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testColumnInfo() throws SQLException {
|
||||
List<ColumnMetaData> columns = new ArrayList<>();
|
||||
|
||||
try (ResultSet columnsRs = metaData.getColumns(null, null, "sys_i18n" , null)) {
|
||||
while (columnsRs.next()) {
|
||||
ColumnMetaData column = new ColumnMetaData();
|
||||
column.setColumnName(columnsRs.getString("COLUMN_NAME" ));
|
||||
column.setFieldName(ConvertUtil.convertToFieldName(column.getColumnName()));
|
||||
column.setJdbcType(columnsRs.getString("TYPE_NAME" ));
|
||||
column.setJavaType(ConvertUtil.convertToJavaType(column.getJdbcType()));
|
||||
column.setComment(columnsRs.getString("REMARKS" ));
|
||||
|
||||
columns.add(column);
|
||||
System.out.println(column);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(columns);
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package cn.bunny.service.impl;
|
||||
|
||||
import cn.bunny.dao.vo.VmsPathVo;
|
||||
import cn.bunny.utils.ResourceFileUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class VmsServiceImplTest {
|
||||
|
||||
|
||||
@Test
|
||||
void getVmsPathList() throws IOException, URISyntaxException {
|
||||
List<String> vmsFiles = ResourceFileUtil.getAbsoluteFiles("vms");
|
||||
System.out.println(vmsFiles);
|
||||
|
||||
System.out.println("--------------------------------------------------------------");
|
||||
|
||||
List<String> vmsRelativeFiles = ResourceFileUtil.getRelativeFiles("vms");
|
||||
System.out.println(vmsRelativeFiles);
|
||||
|
||||
System.out.println("--------------------------集合对象模式------------------------------------");
|
||||
|
||||
Map<String, List<VmsPathVo>> map = vmsRelativeFiles.stream().map(vmFile -> {
|
||||
String[] filepathList = vmFile.split("/");
|
||||
String filename = filepathList[filepathList.length - 1].replace(".vm", "");
|
||||
|
||||
return VmsPathVo.builder().name(vmFile).label(filename).type(filepathList[0]).build();
|
||||
}).collect(Collectors.groupingBy(VmsPathVo::getType));
|
||||
|
||||
System.out.println(JSON.toJSONString(map));
|
||||
|
||||
System.out.println("----------------------------二维数组格式----------------------------------");
|
||||
List<List<VmsPathVo>> listMap = vmsRelativeFiles.stream().map(vmFile -> {
|
||||
String[] filepathList = vmFile.split("/");
|
||||
String filename = filepathList[filepathList.length - 1].replace(".vm", "");
|
||||
|
||||
return VmsPathVo.builder().name(vmFile).label(filename).type(filepathList[0]).build();
|
||||
})
|
||||
.collect(Collectors.groupingBy(VmsPathVo::getType))
|
||||
.values().stream().toList();
|
||||
|
||||
System.out.println(JSON.toJSONString(listMap));
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package cn.bunny.utils;
|
||||
|
||||
import cn.bunny.dao.entity.ColumnMetaData;
|
||||
import cn.bunny.dao.entity.TableMetaData;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootTest
|
||||
class DbInfoUtilTest {
|
||||
|
||||
String tableName = "sys_i18n";
|
||||
|
||||
@Autowired
|
||||
private DbInfoUtil dbInfoUtil;
|
||||
|
||||
@Test
|
||||
void tableInfo() throws SQLException {
|
||||
TableMetaData tableMetaData = dbInfoUtil.tableInfo(tableName);
|
||||
System.out.println(tableMetaData);
|
||||
}
|
||||
|
||||
@Test
|
||||
void columnInfo() throws SQLException {
|
||||
List<ColumnMetaData> columnMetaDataList = dbInfoUtil.columnInfo(tableName);
|
||||
columnMetaDataList.forEach(System.out::println);
|
||||
}
|
||||
|
||||
@Test
|
||||
void dbInfo() throws SQLException {
|
||||
TableMetaData tableMetaData = dbInfoUtil.dbInfo(tableName);
|
||||
System.out.println(tableMetaData);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,38 @@
|
|||
<name>common Maven Webapp</name>
|
||||
<url>https://maven.apache.org</url>
|
||||
<modules>
|
||||
<module>generator-code</module>
|
||||
<module>generator-v1</module>
|
||||
<!-- <module>service-utils</module> -->
|
||||
<module>common-generator</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.bunny</groupId>
|
||||
<artifactId>dao</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
<!-- hutool -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql连接驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- mysql连接池 -->
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
12
pom.xml
12
pom.xml
|
@ -19,7 +19,6 @@
|
|||
<module>common</module>
|
||||
<module>dao</module>
|
||||
<module>service</module>
|
||||
<module>common/generator-code</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
@ -28,7 +27,7 @@
|
|||
<java.version>17</java.version>
|
||||
<junit.version>3.8.1</junit.version>
|
||||
<mybatis-plus.version>3.5.6</mybatis-plus.version>
|
||||
<mysql.version>9.2.0</mysql.version>
|
||||
<mysql.version>8.0.33</mysql.version>
|
||||
<knife4j.version>4.5.0</knife4j.version>
|
||||
<fastjson2.version>2.0.47</fastjson2.version>
|
||||
<minio.version>8.5.17</minio.version>
|
||||
|
@ -72,14 +71,9 @@
|
|||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
<!-- mysql -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>com.mysql</groupId> -->
|
||||
<!-- <artifactId>mysql-connector-java</artifactId> -->
|
||||
<!-- <version>${mysql.version}</version> -->
|
||||
<!-- </dependency> -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
<!-- mysql连接池 -->
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -118,9 +119,14 @@
|
|||
|
||||
<!-- mysql连接驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- 多数据库源插件 -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>com.baomidou</groupId> -->
|
||||
<!-- <artifactId>dynamic-datasource-spring-boot3-starter</artifactId> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
Loading…
Reference in New Issue