diff --git a/kenaito-config-service/src/main/java/cn/odboy/constant/RegexConst.java b/kenaito-config-service/src/main/java/cn/odboy/constant/RegexConst.java
index 6646876..1daf560 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/constant/RegexConst.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/constant/RegexConst.java
@@ -7,8 +7,9 @@ package cn.odboy.constant;
* @date 2024-09-13
*/
public interface RegexConst {
- // 正则表达式,用于匹配中国大陆手机号码
- String PHONE_NUMBER = "^1[3-9]\\d{9}$";
- // 小写字母和下划线
- String LOW_CHAR_LINE = "^[a-z_]+$";
+ /** 正则表达式,用于匹配中国大陆手机号码 */
+ String PHONE_NUMBER = "^1[3-9]\\d{9}$";
+
+ /** 小写字母和下划线 */
+ String LOW_CHAR_LINE = "^[a-z_]+$";
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
index bc3d251..6c05f46 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigApp.java
@@ -1,17 +1,19 @@
package cn.odboy.domain;
-import cn.odboy.base.MyObject;
+import cn.odboy.base.MyLogicEntity;
+import cn.odboy.base.MyNormalEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import lombok.Data;
import lombok.Getter;
import lombok.Setter;
/**
- *
* 配置应用
- *
*
* @author odboy
* @since 2024-12-05
@@ -19,18 +21,46 @@ import lombok.Setter;
@Getter
@Setter
@TableName("config_app")
-public class ConfigApp extends MyObject {
+public class ConfigApp extends MyNormalEntity {
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
- /**
- * 应用名称
- */
- @TableField("app_name")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /** 应用名称 */
+ @TableField("app_name")
+ private String appName;
+
+ /** 应用说明 */
+ @TableField("description")
+ private String description;
+
+ @Data
+ public static class CreateArgs {
+ @NotBlank(message = "必填")
private String appName;
- /**
- * 应用说明
- */
- @TableField("description")
+
+ @NotBlank(message = "必填")
private String description;
+ }
+
+ @Data
+ public static class ModifyDescriptionArgs {
+ @NotNull(message = "必填")
+ private Long id;
+
+ @NotBlank(message = "必填")
+ private String description;
+ }
+
+ @Data
+ public static class RemoveArgs{
+ @NotNull(message = "必填")
+ private Long id;
+ }
+
+ @Data
+ public static class ClientInfo{
+ private String ip;
+ private Boolean isActive = false;
+ }
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigAppUser.java b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigAppUser.java
new file mode 100644
index 0000000..d3e6d05
--- /dev/null
+++ b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigAppUser.java
@@ -0,0 +1,25 @@
+package cn.odboy.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 配置应用与用户关联关系
+ *
+ * @author odboy
+ * @since 2024-12-06
+ */
+@Getter
+@Setter
+@TableName("config_app_user")
+public class ConfigAppUser {
+ /** 应用名称 */
+ @TableField("app_id")
+ private Long appId;
+
+ /** 应用名称 */
+ @TableField("user_id")
+ private Long userId;
+}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigFile.java b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigFile.java
index f0824dd..4ad962b 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigFile.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigFile.java
@@ -1,18 +1,21 @@
package cn.odboy.domain;
-import cn.odboy.base.MyObject;
+import cn.odboy.base.MyNormalEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
+
+import javax.mail.Multipart;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
+import org.springframework.web.multipart.MultipartFile;
/**
- *
* 配置文件
- *
*
* @author odboy
* @since 2024-12-05
@@ -20,26 +23,51 @@ import lombok.Setter;
@Getter
@Setter
@TableName("config_file")
-public class ConfigFile extends MyObject {
+public class ConfigFile extends MyNormalEntity {
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
- @TableField("app_name")
- private String appName;
+ /** configAppId */
+ @TableField("app_id")
+ private Long appId;
- @TableField("env")
+ /** 环境编码 */
+ @TableField("env")
+ private String env;
+
+ /** 例如: application-daily.properties */
+ @TableField("file_name")
+ private String fileName;
+
+ /** 当前配置内容版本 */
+ @TableField("version")
+ private Long version;
+
+ @Data
+ public static class CreateArgs {
+ @NotNull(message = "必填")
+ private Long appId;
+
+ @NotBlank(message = "必填")
private String env;
- /**
- * 例如: application-daily.properties
- */
- @TableField("file_name")
- private String fileName;
+ @NotNull(message = "必填")
+ private MultipartFile file;
+ }
- /**
- * 当前配置内容版本
- */
- @TableField("version")
- private Long version;
+ @Data
+ public static class ModifyFileContentArgs {
+ @NotNull(message = "必填")
+ private Long id;
+
+ @NotBlank(message = "必填")
+ private String fileContent;
+ }
+
+ @Data
+ public class RemoveArgs {
+ @NotNull(message = "必填")
+ private Long id;
+ }
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigVersion.java b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigVersion.java
index bd4df12..c1434fa 100644
--- a/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigVersion.java
+++ b/kenaito-config-service/src/main/java/cn/odboy/domain/ConfigVersion.java
@@ -1,17 +1,13 @@
package cn.odboy.domain;
import cn.odboy.base.MyObject;
-import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Getter;
import lombok.Setter;
/**
- *
* 配置内容版本
- *
*
* @author odboy
* @since 2024-12-05
@@ -20,9 +16,15 @@ import lombok.Setter;
@Setter
@TableName("config_version")
public class ConfigVersion extends MyObject {
- @TableField("file_id")
- private Long fileId;
+ /** 文件id */
+ @TableField("file_id")
+ private Long fileId;
- @TableField("file_content")
- private byte[] fileContent;
+ /** 配置文件内容 */
+ @TableField("file_content")
+ private String fileContent;
+
+ /** 配置文件内容版本 */
+ @TableField("version")
+ private Long version;
}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/mapper/ConfigVersionMapper.java b/kenaito-config-service/src/main/java/cn/odboy/mapper/ConfigVersionMapper.java
new file mode 100644
index 0000000..40625f9
--- /dev/null
+++ b/kenaito-config-service/src/main/java/cn/odboy/mapper/ConfigVersionMapper.java
@@ -0,0 +1,14 @@
+package cn.odboy.mapper;
+
+import cn.odboy.domain.ConfigVersion;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 配置版本 Mapper 接口
+ *
+ * @author odboy
+ * @since 2024-12-05
+ */
+@Mapper
+public interface ConfigVersionMapper extends BaseMapper {}
diff --git a/kenaito-config-service/src/main/java/cn/odboy/rest/ConfigAppController.java b/kenaito-config-service/src/main/java/cn/odboy/rest/ConfigAppController.java
new file mode 100644
index 0000000..26d6b84
--- /dev/null
+++ b/kenaito-config-service/src/main/java/cn/odboy/rest/ConfigAppController.java
@@ -0,0 +1,58 @@
+package cn.odboy.rest;
+
+import cn.odboy.base.model.SelectOption;
+import cn.odboy.domain.ConfigApp;
+import cn.odboy.infra.exception.BadRequestException;
+import cn.odboy.infra.netty.ConfigClientManage;
+import cn.odboy.infra.response.PageArgs;
+import cn.odboy.infra.response.PageResult;
+import cn.odboy.infra.rest.AnonymousAccess;
+import cn.odboy.modules.system.domain.User;
+import cn.odboy.modules.system.domain.vo.UserQueryCriteria;
+import cn.odboy.service.ConfigAppService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.RequiredArgsConstructor;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * 配置文件 前端控制器
+ *
+ * @author odboy
+ * @since 2024-12-05
+ */
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/api/config/app")
+public class ConfigAppController {
+ private final ConfigAppService configAppService;
+
+ @PostMapping("/create")
+ public ResponseEntity