功能管理
This commit is contained in:
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
131
pom.xml
Normal file
131
pom.xml
Normal file
@@ -0,0 +1,131 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
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>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.5.9</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.cczsa.xinghe.codegen</groupId>
|
||||
<artifactId>xinghe-codegen</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mybatis-flex.version>1.11.5</mybatis-flex.version>
|
||||
<swagger.annotations.version>2.2.19</swagger.annotations.version>
|
||||
<knife4j-gateway-spring-boot-starter.version>4.4.0</knife4j-gateway-spring-boot-starter.version>
|
||||
<fastjson2.version>2.0.57</fastjson2.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<!--排除tomcat依赖-->
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis-flex-->
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<version>${mybatis-flex.version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>com.mybatis-flex</groupId>-->
|
||||
<!-- <artifactId>mybatis-flex-processor</artifactId>-->
|
||||
<!-- <version>${mybatis-flex.version}</version>-->
|
||||
<!-- <scope>provided</scope>-->
|
||||
<!-- </dependency>-->
|
||||
<!--springboot数据库连接池-->
|
||||
<dependency>
|
||||
<groupId>org.hibernate.orm</groupId>
|
||||
<artifactId>hibernate-hikaricp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>${swagger.annotations.version}</version>
|
||||
</dependency>
|
||||
<!-- fastjson2 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>${fastjson2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-gateway-spring-boot-starter.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.cczsa.xinghe.codegen;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CodegenApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CodegenApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunItemService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 功能管理 控制层。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Tag(name = "功能管理")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/funItem")
|
||||
public class FunItemController {
|
||||
|
||||
private final FunItemService funitemService;
|
||||
|
||||
|
||||
@PostMapping("/query")
|
||||
public XResult<FunItemQueryRes> query(@RequestBody @Valid FunItemQueryReq req ) {
|
||||
return funitemService.query(req);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "创建/修改功能", description = "创建/修改功能")
|
||||
@PostMapping("/save/update")
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunItemSaveUpdateReq req ) {
|
||||
return funitemService.saveUpdate(req);
|
||||
}
|
||||
|
||||
|
||||
@Operation(summary = "删除功能", description = "删除功能")
|
||||
@DeleteMapping("/delete")
|
||||
public XResult<Void> delete() {
|
||||
return funitemService.delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunModuleService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 模块管理 控制层。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Tag(name = "模块管理")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/funModule")
|
||||
public class FunModuleController {
|
||||
|
||||
private final FunModuleService funmoduleService;
|
||||
|
||||
@Operation(summary = "获取模块列表", description = "获取模块列表")
|
||||
@PostMapping("/query")
|
||||
public XResult<FunModuleQueryRes> query(@RequestBody @Valid FunModuleQueryReq req ) {
|
||||
return funmoduleService.query(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "创建/修改模块", description = "创建/修改模块")
|
||||
@PostMapping("/save/update")
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunModuleSaveUpdateReq req ) {
|
||||
return funmoduleService.saveUpdate(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除模块", description = "删除模块")
|
||||
@DeleteMapping("/delete")
|
||||
public XResult<Void> delete() {
|
||||
return funmoduleService.delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.cczsa.xinghe.codegen.controller;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunOperationService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 操作管理 控制层。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Tag(name = "操作管理")
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/funOperation")
|
||||
public class FunOperationController {
|
||||
|
||||
private final FunOperationService funoperationService;
|
||||
|
||||
@Operation(summary = "获取操作列表", description = "获取操作列表")
|
||||
@PostMapping("/query")
|
||||
public XResult<FunOperationQueryRes> query(@RequestBody @Valid FunOperationQueryReq req ) {
|
||||
return funoperationService.query(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "创建/修改操作", description = "创建/修改操作")
|
||||
@PostMapping("/save/update")
|
||||
public XResult<Void> saveUpdate(@RequestBody @Valid FunOperationSaveUpdateReq req ) {
|
||||
return funoperationService.saveUpdate(req);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除操作", description = "删除操作")
|
||||
@DeleteMapping("/delete")
|
||||
public XResult<Void> delete() {
|
||||
return funoperationService.delete();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.cczsa.xinghe.codegen.entity;
|
||||
|
||||
/**
|
||||
* 基类监听器
|
||||
* @author xia
|
||||
* @date 2025/9/17
|
||||
* @version 0.0.1
|
||||
*/
|
||||
public class BaseEntity {
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.cczsa.xinghe.codegen.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 功能 实体类。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("cg_fun_item")
|
||||
public class FunItemEntity extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模块ID
|
||||
*/
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 功能名称
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
/**
|
||||
* 功能编码
|
||||
*/
|
||||
private String itemCode;
|
||||
|
||||
/**
|
||||
* 是否租户
|
||||
*/
|
||||
private Boolean isTenant;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.cczsa.xinghe.codegen.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 模块 实体类。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("cg_fun_module")
|
||||
public class FunModuleEntity extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
private String moduleName;
|
||||
|
||||
/**
|
||||
* 模块编码
|
||||
*/
|
||||
private String moduleCode;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 包名称
|
||||
*/
|
||||
private String packageName;
|
||||
|
||||
/**
|
||||
* 参数包名
|
||||
*/
|
||||
private String apiPackageName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.cczsa.xinghe.codegen.entity;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.enums.FunTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.entity.enums.RequestTypeEnum;
|
||||
import com.cczsa.xinghe.codegen.handler.PostgreSQLJsonTypeHandler;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 操作 实体类。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Table("cg_fun_operation")
|
||||
public class FunOperationEntity extends BaseEntity implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模块ID
|
||||
*/
|
||||
private Long moduleId;
|
||||
|
||||
/**
|
||||
* 功能ID
|
||||
*/
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 直接放行
|
||||
*/
|
||||
private Boolean isGreenLight;
|
||||
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
private String funName;
|
||||
|
||||
/**
|
||||
* 操作编码
|
||||
*/
|
||||
private String operationCode;
|
||||
|
||||
/**
|
||||
* 操作类型>>查>>改>>删>>增
|
||||
*/
|
||||
private FunTypeEnum funType;
|
||||
|
||||
/**
|
||||
* 请求类型
|
||||
*/
|
||||
private RequestTypeEnum requestType;
|
||||
|
||||
/**
|
||||
* 可配置数据类型json[]
|
||||
*/
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<Integer> usableConfig;
|
||||
|
||||
/**
|
||||
* 可配置字段
|
||||
*/
|
||||
@Column(typeHandler = PostgreSQLJsonTypeHandler.class)
|
||||
private List<String> fieldCofnig;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
private String describe;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.cczsa.xinghe.codegen.entity.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.mybatisflex.annotation.EnumValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 操作类型枚举
|
||||
* @author My
|
||||
*/
|
||||
@Schema(description = "绑定操作类型",
|
||||
example = "0",
|
||||
allowableValues = {"0: 新增", "1: 删除", "2: 修改", "3: 查询",
|
||||
"4: 上传", "5: 下载", "6: 导入", "7: 导出", "8: 打印",
|
||||
"9: 注册", "10: 登录", "11: 登出",
|
||||
"12: 短信", "13: 邮件", "14: 微信",
|
||||
"99: 其它"
|
||||
})
|
||||
@Getter
|
||||
public enum FunTypeEnum {
|
||||
// 基本数据操作
|
||||
ADD(0,"新增"),
|
||||
DELETE(1,"删除"),
|
||||
EDIT(2,"修改"),
|
||||
QUERY(3,"查询"),
|
||||
|
||||
// 文件相关操作
|
||||
UPLOAD(4,"上传"),
|
||||
DOWNLOAD(5,"下载"),
|
||||
IMPORT(6,"导入"),
|
||||
EXPORT(7,"导出"),
|
||||
PRINT(8,"打印"),
|
||||
|
||||
// 用户认证相关
|
||||
REGISTER(9,"注册"),
|
||||
LOGIN(10,"登录"),
|
||||
LOGOUT(11,"登出"),
|
||||
|
||||
// 通知和通信
|
||||
SMS(12,"短信"),
|
||||
EMAIL(13,"邮件"),
|
||||
WECHAT(14,"微信"),
|
||||
|
||||
|
||||
// 其它
|
||||
OTHER(99,"其它")
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
FunTypeEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
@EnumValue
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.cczsa.xinghe.codegen.entity.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import com.mybatisflex.annotation.EnumValue;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 请求类型枚举
|
||||
*
|
||||
* @author My
|
||||
*/
|
||||
@Schema(description = "HTTP请求类型",
|
||||
example = "0",
|
||||
allowableValues = {"0: GET", "1: HEAD", "2: POST", "3: PUT",
|
||||
"4: PATCH", "5: DELETE", "6: OPTIONS", "7: TRACE"
|
||||
})
|
||||
@Getter
|
||||
public enum RequestTypeEnum {
|
||||
|
||||
GET(0, "GET"),
|
||||
HEAD(1, "HEAD"),
|
||||
POST(2, "POST"),
|
||||
PUT(3, "PUT"),
|
||||
PATCH(4, "PATCH"),
|
||||
DELETE(5, "DELETE"),
|
||||
OPTIONS(6, "OPTIONS"),
|
||||
TRACE(7, "TRACE");
|
||||
|
||||
private final int code;
|
||||
private final String desc;
|
||||
|
||||
RequestTypeEnum(int code, String desc) {
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
@EnumValue
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取功能列表 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取功能列表-参数")
|
||||
public class FunItemQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建/修改功能 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "创建/修改功能-参数")
|
||||
public class FunItemSaveUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funModule;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取模块列表 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取模块列表-参数")
|
||||
public class FunModuleQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funModule;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建/修改模块 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "创建/修改模块-参数")
|
||||
public class FunModuleSaveUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取操作列表 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取操作列表-参数")
|
||||
public class FunOperationQueryReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.req.funOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建/修改操作 请求参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "创建/修改操作-参数")
|
||||
public class FunOperationSaveUpdateReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.res.funItem;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取功能列表 响应参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取功能列表-响应")
|
||||
public class FunItemQueryRes implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.res.funModule;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取模块列表 响应参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取模块列表-响应")
|
||||
public class FunModuleQueryRes implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.cczsa.xinghe.codegen.entity.res.funOperation;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 获取操作列表 响应参数
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "获取操作列表-响应")
|
||||
public class FunOperationQueryRes implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.cczsa.xinghe.codegen.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.util.ParameterizedTypeImpl;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* @author xia
|
||||
* @date 2025/9/20
|
||||
* @version 0.0.1
|
||||
*/
|
||||
public class PostgreSQLJsonTypeHandler<T> extends BaseTypeHandler<T> {
|
||||
private final Class<T> type;
|
||||
private Class<T> genericType;
|
||||
|
||||
public PostgreSQLJsonTypeHandler(Class<T> type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public PostgreSQLJsonTypeHandler(Class<T> type, Class<T> genericType) {
|
||||
this.type = type;
|
||||
this.genericType = genericType;
|
||||
}
|
||||
|
||||
private T parseJson(String json) {
|
||||
if (genericType != null) {
|
||||
return JSON.parseObject(json, new ParameterizedTypeImpl(type,genericType));
|
||||
}
|
||||
return JSON.parseObject(json, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {
|
||||
PGobject pgObject = new PGobject();
|
||||
pgObject.setType("json"); // 或 "jsonb",根据你的数据库字段类型调整
|
||||
pgObject.setValue(JSON.toJSONString(parameter));
|
||||
ps.setObject(i, pgObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
String json = rs.getString(columnName);
|
||||
return parseJson(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
String json = rs.getString(columnIndex);
|
||||
return parseJson(json);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
String json = cs.getString(columnIndex);
|
||||
return parseJson(json);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cczsa.xinghe.codegen.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cczsa.xinghe.codegen.entity.FunItemEntity;
|
||||
|
||||
/**
|
||||
* 功能 映射层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Mapper
|
||||
public interface FunItemMapper extends BaseMapper<FunItemEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cczsa.xinghe.codegen.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cczsa.xinghe.codegen.entity.FunModuleEntity;
|
||||
|
||||
/**
|
||||
* 模块 映射层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Mapper
|
||||
public interface FunModuleMapper extends BaseMapper<FunModuleEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.cczsa.xinghe.codegen.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.cczsa.xinghe.codegen.entity.FunOperationEntity;
|
||||
|
||||
/**
|
||||
* 操作 映射层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Mapper
|
||||
public interface FunOperationMapper extends BaseMapper<FunOperationEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.cczsa.xinghe.codegen.mapper.def;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 功能 表定义层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public class FunItemDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 功能
|
||||
*/
|
||||
public static final FunItemDef FUN_ITEM_ENTITY = new FunItemDef();
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
public final QueryColumn DESCRIBE = new QueryColumn(this, "describe");
|
||||
|
||||
/**
|
||||
* 是否租户
|
||||
*/
|
||||
public final QueryColumn IS_TENANT = new QueryColumn(this, "is_tenant");
|
||||
|
||||
/**
|
||||
* 功能编码
|
||||
*/
|
||||
public final QueryColumn ITEM_CODE = new QueryColumn(this, "item_code");
|
||||
|
||||
/**
|
||||
* 功能名称
|
||||
*/
|
||||
public final QueryColumn ITEM_NAME = new QueryColumn(this, "item_name");
|
||||
|
||||
/**
|
||||
* 模块ID
|
||||
*/
|
||||
public final QueryColumn MODULE_ID = new QueryColumn(this, "module_id");
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
public final QueryColumn SORT_ORDER = new QueryColumn(this, "sort_order");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, MODULE_ID, ITEM_NAME, ITEM_CODE, IS_TENANT, DESCRIBE, SORT_ORDER};
|
||||
|
||||
public FunItemDef() {
|
||||
super("", "cg_fun_item");
|
||||
}
|
||||
|
||||
private FunItemDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public FunItemDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new FunItemDef("", "cg_fun_item", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.cczsa.xinghe.codegen.mapper.def;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 模块 表定义层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public class FunModuleDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 模块
|
||||
*/
|
||||
public static final FunModuleDef FUN_MODULE_ENTITY = new FunModuleDef();
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public final QueryColumn DESCRIBE = new QueryColumn(this, "describe");
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
public final QueryColumn SORT_ORDER = new QueryColumn(this, "sort_order");
|
||||
|
||||
/**
|
||||
* 模块编码
|
||||
*/
|
||||
public final QueryColumn MODULE_CODE = new QueryColumn(this, "module_code");
|
||||
|
||||
/**
|
||||
* 模块名称
|
||||
*/
|
||||
public final QueryColumn MODULE_NAME = new QueryColumn(this, "module_name");
|
||||
|
||||
/**
|
||||
* 包名称
|
||||
*/
|
||||
public final QueryColumn PACKAGE_NAME = new QueryColumn(this, "package_name");
|
||||
|
||||
/**
|
||||
* 参数包名
|
||||
*/
|
||||
public final QueryColumn API_PACKAGE_NAME = new QueryColumn(this, "api_package_name");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, MODULE_NAME, MODULE_CODE, DESCRIBE, PACKAGE_NAME, API_PACKAGE_NAME, SORT_ORDER};
|
||||
|
||||
public FunModuleDef() {
|
||||
super("", "cg_fun_module");
|
||||
}
|
||||
|
||||
private FunModuleDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public FunModuleDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new FunModuleDef("", "cg_fun_module", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.cczsa.xinghe.codegen.mapper.def;
|
||||
|
||||
import com.mybatisflex.core.query.QueryColumn;
|
||||
import com.mybatisflex.core.table.TableDef;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 操作 表定义层。
|
||||
*
|
||||
* @author My
|
||||
* @since 0.0.1
|
||||
*/
|
||||
public class FunOperationDef extends TableDef {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 操作
|
||||
*/
|
||||
public static final FunOperationDef FUN_OPERATION_ENTITY = new FunOperationDef();
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
public final QueryColumn ID = new QueryColumn(this, "id");
|
||||
|
||||
/**
|
||||
* 功能ID
|
||||
*/
|
||||
public final QueryColumn ITEM_ID = new QueryColumn(this, "item_id");
|
||||
|
||||
/**
|
||||
* 操作名称
|
||||
*/
|
||||
public final QueryColumn FUN_NAME = new QueryColumn(this, "fun_name");
|
||||
|
||||
/**
|
||||
* 操作类型>>查>>改>>删>>增
|
||||
*/
|
||||
public final QueryColumn FUN_TYPE = new QueryColumn(this, "fun_type");
|
||||
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
public final QueryColumn DESCRIBE = new QueryColumn(this, "describe");
|
||||
|
||||
/**
|
||||
* 模块ID
|
||||
*/
|
||||
public final QueryColumn MODULE_ID = new QueryColumn(this, "module_id");
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
public final QueryColumn SORT_ORDER = new QueryColumn(this, "sort_order");
|
||||
|
||||
/**
|
||||
* 可配置字段
|
||||
*/
|
||||
public final QueryColumn FIELD_COFNIG = new QueryColumn(this, "field_cofnig");
|
||||
|
||||
/**
|
||||
* 请求类型
|
||||
*/
|
||||
public final QueryColumn REQUEST_TYPE = new QueryColumn(this, "request_type");
|
||||
|
||||
/**
|
||||
* 直接放行
|
||||
*/
|
||||
public final QueryColumn IS_GREEN_LIGHT = new QueryColumn(this, "is_green_light");
|
||||
|
||||
/**
|
||||
* 可配置数据类型json[]
|
||||
*/
|
||||
public final QueryColumn USABLE_CONFIG = new QueryColumn(this, "usable_config");
|
||||
|
||||
/**
|
||||
* 操作编码
|
||||
*/
|
||||
public final QueryColumn OPERATION_CODE = new QueryColumn(this, "operation_code");
|
||||
|
||||
/**
|
||||
* 所有字段。
|
||||
*/
|
||||
public final QueryColumn ALL_COLUMNS = new QueryColumn(this, "*");
|
||||
|
||||
/**
|
||||
* 默认字段,不包含逻辑删除或者 large 等字段。
|
||||
*/
|
||||
public final QueryColumn[] DEFAULT_COLUMNS = new QueryColumn[]{ID, MODULE_ID, ITEM_ID, IS_GREEN_LIGHT, FUN_NAME, OPERATION_CODE, FUN_TYPE, REQUEST_TYPE, USABLE_CONFIG, FIELD_COFNIG, SORT_ORDER, DESCRIBE};
|
||||
|
||||
public FunOperationDef() {
|
||||
super("", "cg_fun_operation");
|
||||
}
|
||||
|
||||
private FunOperationDef(String schema, String name, String alisa) {
|
||||
super(schema, name, alisa);
|
||||
}
|
||||
|
||||
public FunOperationDef as(String alias) {
|
||||
String key = getNameWithSchema() + "." + alias;
|
||||
return getCache(key, k -> new FunOperationDef("", "cg_fun_operation", alias));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cczsa.xinghe.codegen.service;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
/**
|
||||
* 功能管理 服务层接口。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
public interface FunItemService {
|
||||
|
||||
/**
|
||||
* 获取功能列表
|
||||
*/
|
||||
XResult<FunItemQueryRes> query(FunItemQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建/修改功能
|
||||
*/
|
||||
XResult<Void> saveUpdate(FunItemSaveUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除功能
|
||||
*/
|
||||
XResult<Void> delete();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cczsa.xinghe.codegen.service;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
/**
|
||||
* 模块管理 服务层接口。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
public interface FunModuleService {
|
||||
|
||||
/**
|
||||
* 获取模块列表
|
||||
*/
|
||||
XResult<FunModuleQueryRes> query(FunModuleQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建/修改模块
|
||||
*/
|
||||
XResult<Void> saveUpdate(FunModuleSaveUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除模块
|
||||
*/
|
||||
XResult<Void> delete();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.cczsa.xinghe.codegen.service;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
|
||||
/**
|
||||
* 操作管理 服务层接口。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
public interface FunOperationService {
|
||||
|
||||
/**
|
||||
* 获取操作列表
|
||||
*/
|
||||
XResult<FunOperationQueryRes> query(FunOperationQueryReq req);
|
||||
|
||||
/**
|
||||
* 创建/修改操作
|
||||
*/
|
||||
XResult<Void> saveUpdate(FunOperationSaveUpdateReq req);
|
||||
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
XResult<Void> delete();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cczsa.xinghe.codegen.service.impl;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funItem.FunItemSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funItem.FunItemQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunItemService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 功能管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FunItemServiceImpl implements FunItemService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取功能列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<FunItemQueryRes> query(FunItemQueryReq req) {
|
||||
// TODO 实现 获取功能列表 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/修改功能
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunItemSaveUpdateReq req) {
|
||||
// TODO 实现 创建/修改功能 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除功能
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> delete() {
|
||||
// TODO 实现 删除功能 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cczsa.xinghe.codegen.service.impl;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funModule.FunModuleSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funModule.FunModuleQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunModuleService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 模块管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FunModuleServiceImpl implements FunModuleService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取模块列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<FunModuleQueryRes> query(FunModuleQueryReq req) {
|
||||
// TODO 实现 获取模块列表 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/修改模块
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunModuleSaveUpdateReq req) {
|
||||
// TODO 实现 创建/修改模块 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模块
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> delete() {
|
||||
// TODO 实现 删除模块 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cczsa.xinghe.codegen.service.impl;
|
||||
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationQueryReq;
|
||||
import com.cczsa.xinghe.codegen.entity.req.funOperation.FunOperationSaveUpdateReq;
|
||||
import com.cczsa.xinghe.codegen.entity.res.funOperation.FunOperationQueryRes;
|
||||
import com.cczsa.xinghe.codegen.service.FunOperationService;
|
||||
import com.cczsa.xinghe.codegen.util.XResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 操作管理 服务层实现。
|
||||
*
|
||||
* @author xia
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FunOperationServiceImpl implements FunOperationService {
|
||||
|
||||
|
||||
/**
|
||||
* 获取操作列表
|
||||
*/
|
||||
@Override
|
||||
public XResult<FunOperationQueryRes> query(FunOperationQueryReq req) {
|
||||
// TODO 实现 获取操作列表 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建/修改操作
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> saveUpdate(FunOperationSaveUpdateReq req) {
|
||||
// TODO 实现 创建/修改操作 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除操作
|
||||
*/
|
||||
@Override
|
||||
public XResult<Void> delete() {
|
||||
// TODO 实现 删除操作 业务逻辑
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
66
src/main/java/com/cczsa/xinghe/codegen/util/XResult.java
Normal file
66
src/main/java/com/cczsa/xinghe/codegen/util/XResult.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package com.cczsa.xinghe.codegen.util;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xia
|
||||
* @date 2025/9/9
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "响应")
|
||||
public class XResult<T> implements Serializable {
|
||||
|
||||
@Schema(description = "返回标记:成功标记200,其它标记失败")
|
||||
private int code;
|
||||
@Schema(description = "返回信息")
|
||||
private String msg;
|
||||
@Schema(description = "数据")
|
||||
private T data;
|
||||
|
||||
public XResult(int code, String msg, T data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static <T> XResult<T> ok() {
|
||||
return new XResult<>(XResultCode.SUCCEED.getCode(), XResultCode.SUCCEED.getMessage(),null);
|
||||
}
|
||||
public static <T> XResult<T> ok(T data) {
|
||||
return new XResult<>(XResultCode.SUCCEED.getCode(), XResultCode.SUCCEED.getMessage(), data);
|
||||
}
|
||||
|
||||
public static <T> XResult<T> ok(T data, String msg) {
|
||||
return new XResult<>(XResultCode.SUCCEED.getCode(), msg, data);
|
||||
}
|
||||
|
||||
|
||||
public static <T> XResult<T> failed() {
|
||||
return new XResult<>(XResultCode.FAILED.getCode(), XResultCode.FAILED.getMessage(), null);
|
||||
}
|
||||
|
||||
public static <T> XResult<T> failed(XResultCode resultCode) {
|
||||
return new XResult<>(resultCode.getCode(), resultCode.getMessage(), null);
|
||||
}
|
||||
public static <T> XResult<T> failed(XResultCode resultCode, String msg) {
|
||||
return new XResult<>(resultCode.getCode(), msg, null);
|
||||
}
|
||||
public static <T> XResult<T> failed(String msg) {
|
||||
return new XResult<>(XResultCode.FAILED.getCode(), msg, null);
|
||||
}
|
||||
|
||||
public static <T> XResult<T> failed(T data) {
|
||||
return new XResult<>(XResultCode.FAILED.getCode(), XResultCode.FAILED.getMessage(), data);
|
||||
}
|
||||
|
||||
// 链式调用支持
|
||||
public XResult<T> setData(T data) {
|
||||
this.data = data;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
24
src/main/java/com/cczsa/xinghe/codegen/util/XResultCode.java
Normal file
24
src/main/java/com/cczsa/xinghe/codegen/util/XResultCode.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.cczsa.xinghe.codegen.util;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author xia
|
||||
* @date 2025/9/9
|
||||
* @version 0.0.1
|
||||
*/
|
||||
@Getter
|
||||
public enum XResultCode {
|
||||
SUCCEED(200, "成功"),
|
||||
FAILED(400, "失败"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
XResultCode(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
18
src/main/resources/application.yml
Normal file
18
src/main/resources/application.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 7011
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:postgresql://192.168.1.40:5432/xinghe-codegen
|
||||
username: postgres
|
||||
password: root
|
||||
driver-class-name: org.postgresql.Driver
|
||||
type: com.zaxxer.hikari.HikariDataSource # 使用 HikariCP 作为连接池
|
||||
hikari:
|
||||
maximum-pool-size: 20
|
||||
minimum-idle: 5
|
||||
connection-timeout: 60000
|
||||
idle-timeout: 300000
|
||||
max-lifetime: 1200000
|
||||
validation-timeout: 5000
|
||||
leak-detection-threshold: 60000
|
||||
Reference in New Issue
Block a user