From fec982bfee859c01f4207764cd45dbb2f9e3ab1c Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:08:43 +0800 Subject: [PATCH 01/25] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/model/form/NoticeStatusForm.java | 26 -------------- .../system/model/query/NoticeStatusQuery.java | 36 ------------------- 2 files changed, 62 deletions(-) delete mode 100644 src/main/java/com/youlai/boot/system/model/form/NoticeStatusForm.java delete mode 100644 src/main/java/com/youlai/boot/system/model/query/NoticeStatusQuery.java diff --git a/src/main/java/com/youlai/boot/system/model/form/NoticeStatusForm.java b/src/main/java/com/youlai/boot/system/model/form/NoticeStatusForm.java deleted file mode 100644 index d53689aa..00000000 --- a/src/main/java/com/youlai/boot/system/model/form/NoticeStatusForm.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.youlai.system.model.form; - -import java.io.Serial; -import java.io.Serializable; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; -import java.time.LocalDateTime; -import jakarta.validation.constraints.*; - -/** - * 用户公告状态表单对象 - * - * @author youlaitech - * @since 2024-08-28 16:56 - */ -@Getter -@Setter -@Schema(description = "用户公告状态表单对象") -public class NoticeStatusForm implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - -} diff --git a/src/main/java/com/youlai/boot/system/model/query/NoticeStatusQuery.java b/src/main/java/com/youlai/boot/system/model/query/NoticeStatusQuery.java deleted file mode 100644 index cfc1d5be..00000000 --- a/src/main/java/com/youlai/boot/system/model/query/NoticeStatusQuery.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.youlai.boot.system.model.query; - -import com.youlai.boot.common.base.BasePageQuery; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; -import lombok.Setter; -import java.util.List; - -/** - * 用户公告状态分页查询对象 - * - * @author youlaitech - * @since 2024-08-28 16:56 - */ -@Schema(description ="用户公告状态查询对象") -@Getter -@Setter -public class NoticeStatusQuery extends BasePageQuery { - - private static final long serialVersionUID = 1L; - - @Schema(description = "id") - private Long id; - - @Schema(description = "公共通知id") - private Long noticeId; - - @Schema(description = "用户id") - private Integer userId; - - @Schema(description = "读取状态,0未读,1已读取") - private Long readStatus; - - @Schema(description = "用户阅读时间") - private List readTime; -} From 5c7c21667997086745815b7c3a4a6aebcd1fca99 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:09:18 +0800 Subject: [PATCH 02/25] =?UTF-8?q?fix:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=96=87=E4=BB=B6=E5=90=8D=E9=94=99=E8=AF=AF=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/boot/generator/SystemCodeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/com/youlai/boot/generator/SystemCodeGenerator.java b/src/test/java/com/youlai/boot/generator/SystemCodeGenerator.java index 04a2a4d2..2a2e1834 100644 --- a/src/test/java/com/youlai/boot/generator/SystemCodeGenerator.java +++ b/src/test/java/com/youlai/boot/generator/SystemCodeGenerator.java @@ -49,7 +49,7 @@ public class SystemCodeGenerator { .injectionConfig(consumer -> { List customFiles = new ArrayList<>(); customFiles.add(new CustomFile.Builder().fileName("VO.java").templatePath("/templates/vo.java.vm").packageName("model.vo").build()); - customFiles.add(new CustomFile.Builder().fileName("VO.java").templatePath("/templates/dto.java.vm").packageName("model.dto").build()); + customFiles.add(new CustomFile.Builder().fileName("DTO.java").templatePath("/templates/dto.java.vm").packageName("model.dto").build()); customFiles.add(new CustomFile.Builder().fileName("BO.java").templatePath("/templates/bo.java.vm").packageName("model.bo").build()); customFiles.add(new CustomFile.Builder().fileName("PageQuery.java").templatePath("/templates/query.java.vm").packageName("model.query").build()); customFiles.add(new CustomFile.Builder().fileName("PageVO.java").templatePath("/templates/pageVO.java.vm").packageName("model.vo").build()); From caad917c03cbc48677b9c2ada9283467019fbf37 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:10:58 +0800 Subject: [PATCH 03/25] =?UTF-8?q?chore:=20=E5=AE=9E=E4=BD=93=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../boot/system/model/entity/Config.java | 2 +- .../system/model/query/NoticePageQuery.java | 2 +- .../system/model/query/PermPageQuery.java | 25 ------------------- .../system/model/query/UserPageQuery.java | 2 +- 4 files changed, 3 insertions(+), 28 deletions(-) delete mode 100644 src/main/java/com/youlai/boot/system/model/query/PermPageQuery.java diff --git a/src/main/java/com/youlai/boot/system/model/entity/Config.java b/src/main/java/com/youlai/boot/system/model/entity/Config.java index 842aef4c..cf9f92c5 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Config.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Config.java @@ -13,7 +13,7 @@ import lombok.EqualsAndHashCode; * @since 2024-07-29 11:17:26 */ @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @Schema(description = "系统配置") @TableName("sys_config") public class Config extends BaseEntity { diff --git a/src/main/java/com/youlai/boot/system/model/query/NoticePageQuery.java b/src/main/java/com/youlai/boot/system/model/query/NoticePageQuery.java index 3ab2596f..63061208 100644 --- a/src/main/java/com/youlai/boot/system/model/query/NoticePageQuery.java +++ b/src/main/java/com/youlai/boot/system/model/query/NoticePageQuery.java @@ -14,7 +14,7 @@ import java.util.List; * @since 2024-08-27 10:31 */ @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @Schema(description ="通知公告查询对象") public class NoticePageQuery extends BasePageQuery { diff --git a/src/main/java/com/youlai/boot/system/model/query/PermPageQuery.java b/src/main/java/com/youlai/boot/system/model/query/PermPageQuery.java deleted file mode 100644 index 07e02011..00000000 --- a/src/main/java/com/youlai/boot/system/model/query/PermPageQuery.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.youlai.boot.system.model.query; - -import com.youlai.boot.common.base.BasePageQuery; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -/** - * 权限分页查询对象 - * - * @author haoxr - * @since 2022/1/14 22:22 - */ -@Data -@Schema -@EqualsAndHashCode(callSuper = true) -public class PermPageQuery extends BasePageQuery { - - @Schema(description="权限名称") - private String name; - - @Schema(description="菜单ID") - private Long menuId; - -} diff --git a/src/main/java/com/youlai/boot/system/model/query/UserPageQuery.java b/src/main/java/com/youlai/boot/system/model/query/UserPageQuery.java index 3e2e7f74..89fd4616 100644 --- a/src/main/java/com/youlai/boot/system/model/query/UserPageQuery.java +++ b/src/main/java/com/youlai/boot/system/model/query/UserPageQuery.java @@ -14,7 +14,7 @@ import java.util.List; * @since 2022/1/14 */ @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @Schema(description ="用户分页查询对象") public class UserPageQuery extends BasePageQuery { From f640b9be74b8b7b559cd8728f809782e7e59cab9 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:17:54 +0800 Subject: [PATCH 04/25] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=89=88=E6=9C=AC=E7=9A=84=E6=97=A5=E5=BF=97=E8=A1=A8?= =?UTF-8?q?=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql8/youlai_boot.sql | 170 ++++++++++++++++++------------------- 1 file changed, 81 insertions(+), 89 deletions(-) diff --git a/sql/mysql8/youlai_boot.sql b/sql/mysql8/youlai_boot.sql index 1473db74..2467352e 100644 --- a/sql/mysql8/youlai_boot.sql +++ b/sql/mysql8/youlai_boot.sql @@ -21,24 +21,6 @@ -- 开启事务 START TRANSACTION; - -- ---------------------------- - -- Table structure for sys_config - -- ---------------------------- - DROP TABLE IF EXISTS `sys_config`; - CREATE TABLE `sys_config` ( - `id` bigint NOT NULL AUTO_INCREMENT, - `config_name` varchar(50) NOT NULL COMMENT '配置名称', - `config_key` varchar(50) NOT NULL COMMENT '配置key', - `config_value` varchar(100) NOT NULL COMMENT '配置值', - `remark` varchar(200) DEFAULT NULL COMMENT '描述、备注', - `create_time` datetime NOT NULL COMMENT '创建时间', - `create_by` bigint NOT NULL COMMENT '创建人ID', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `update_by` bigint DEFAULT NULL COMMENT '更新人ID', - `is_deleted` tinyint(1) NOT NULL COMMENT '逻辑删除标识(0-未删除 1-已删除)', - PRIMARY KEY (`id`) - ) ENGINE=InnoDB COMMENT='系统配置'; - -- ---------------------------- -- Table structure for sys_dept -- ---------------------------- @@ -73,22 +55,24 @@ DROP TABLE IF EXISTS `sys_dict`; CREATE TABLE `sys_dict` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键 ', - `dict_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '字典编码', - `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '类型编码', - `status` tinyint(1) DEFAULT '0' COMMENT '状态(0:正常,1:禁用)', + `dict_code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '类型编码', + `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '类型名称', + `status` tinyint(1) DEFAULT '0' COMMENT '状态(0:正常;1:禁用)', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注', `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `create_by` bigint DEFAULT NULL COMMENT '创建人ID', `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除(0:未删除,1:已删除)', - PRIMARY KEY (`id`) USING BTREE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='系统字典表'; - + `update_by` bigint DEFAULT NULL COMMENT '修改人ID', + `is_deleted` tinyint DEFAULT '0' COMMENT '是否删除(1-删除,0-未删除)', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE KEY `uk_code` (`dict_code`) USING BTREE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='字典表'; -- ---------------------------- -- Records of sys_dict -- ---------------------------- - INSERT INTO `sys_dict` VALUES (1, 'gender', '性别', 1, NULL, now() , now(), 0); - INSERT INTO `sys_dict` VALUES (2, 'notice_type', '通知类型', 1, NULL, now(), now(), 0); - INSERT INTO `sys_dict` VALUES (3, 'notice_level', '通知级别', 1, NULL, now(), now(), 0); + INSERT INTO `sys_dict` VALUES (1, 'gender', '性别', 1, NULL, now() , 1,now(), 1,0); + INSERT INTO `sys_dict` VALUES (2, 'notice_type', '通知类型', 1, NULL, now(), 1,now(), 1,0); + INSERT INTO `sys_dict` VALUES (3, 'notice_level', '通知级别', 1, NULL, now(), 1,now(), 1,0); -- ---------------------------- @@ -105,47 +89,27 @@ `sort` int DEFAULT '0' COMMENT '排序', `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '备注', `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `create_by` bigint DEFAULT NULL COMMENT '创建人ID', `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `update_by` bigint DEFAULT NULL COMMENT '修改人ID', PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='字典数据表'; -- ---------------------------- -- Records of sys_dict_data -- ---------------------------- - INSERT INTO `sys_dict_data` VALUES (1, 'gender', '1', '男', 'primary', 1, 1, NULL, now(), now()); - INSERT INTO `sys_dict_data` VALUES (2, 'gender', '2', '女', 'danger', 1, 2, NULL, now(), now()); - INSERT INTO `sys_dict_data` VALUES (3, 'gender', '0', '保密', 'info', 1, 3, NULL, now(), now()); - INSERT INTO `sys_dict_data` VALUES (4, 'notice_type', '1', '系统升级', 'success', 1, 1, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (5, 'notice_type', '2', '系统维护', 'primary', 1, 2, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (6, 'notice_type', '3', '安全警告', 'danger', 1, 3, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (7, 'notice_type', '4', '假期通知', 'success', 1, 4, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (8, 'notice_type', '5', '公司新闻', 'primary', 1, 5, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (9, 'notice_type', '99', '其他', 'info', 1, 99, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (10, 'notice_level', 'L', '低', 'info', 1, 1, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (11, 'notice_level', 'M', '中', 'warning', 1, 2, '', now(), now()); - INSERT INTO `sys_dict_data` VALUES (12, 'notice_level', 'H', '高', 'danger', 1, 3, '', now(), now()); - - -- ---------------------------- - -- Table structure for sys_log - -- ---------------------------- - DROP TABLE IF EXISTS `sys_log`; - CREATE TABLE `sys_log` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `type` tinyint NULL DEFAULT NULL COMMENT '日志类型(1-操作日志 2-登录日志)', - `title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日志标题', - `ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'IP地址', - `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '日志内容', - `create_by` bigint NULL DEFAULT NULL COMMENT '创建人ID', - `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', - `update_by` bigint NULL DEFAULT NULL COMMENT '修改人ID', - `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', - `is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识(1-已删除 0-未删除)', - PRIMARY KEY (`id`) USING BTREE - ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统日志' ROW_FORMAT = DYNAMIC; - - -- ---------------------------- - -- Records of sys_log - -- ---------------------------- + INSERT INTO `sys_dict_data` VALUES (1, 'gender', '1', '男', 'primary', 1, 1, NULL, now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (2, 'gender', '2', '女', 'danger', 1, 2, NULL, now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (3, 'gender', '0', '保密', 'info', 1, 3, NULL, now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (4, 'notice_type', '1', '系统升级', 'success', 1, 1, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (5, 'notice_type', '2', '系统维护', 'primary', 1, 2, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (6, 'notice_type', '3', '安全警告', 'danger', 1, 3, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (7, 'notice_type', '4', '假期通知', 'success', 1, 4, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (8, 'notice_type', '5', '公司新闻', 'primary', 1, 5, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (9, 'notice_type', '99', '其他', 'info', 1, 99, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (10, 'notice_level', 'L', '低', 'info', 1, 1, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (11, 'notice_level', 'M', '中', 'warning', 1, 2, '', now(), 1,now(),1); + INSERT INTO `sys_dict_data` VALUES (12, 'notice_level', 'H', '高', 'danger', 1, 3, '', now(), 1,now(),1); -- ---------------------------- -- Table structure for sys_menu @@ -470,12 +434,12 @@ DROP TABLE IF EXISTS `gen_config`; CREATE TABLE `gen_config` ( `id` bigint NOT NULL AUTO_INCREMENT, - `table_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '表名', - `module_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '模块名', - `package_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '包名', - `business_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '业务名', - `entity_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '实体类名', - `author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '作者', + `table_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '表名', + `module_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '模块名', + `package_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '包名', + `business_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务名', + `entity_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '实体类名', + `author` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '作者', `parent_menu_id` bigint DEFAULT NULL COMMENT '上级菜单ID,对应sys_menu的id ', `create_time` datetime DEFAULT NULL COMMENT '创建时间', `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', @@ -491,13 +455,13 @@ CREATE TABLE `gen_field_config` ( `id` bigint NOT NULL AUTO_INCREMENT, `config_id` bigint NOT NULL COMMENT '关联的配置ID', - `column_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, - `column_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL, + `column_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, + `column_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL, `column_length` int DEFAULT NULL, - `field_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '字段名称', - `field_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '字段类型', + `field_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '字段名称', + `field_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段类型', `field_sort` int DEFAULT NULL COMMENT '字段排序', - `field_comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '字段描述', + `field_comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '字段描述', `max_length` int NULL DEFAULT NULL, `is_required` tinyint(1) DEFAULT NULL COMMENT '是否必填', `is_show_in_list` tinyint(1) DEFAULT '0' COMMENT '是否在列表显示', @@ -505,33 +469,44 @@ `is_show_in_query` tinyint(1) DEFAULT '0' COMMENT '是否在查询条件显示', `query_type` tinyint DEFAULT NULL COMMENT '查询方式', `form_type` tinyint DEFAULT NULL COMMENT '表单类型', - `dict_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '字典类型', + `dict_type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '字典类型', `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', PRIMARY KEY (`id`), KEY `config_id` (`config_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='代码生成字段配置表'; - CREATE TABLE `sys_user_notice` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', - `notice_id` bigint NOT NULL COMMENT '公共通知id', - `user_id` bigint NOT NULL COMMENT '用户id', - `is_read` bigint NOT NULL DEFAULT '0' COMMENT '读取状态(0未读;1已读)', - `read_time` datetime DEFAULT NULL COMMENT '阅读时间', - `create_time` datetime NOT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL COMMENT '更新时间', - `is_deleted` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除(1-已删除;0-未删除)', - PRIMARY KEY (`id`) USING BTREE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户通知公告表'; + -- ---------------------------- + -- 系统配置表 + -- ---------------------------- + DROP TABLE IF EXISTS `sys_config`; + CREATE TABLE `sys_config` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `config_name` varchar(50) NOT NULL COMMENT '配置名称', + `config_key` varchar(50) NOT NULL COMMENT '配置key', + `config_value` varchar(100) NOT NULL COMMENT '配置值', + `remark` varchar(200) DEFAULT NULL COMMENT '描述、备注', + `create_time` datetime NOT NULL COMMENT '创建时间', + `create_by` bigint NOT NULL COMMENT '创建人ID', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `update_by` bigint DEFAULT NULL COMMENT '更新人ID', + `is_deleted` tinyint(1) NOT NULL COMMENT '逻辑删除标识(0-未删除 1-已删除)', + PRIMARY KEY (`id`) + ) ENGINE=InnoDB COMMENT='系统配置表'; + + -- ---------------------------- + -- 通知公告表 + -- ---------------------------- + DROP TABLE IF EXISTS `sys_notice`; CREATE TABLE `sys_notice` ( `id` bigint NOT NULL AUTO_INCREMENT, - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '通知标题', - `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '通知内容', - `type` tinyint NOT NULL COMMENT '通知类型(字典code:notice_type)', + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '通知标题', + `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci COMMENT '通知内容', + `type` tinyint NOT NULL COMMENT '通知类型(关联字典编码:notice_type)', `level` varchar(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '通知等级(字典code:notice_level)', `target_type` tinyint NOT NULL COMMENT '目标类型(1: 全体, 2: 指定)', - `target_user_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '目标人ID集合(多个使用英文逗号,分割)', + `target_user_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '目标人ID集合(多个使用英文逗号,分割)', `publisher_id` bigint DEFAULT NULL COMMENT '发布人ID', `publish_status` tinyint NOT NULL DEFAULT '0' COMMENT '发布状态(0: 未发布, 1: 已发布, -1: 已撤回)', `publish_time` datetime DEFAULT NULL COMMENT '发布时间', @@ -544,6 +519,23 @@ PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='通知公告表'; + -- 用户通知公告表 + DROP TABLE IF EXISTS `sys_user_notice`; + CREATE TABLE `sys_user_notice` ( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', + `notice_id` bigint NOT NULL COMMENT '公共通知id', + `user_id` bigint NOT NULL COMMENT '用户id', + `is_read` bigint NOT NULL DEFAULT '0' COMMENT '读取状态(0: 未读, 1: 已读)', + `read_time` datetime DEFAULT NULL COMMENT '阅读时间', + `create_time` datetime NOT NULL COMMENT '创建时间', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `is_deleted` tinyint NOT NULL DEFAULT '0' COMMENT '逻辑删除(0: 未删除, 1: 已删除)', + PRIMARY KEY (`id`) USING BTREE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户通知公告表'; + + + + SET FOREIGN_KEY_CHECKS = 1; -- 提交事务 From 37a20c7a6c5192be8c3210301c8806e2f65472be Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:18:15 +0800 Subject: [PATCH 05/25] =?UTF-8?q?style:=20=E5=88=A0=E9=99=A4=E7=A9=BA?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/boot/system/controller/ConfigController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/youlai/boot/system/controller/ConfigController.java b/src/main/java/com/youlai/boot/system/controller/ConfigController.java index f1a2643a..39964df2 100644 --- a/src/main/java/com/youlai/boot/system/controller/ConfigController.java +++ b/src/main/java/com/youlai/boot/system/controller/ConfigController.java @@ -17,7 +17,6 @@ import org.springdoc.core.annotations.ParameterObject; import org.springframework.web.bind.annotation.*; import org.springframework.security.access.prepost.PreAuthorize; - /** * 系统配置前端控制层 * From 3481396e593b9a57da55479e4ce0584f10c7f50e Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:22:27 +0800 Subject: [PATCH 06/25] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=89=80=E6=9C=89=E5=AD=97=E5=85=B8=E5=92=8C=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/DictController.java | 5 +- .../boot/system/mapper/DictDataMapper.java | 1 - .../youlai/boot/system/mapper/DictMapper.java | 11 +++++ .../youlai/boot/system/model/entity/Dict.java | 4 +- .../boot/system/model/entity/DictData.java | 6 +-- .../system/model/query/DictDataPageQuery.java | 2 +- .../system/model/query/DictPageQuery.java | 2 +- .../youlai/boot/system/model/vo/DictVO.java | 46 +++++++++++++++++++ .../boot/system/service/DictService.java | 16 ++----- .../system/service/impl/DictServiceImpl.java | 40 ++-------------- .../mapper/system/DictDataMapper.xml | 18 +++++++- .../resources/mapper/system/DictMapper.xml | 22 +++++++++ 12 files changed, 113 insertions(+), 60 deletions(-) create mode 100644 src/main/java/com/youlai/boot/system/model/vo/DictVO.java diff --git a/src/main/java/com/youlai/boot/system/controller/DictController.java b/src/main/java/com/youlai/boot/system/controller/DictController.java index c2225c2d..e8edad4d 100644 --- a/src/main/java/com/youlai/boot/system/controller/DictController.java +++ b/src/main/java/com/youlai/boot/system/controller/DictController.java @@ -10,6 +10,7 @@ import com.youlai.boot.system.model.vo.DictPageVO; import com.youlai.boot.common.annotation.RepeatSubmit; import com.youlai.boot.system.model.form.DictForm; import com.youlai.boot.common.annotation.Log; +import com.youlai.boot.system.model.vo.DictVO; import com.youlai.boot.system.service.DictService; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -47,8 +48,8 @@ public class DictController { @Operation(summary = "字典列表") @GetMapping("/list") - public Result>> getDictList() { - List> list = dictService.getDictList(); + public Result> getAllDictWithData() { + List list = dictService.getAllDictWithData(); return Result.success(list); } diff --git a/src/main/java/com/youlai/boot/system/mapper/DictDataMapper.java b/src/main/java/com/youlai/boot/system/mapper/DictDataMapper.java index 5f8c74b8..0f292dfd 100644 --- a/src/main/java/com/youlai/boot/system/mapper/DictDataMapper.java +++ b/src/main/java/com/youlai/boot/system/mapper/DictDataMapper.java @@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.youlai.boot.common.model.Option; import com.youlai.boot.system.model.entity.DictData; import com.youlai.boot.system.model.query.DictDataPageQuery; -import com.youlai.boot.system.model.query.DictPageQuery; import com.youlai.boot.system.model.vo.DictDataPageVO; import org.apache.ibatis.annotations.Mapper; diff --git a/src/main/java/com/youlai/boot/system/mapper/DictMapper.java b/src/main/java/com/youlai/boot/system/mapper/DictMapper.java index 6fff142f..3188d823 100644 --- a/src/main/java/com/youlai/boot/system/mapper/DictMapper.java +++ b/src/main/java/com/youlai/boot/system/mapper/DictMapper.java @@ -2,11 +2,15 @@ package com.youlai.boot.system.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.youlai.boot.common.model.Option; import com.youlai.boot.system.model.entity.Dict; import com.youlai.boot.system.model.query.DictPageQuery; import com.youlai.boot.system.model.vo.DictPageVO; +import com.youlai.boot.system.model.vo.DictVO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 字典 访问层 * @@ -24,6 +28,13 @@ public interface DictMapper extends BaseMapper { * @return */ Page getDictPage(Page page, DictPageQuery queryParams); + + /** + * 获取所有字典和字典数据 + * + * @return + */ + List getAllDictWithData(); } diff --git a/src/main/java/com/youlai/boot/system/model/entity/Dict.java b/src/main/java/com/youlai/boot/system/model/entity/Dict.java index ee9daf4d..adaeab48 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Dict.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Dict.java @@ -11,9 +11,9 @@ import lombok.EqualsAndHashCode; * @author haoxr * @since 2022/12/17 */ -@Data +@EqualsAndHashCode(callSuper = false) @TableName("sys_dict") -@EqualsAndHashCode(callSuper = true) +@Data public class Dict extends BaseEntity { /** diff --git a/src/main/java/com/youlai/boot/system/model/entity/DictData.java b/src/main/java/com/youlai/boot/system/model/entity/DictData.java index eb144ee7..0538cabb 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/DictData.java +++ b/src/main/java/com/youlai/boot/system/model/entity/DictData.java @@ -3,18 +3,18 @@ package com.youlai.boot.system.model.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; -import java.io.Serializable; - import com.baomidou.mybatisplus.annotation.TableName; import com.youlai.boot.common.base.BaseEntity; import lombok.Data; +import lombok.EqualsAndHashCode; /** - * 字典数据表 + * 字典数据实体对象 * * @author haoxr * @since 2022/12/17 */ +@EqualsAndHashCode(callSuper = false) @TableName("sys_dict_data") @Data public class DictData extends BaseEntity { diff --git a/src/main/java/com/youlai/boot/system/model/query/DictDataPageQuery.java b/src/main/java/com/youlai/boot/system/model/query/DictDataPageQuery.java index 762e8d82..00944a3e 100644 --- a/src/main/java/com/youlai/boot/system/model/query/DictDataPageQuery.java +++ b/src/main/java/com/youlai/boot/system/model/query/DictDataPageQuery.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @Schema(description ="字典数据分页查询对象") public class DictDataPageQuery extends BasePageQuery { diff --git a/src/main/java/com/youlai/boot/system/model/query/DictPageQuery.java b/src/main/java/com/youlai/boot/system/model/query/DictPageQuery.java index 91b464d5..d432be2e 100644 --- a/src/main/java/com/youlai/boot/system/model/query/DictPageQuery.java +++ b/src/main/java/com/youlai/boot/system/model/query/DictPageQuery.java @@ -7,7 +7,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = false) @Schema(description ="字典数据项分页查询对象") public class DictPageQuery extends BasePageQuery { diff --git a/src/main/java/com/youlai/boot/system/model/vo/DictVO.java b/src/main/java/com/youlai/boot/system/model/vo/DictVO.java new file mode 100644 index 00000000..f0fdf5e9 --- /dev/null +++ b/src/main/java/com/youlai/boot/system/model/vo/DictVO.java @@ -0,0 +1,46 @@ +package com.youlai.boot.system.model.vo; + + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + + +/** + * 字典数据项分页VO + * + * @author Ray + * @since 0.0.1 + */ +@Schema(description = "字典数据分页对象") +@Getter +@Setter +public class DictVO { + + @Schema(description = "字典名称") + private String name; + + @Schema(description = "字典编码") + private String dictCode; + + @Schema(description = "字典数据集合") + private List dictDataList; + + @Schema(description = "字典数据") + @Getter + @Setter + public static class DictData { + + @Schema(description = "字典数据值") + private String value; + + @Schema(description = "字典数据标签") + private String label; + + @Schema(description = "标签类型") + private String tagType; + } + +} diff --git a/src/main/java/com/youlai/boot/system/service/DictService.java b/src/main/java/com/youlai/boot/system/service/DictService.java index 1cf6c6a9..121c549a 100644 --- a/src/main/java/com/youlai/boot/system/service/DictService.java +++ b/src/main/java/com/youlai/boot/system/service/DictService.java @@ -7,11 +7,12 @@ import com.youlai.boot.system.model.entity.Dict; import com.youlai.boot.system.model.form.DictForm; import com.youlai.boot.system.model.query.DictPageQuery; import com.youlai.boot.system.model.vo.DictPageVO; +import com.youlai.boot.system.model.vo.DictVO; import java.util.List; /** - * 数据字典业务接口 + * 字典业务接口 * * @author haoxr * @since 2022/10/12 @@ -48,7 +49,7 @@ public interface DictService extends IService { /** * 修改字典 * - * @param id + * @param id 字典ID * @param dictForm 字典表单 * @return */ @@ -63,19 +64,10 @@ public interface DictService extends IService { void deleteDictByIds(String idsStr); - /** - * 获取字典的数据项 - * - * @param code 字典编码 - * @return - */ - List> listDictItemsByCode(String code); - - /** * 获取字典列表 * * @return */ - List> getDictList(); + List getAllDictWithData(); } diff --git a/src/main/java/com/youlai/boot/system/service/impl/DictServiceImpl.java b/src/main/java/com/youlai/boot/system/service/impl/DictServiceImpl.java index f7e4294f..996b2ab4 100644 --- a/src/main/java/com/youlai/boot/system/service/impl/DictServiceImpl.java +++ b/src/main/java/com/youlai/boot/system/service/impl/DictServiceImpl.java @@ -16,6 +16,7 @@ import com.youlai.boot.system.model.form.DictForm; import com.youlai.boot.system.model.query.DictPageQuery; import com.youlai.boot.system.model.vo.DictPageVO; import com.youlai.boot.common.model.Option; +import com.youlai.boot.system.model.vo.DictVO; import com.youlai.boot.system.service.DictDataService; import com.youlai.boot.system.service.DictService; import lombok.RequiredArgsConstructor; @@ -145,44 +146,11 @@ public class DictServiceImpl extends ServiceImpl implements Di } /** - * 获取字典的数据项 - * - * @param code 字典编码 + * 获取所有字典和字典数据 */ @Override - public List> listDictItemsByCode(String code) { - // 根据字典编码获取字典ID - Dict dict = this.getOne(new LambdaQueryWrapper() - .eq(Dict::getDictCode, code) - .select(Dict::getId) - .last("limit 1") - ); - // 如果字典不存在,则返回空集合 - if (dict == null) { - return CollectionUtil.newArrayList(); - } - - // 获取字典项 - List dictData = dictDataService.list( - new LambdaQueryWrapper() - .eq(DictData::getDictCode, dict.getDictCode()) - ); - - // 转换为 Option - return dictDataConverter.toOption(dictData); - } - - /** - * 获取字典列表 - */ - @Override - public List> getDictList() { - return this.list(new LambdaQueryWrapper() - .eq(Dict::getStatus, 1) - .select(Dict::getName, Dict::getDictCode) - ).stream() - .map(dict -> new Option<>(dict.getDictCode(), dict.getName())) - .toList(); + public List getAllDictWithData() { + return this.baseMapper.getAllDictWithData(); } } diff --git a/src/main/resources/mapper/system/DictDataMapper.xml b/src/main/resources/mapper/system/DictDataMapper.xml index e61c7225..141cd2fa 100644 --- a/src/main/resources/mapper/system/DictDataMapper.xml +++ b/src/main/resources/mapper/system/DictDataMapper.xml @@ -35,12 +35,26 @@ value, label FROM - sys_dict_data + sys_dict_data dict_code = #{dictCode} ORDER BY - sort ASC + sort ASC + + + + diff --git a/src/main/resources/mapper/system/DictMapper.xml b/src/main/resources/mapper/system/DictMapper.xml index 670694b4..4f717cb4 100644 --- a/src/main/resources/mapper/system/DictMapper.xml +++ b/src/main/resources/mapper/system/DictMapper.xml @@ -25,4 +25,26 @@ ORDER BY t1.create_time DESC + + + + + + + + + + From 3ff8fff76e893cf8c01e951bc5aa3a99772dc46c Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 18 Oct 2024 22:23:03 +0800 Subject: [PATCH 07/25] chore: upgrade version 2.14.0 to 2.15.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2bc766f1..1dceec14 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.youlai youlai-boot - 2.14.0 + 2.15.0 基于 Java 17 + SpringBoot 3 + Spring Security 构建的权限管理系统。 From f3ca74b439ffd3b5059c96f4b0a37968dded2bcd Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Fri, 18 Oct 2024 23:37:08 +0800 Subject: [PATCH 08/25] =?UTF-8?q?fix:=20logback=E7=9A=84=E5=9B=9E=E6=BB=9A?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E9=85=8D=E7=BD=AE=E9=80=82=E9=85=8DSpringBoo?= =?UTF-8?q?t=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/logback-spring.xml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index b142626e..abc59ada 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -30,14 +30,16 @@ %d{yyyy-MM-dd HH:mm:ss.SSS} -%5level ---[%15.15thread] %-40.40logger{39} : %msg%n%n UTF-8 - - + + + ${LOG_HOME}/%d{yyyy-MM-dd}.%i.log - - 10MB - - + + 10MB + 30 + + 1GB @@ -59,4 +61,4 @@ - \ No newline at end of file + From 140a594f21cba774cd33e87ac3164a7b776be872 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 17:30:26 +0800 Subject: [PATCH 09/25] =?UTF-8?q?refactor:=20=E4=BB=A3=E7=A0=81=E7=94=9F?= =?UTF-8?q?=E6=88=90=20`Mapper=20XML`=20=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9D=97=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../boot/shared/codegen/service/impl/CodegenServiceImpl.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java b/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java index f78bc304..06431592 100644 --- a/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java +++ b/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java @@ -169,6 +169,7 @@ public class CodegenServiceImpl implements CodegenService { path = (codegenProperties.getBackendAppName() + File.separator + "src" + File.separator + "main" + File.separator + "resources" + + File.separator + moduleName + File.separator + subPackageName ); } else if ("API".equals(templateName)) { @@ -241,8 +242,6 @@ public class CodegenServiceImpl implements CodegenService { hasRequiredField = true; } fieldConfig.setTsType(JavaTypeEnum.getTsTypeByJavaType(fieldConfig.getFieldType())); - - } bindMap.put("hasLocalDateTime", hasLocalDateTime); From 2814be08d31299d3b880e7e7b65ae56f97be5df2 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 17:31:18 +0800 Subject: [PATCH 10/25] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=BC=E5=BC=8F-=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=B3=A8=E9=87=8A=E7=9A=84=E7=BC=A9=E8=BF=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../boot/shared/codegen/service/impl/GenConfigServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java b/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java index 971f38c9..deb5cc31 100644 --- a/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java +++ b/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java @@ -132,7 +132,7 @@ public class GenConfigServiceImpl extends ServiceImpl Date: Tue, 22 Oct 2024 17:45:10 +0800 Subject: [PATCH 11/25] =?UTF-8?q?chore:=20=E7=A7=BB=E9=99=A4=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=84=9A=E6=9C=AC=E4=B8=AD=E7=9A=84=20sys=5F?= =?UTF-8?q?message=20=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql5/youlai_boot.sql | 18 ------------------ sql/mysql8/youlai_boot.sql | 17 ----------------- 2 files changed, 35 deletions(-) diff --git a/sql/mysql5/youlai_boot.sql b/sql/mysql5/youlai_boot.sql index b096db97..8010e547 100644 --- a/sql/mysql5/youlai_boot.sql +++ b/sql/mysql5/youlai_boot.sql @@ -245,24 +245,6 @@ INSERT INTO `sys_menu` VALUES (136, 135, '0,1,135', '字典数据新增', 4, NUL INSERT INTO `sys_menu` VALUES (137, 135, '0,1,135', '字典数据编辑', 4, NULL, '', NULL, 'sys:dict-data:edit', NULL, NULL, 1, 5, '', NULL, now(), now(), NULL); INSERT INTO `sys_menu` VALUES (138, 135, '0,1,135', '字典数据删除', 4, NULL, '', NULL, 'sys:dict-data:delete', NULL, NULL, 1, 6, '', NULL, now(), now(), NULL); --- ---------------------------- --- Table structure for sys_message --- ---------------------------- -DROP TABLE IF EXISTS `sys_message`; -CREATE TABLE `sys_message` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `create_by` bigint NULL DEFAULT NULL COMMENT '创建人ID', - `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', - `update_by` bigint NULL DEFAULT NULL COMMENT '修改人ID', - `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', - `is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识(1-已删除 0-未删除)', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '系统消息' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sys_message --- ---------------------------- - -- ---------------------------- -- Table structure for sys_role -- ---------------------------- diff --git a/sql/mysql8/youlai_boot.sql b/sql/mysql8/youlai_boot.sql index 2467352e..a8a8c75a 100644 --- a/sql/mysql8/youlai_boot.sql +++ b/sql/mysql8/youlai_boot.sql @@ -210,23 +210,6 @@ INSERT INTO `sys_menu` VALUES (137, 135, '0,1,135', '字典数据编辑', 4, NULL, '', NULL, 'sys:dict-data:edit', NULL, NULL, 1, 5, '', NULL, now(), now(), NULL); INSERT INTO `sys_menu` VALUES (138, 135, '0,1,135', '字典数据删除', 4, NULL, '', NULL, 'sys:dict-data:delete', NULL, NULL, 1, 6, '', NULL, now(), now(), NULL); - -- ---------------------------- - -- Table structure for sys_message - -- ---------------------------- - DROP TABLE IF EXISTS `sys_message`; - CREATE TABLE `sys_message` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `create_by` bigint NULL DEFAULT NULL COMMENT '创建人ID', - `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间', - `update_by` bigint NULL DEFAULT NULL COMMENT '修改人ID', - `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', - `is_deleted` tinyint NOT NULL DEFAULT 0 COMMENT '逻辑删除标识(1-已删除 0-未删除)', - PRIMARY KEY (`id`) USING BTREE - ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统消息' ROW_FORMAT = DYNAMIC; - - -- ---------------------------- - -- Records of sys_message - -- ---------------------------- -- ---------------------------- -- Table structure for sys_role From aed9e6b827f66ea7610a50118931c829cfc6d3d9 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 18:05:39 +0800 Subject: [PATCH 12/25] =?UTF-8?q?chore:=20=E5=B0=86=20sys=5Flog=20?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E7=9A=84=20module=20=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E4=BB=8E=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=9E=8B=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=20varchar=20=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sql/mysql5/youlai_boot.sql | 2 +- sql/mysql8/youlai_boot.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/mysql5/youlai_boot.sql b/sql/mysql5/youlai_boot.sql index 8010e547..077ec7e5 100644 --- a/sql/mysql5/youlai_boot.sql +++ b/sql/mysql5/youlai_boot.sql @@ -428,7 +428,7 @@ INSERT INTO `sys_user_role` VALUES (3, 3); DROP TABLE IF EXISTS `sys_log`; CREATE TABLE `sys_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `module` enum('LOGIN','USER','ROLE','DEPT','MENU','DICT','OTHER') NOT NULL COMMENT '日志模块', + `module` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志模块', `content` varchar(255) NOT NULL COMMENT '日志内容', `request_uri` varchar(255) COLLATE utf8_general_ci DEFAULT NULL COMMENT '请求路径', `ip` varchar(45) DEFAULT NULL COMMENT 'IP地址', diff --git a/sql/mysql8/youlai_boot.sql b/sql/mysql8/youlai_boot.sql index a8a8c75a..fcb85230 100644 --- a/sql/mysql8/youlai_boot.sql +++ b/sql/mysql8/youlai_boot.sql @@ -394,7 +394,7 @@ DROP TABLE IF EXISTS `sys_log`; CREATE TABLE `sys_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键', - `module` enum('LOGIN','USER','ROLE','DEPT','MENU','DICT','OTHER') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志模块', + `module` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志模块', `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '日志内容', `request_uri` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '请求路径', `ip` varchar(45) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'IP地址', From 85c42e4c2a7df1721c13872b9df4a04e8875d523 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 18:30:03 +0800 Subject: [PATCH 13/25] =?UTF-8?q?chore:=20=E7=BB=9F=E4=B8=80=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=88=A0=E9=99=A4=E5=AD=97=E6=AE=B5=E5=90=8D=E4=B8=BA?= =?UTF-8?q?=E9=A9=BC=E5=B3=B0=E5=91=BD=E5=90=8D-=20=E5=B0=86=20logic-delet?= =?UTF-8?q?e-field=20=E7=9A=84=E5=80=BC=E4=BB=8E=20is=5Fdeleted=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=20isDeleted-?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application-dev.yml | 4 ++-- src/main/resources/application-prod.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 50b69a8d..8bf46809 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -61,8 +61,8 @@ mybatis-plus: db-config: # 主键ID类型 id-type: none - # 逻辑删除字段名称 - logic-delete-field: is_deleted + # 逻辑删除全局属性名(驼峰和下划线都支持) + logic-delete-field: isDeleted # 逻辑删除-删除值 logic-delete-value: 1 # 逻辑删除-未删除值 diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 92e30808..44f27dc3 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -46,7 +46,7 @@ mybatis-plus: # 主键ID类型 id-type: none # 逻辑删除字段名称 - logic-delete-field: is_deleted + logic-delete-field: isDeleted # 逻辑删除-删除值 logic-delete-value: 1 # 逻辑删除-未删除值 From 4c65f708f7819149c3ee6392959238f79b584f59 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 18:30:19 +0800 Subject: [PATCH 14/25] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=20SQL?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了不必要的空行和额外的空格 - 统一了表结构定义的格式 - 删除了多余的注释 --- sql/mysql5/youlai_boot.sql | 2 -- 1 file changed, 2 deletions(-) diff --git a/sql/mysql5/youlai_boot.sql b/sql/mysql5/youlai_boot.sql index 077ec7e5..d15b32f4 100644 --- a/sql/mysql5/youlai_boot.sql +++ b/sql/mysql5/youlai_boot.sql @@ -421,7 +421,6 @@ INSERT INTO `sys_user_role` VALUES (1, 1); INSERT INTO `sys_user_role` VALUES (2, 2); INSERT INTO `sys_user_role` VALUES (3, 3); - -- ---------------------------- -- Table structure for sys_log -- ---------------------------- @@ -444,7 +443,6 @@ CREATE TABLE `sys_log` ( PRIMARY KEY (`id`) USING BTREE ) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='系统日志表'; - -- ---------------------------- -- Table structure for gen_config -- ---------------------------- From a65852d3e8a140f7c37897ba17acead4f77230e6 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Tue, 22 Oct 2024 18:31:04 +0800 Subject: [PATCH 15/25] =?UTF-8?q?fix:=20=E8=A1=A5=E5=85=85=20Dict=E3=80=81?= =?UTF-8?q?Role=20=E5=92=8C=20User=20=E7=B1=BB=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=20isDeleted=20=E5=AD=97=E6=AE=B5=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/boot/system/model/entity/Config.java | 1 - src/main/java/com/youlai/boot/system/model/entity/Dept.java | 3 +-- src/main/java/com/youlai/boot/system/model/entity/Dict.java | 5 +++++ .../java/com/youlai/boot/system/model/entity/Notice.java | 2 +- src/main/java/com/youlai/boot/system/model/entity/Role.java | 5 +++++ src/main/java/com/youlai/boot/system/model/entity/User.java | 5 +++++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/youlai/boot/system/model/entity/Config.java b/src/main/java/com/youlai/boot/system/model/entity/Config.java index cf9f92c5..697556b8 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Config.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Config.java @@ -51,7 +51,6 @@ public class Config extends BaseEntity { /** * 逻辑删除标识(0-未删除 1-已删除) */ - @TableLogic(value = "0", delval = "1") private Integer isDeleted; } diff --git a/src/main/java/com/youlai/boot/system/model/entity/Dept.java b/src/main/java/com/youlai/boot/system/model/entity/Dept.java index c59712be..cebe1f49 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Dept.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Dept.java @@ -58,9 +58,8 @@ public class Dept extends BaseEntity { private Long updateBy; /** - * 逻辑删除标识(0-未删除 1-已删除) + * 是否删除(0-否 1-是) */ - @TableLogic(value = "0", delval = "1") private Integer isDeleted; } \ No newline at end of file diff --git a/src/main/java/com/youlai/boot/system/model/entity/Dict.java b/src/main/java/com/youlai/boot/system/model/entity/Dict.java index adaeab48..fd8690c8 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Dict.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Dict.java @@ -37,4 +37,9 @@ public class Dict extends BaseEntity { */ private String remark; + /** + * 逻辑删除标识(0-未删除 1-已删除) + */ + private Integer isDeleted; + } \ No newline at end of file diff --git a/src/main/java/com/youlai/boot/system/model/entity/Notice.java b/src/main/java/com/youlai/boot/system/model/entity/Notice.java index 5b71ad40..9bf675d2 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Notice.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Notice.java @@ -79,9 +79,9 @@ public class Notice extends BaseEntity { * 更新人ID */ private Long updateBy; + /** * 逻辑删除标识(0-未删除 1-已删除) */ - @TableLogic(value = "0", delval = "1") private Integer isDeleted; } diff --git a/src/main/java/com/youlai/boot/system/model/entity/Role.java b/src/main/java/com/youlai/boot/system/model/entity/Role.java index 724e5e35..0ca68116 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/Role.java +++ b/src/main/java/com/youlai/boot/system/model/entity/Role.java @@ -50,4 +50,9 @@ public class Role extends BaseEntity { * 更新人 ID */ private Long updateBy; + + /** + * 是否删除(0-否 1-是) + */ + private Integer isDeleted; } \ No newline at end of file diff --git a/src/main/java/com/youlai/boot/system/model/entity/User.java b/src/main/java/com/youlai/boot/system/model/entity/User.java index e617910e..62535380 100644 --- a/src/main/java/com/youlai/boot/system/model/entity/User.java +++ b/src/main/java/com/youlai/boot/system/model/entity/User.java @@ -67,4 +67,9 @@ public class User extends BaseEntity { * 更新人 ID */ private Long updateBy; + + /** + * 是否删除(0-否 1-是) + */ + private Integer isDeleted; } \ No newline at end of file From 3de3417d145630e0cea8cf4980bc4cce112752d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=91=E7=BF=94?= <971366405@qq.com> Date: Fri, 25 Oct 2024 13:56:21 +0800 Subject: [PATCH 16/25] =?UTF-8?q?refactor:=20FormTypeEnum=E7=9A=84fromValu?= =?UTF-8?q?e=E6=96=B9=E6=B3=95=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FormTypeEnum的fromValue方法重构 --- .../com/youlai/boot/shared/codegen/enums/FormTypeEnum.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/youlai/boot/shared/codegen/enums/FormTypeEnum.java b/src/main/java/com/youlai/boot/shared/codegen/enums/FormTypeEnum.java index 4c3a2ecb..299b80aa 100644 --- a/src/main/java/com/youlai/boot/shared/codegen/enums/FormTypeEnum.java +++ b/src/main/java/com/youlai/boot/shared/codegen/enums/FormTypeEnum.java @@ -73,8 +73,8 @@ public enum FormTypeEnum implements IBaseEnum { @JsonCreator - public static QueryTypeEnum fromValue(Integer value) { - for (QueryTypeEnum type : QueryTypeEnum.values()) { + public static FormTypeEnum fromValue(Integer value) { + for (FormTypeEnum type : FormTypeEnum.values()) { if (type.getValue().equals(value)) { return type; } From 4005bafbc8bf8aa244ead6a86973cfaa6b9f8c15 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Fri, 25 Oct 2024 18:16:46 +0800 Subject: [PATCH 17/25] =?UTF-8?q?refactor(codegen):=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90API=E6=A8=A1=E6=9D=BF=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=AE=9A=E4=B9=89=E6=96=B9=E5=BC=8F=E5=92=8C=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84=E6=B7=BB=E5=8A=A0=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CodegenServiceImpl.java | 7 +++++-- .../resources/templates/codegen/api.ts.vm | 20 +++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java b/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java index 06431592..3f13170f 100644 --- a/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java +++ b/src/main/java/com/youlai/boot/shared/codegen/service/impl/CodegenServiceImpl.java @@ -173,11 +173,14 @@ public class CodegenServiceImpl implements CodegenService { + File.separator + subPackageName ); } else if ("API".equals(templateName)) { + // path = "src/api/system"; path = (codegenProperties.getFrontendAppName() - + File.separator - + "src" + File.separator + subPackageName + + File.separator + "src" + + File.separator + subPackageName + + File.separator + moduleName ); } else if ("VIEW".equals(templateName)) { + // path = "src/views/system/user"; path = (codegenProperties.getFrontendAppName() + File.separator + "src" + File.separator + subPackageName diff --git a/src/main/resources/templates/codegen/api.ts.vm b/src/main/resources/templates/codegen/api.ts.vm index 580d5f93..1e2e6c97 100644 --- a/src/main/resources/templates/codegen/api.ts.vm +++ b/src/main/resources/templates/codegen/api.ts.vm @@ -2,36 +2,36 @@ import request from "@/utils/request"; const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${lowerFirstEntityName}s"; -class ${entityName}API { +const ${entityName}API = { /** 获取${businessName}分页数据 */ - static getPage(queryParams?: ${entityName}PageQuery) { + getPage(queryParams?: ${entityName}PageQuery) { return request>({ url: `${${entityName.toUpperCase()}_BASE_URL}/page`, method: "get", params: queryParams, }); - } + }, /** * 获取${businessName}表单数据 * * @param id ${entityName}ID * @returns ${entityName}表单数据 */ - static getFormData(id: number) { + getFormData(id: number) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}/${id}/form`, method: "get", }); - } + }, /** 添加${businessName}*/ - static add(data: ${entityName}Form) { + add(data: ${entityName}Form) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}`, method: "post", data: data, }); - } + }, /** * 更新${businessName} @@ -39,20 +39,20 @@ class ${entityName}API { * @param id ${entityName}ID * @param data ${entityName}表单数据 */ - static update(id: number, data: ${entityName}Form) { + update(id: number, data: ${entityName}Form) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}/${id}`, method: "put", data: data, }); - } + }, /** * 批量删除${businessName},多个以英文逗号(,)分割 * * @param ids ${businessName}ID字符串,多个以英文逗号(,)分割 */ - static deleteByIds(ids: string) { + deleteByIds(ids: string) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}/${ids}`, method: "delete", From 3868e0e5625321b5dfd14b48f436ed69bf3488f5 Mon Sep 17 00:00:00 2001 From: Kylin Date: Mon, 28 Oct 2024 17:42:43 +0800 Subject: [PATCH 18/25] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E5=90=8D=E7=A7=B0=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 API、控制器、转换器、实体、表单、Mapper 等文件中 - 将业务名称的显示使用 trim() 方法去除前后空格 - 优化代码注释和接口文档中的业务名称显示效果 --- .../resources/templates/codegen/api.ts.vm | 18 ++++++------- .../templates/codegen/controller.java.vm | 20 +++++++------- .../templates/codegen/converter.java.vm | 2 +- .../templates/codegen/entity.java.vm | 4 +-- .../resources/templates/codegen/form.java.vm | 4 +-- .../resources/templates/codegen/index.vue.vm | 24 ++++++++--------- .../templates/codegen/mapper.java.vm | 4 +-- .../resources/templates/codegen/mapper.xml.vm | 2 +- .../resources/templates/codegen/query.java.vm | 4 +-- .../templates/codegen/service.java.vm | 22 ++++++++-------- .../templates/codegen/serviceImpl.java.vm | 26 +++++++++---------- .../resources/templates/codegen/vo.java.vm | 4 +-- 12 files changed, 67 insertions(+), 67 deletions(-) diff --git a/src/main/resources/templates/codegen/api.ts.vm b/src/main/resources/templates/codegen/api.ts.vm index 1e2e6c97..daaf4a99 100644 --- a/src/main/resources/templates/codegen/api.ts.vm +++ b/src/main/resources/templates/codegen/api.ts.vm @@ -3,7 +3,7 @@ import request from "@/utils/request"; const ${entityName.toUpperCase()}_BASE_URL = "/api/v1/${lowerFirstEntityName}s"; const ${entityName}API = { - /** 获取${businessName}分页数据 */ + /** 获取${businessName.trim()}分页数据 */ getPage(queryParams?: ${entityName}PageQuery) { return request>({ url: `${${entityName.toUpperCase()}_BASE_URL}/page`, @@ -12,7 +12,7 @@ const ${entityName}API = { }); }, /** - * 获取${businessName}表单数据 + * 获取${businessName.trim()}表单数据 * * @param id ${entityName}ID * @returns ${entityName}表单数据 @@ -24,7 +24,7 @@ const ${entityName}API = { }); }, - /** 添加${businessName}*/ + /** 添加${businessName.trim()}*/ add(data: ${entityName}Form) { return request({ url: `${${entityName.toUpperCase()}_BASE_URL}`, @@ -34,7 +34,7 @@ const ${entityName}API = { }, /** - * 更新${businessName} + * 更新${businessName.trim()} * * @param id ${entityName}ID * @param data ${entityName}表单数据 @@ -48,9 +48,9 @@ const ${entityName}API = { }, /** - * 批量删除${businessName},多个以英文逗号(,)分割 + * 批量删除${businessName.trim()},多个以英文逗号(,)分割 * - * @param ids ${businessName}ID字符串,多个以英文逗号(,)分割 + * @param ids ${businessName.trim()}ID字符串,多个以英文逗号(,)分割 */ deleteByIds(ids: string) { return request({ @@ -62,7 +62,7 @@ const ${entityName}API = { export default ${entityName}API; -/** ${businessName}分页查询参数 */ +/** ${businessName.trim()}分页查询参数 */ export interface ${entityName}PageQuery extends PageQuery { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInQuery) @@ -82,7 +82,7 @@ export interface ${entityName}PageQuery extends PageQuery { #end } -/** ${businessName}表单对象 */ +/** ${businessName.trim()}表单对象 */ export interface ${entityName}Form { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInForm) @@ -94,7 +94,7 @@ export interface ${entityName}Form { #end } -/** ${businessName}分页对象 */ +/** ${businessName.trim()}分页对象 */ export interface ${entityName}PageVO { #foreach($fieldConfig in $fieldConfigs) #if($fieldConfig.isShowInList) diff --git a/src/main/resources/templates/codegen/controller.java.vm b/src/main/resources/templates/codegen/controller.java.vm index 792db37a..c19b6bed 100644 --- a/src/main/resources/templates/codegen/controller.java.vm +++ b/src/main/resources/templates/codegen/controller.java.vm @@ -19,12 +19,12 @@ import org.springframework.web.bind.annotation.*; import jakarta.validation.Valid; /** - * $!{businessName}前端控制层 + * $!{businessName.trim()}前端控制层 * * @author ${author} * @since ${date} */ -@Tag(name = "${businessName}接口") +@Tag(name = "${businessName.trim()}接口") @RestController @RequestMapping("/api/v1/${lowerFirstEntityName}s") @RequiredArgsConstructor @@ -32,7 +32,7 @@ public class ${entityName}Controller { private final ${entityName}Service ${lowerFirstEntityName}Service; - @Operation(summary = "$!{businessName}分页列表") + @Operation(summary = "$!{businessName.trim()}分页列表") @GetMapping("/page") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:query')") public PageResult<${entityName}VO> get${entityName}Page(${entityName}Query queryParams ) { @@ -40,7 +40,7 @@ public class ${entityName}Controller { return PageResult.success(result); } - @Operation(summary = "新增${businessName}") + @Operation(summary = "新增${businessName.trim()}") @PostMapping @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:add')") public Result save${entityName}(@RequestBody @Valid ${entityName}Form formData ) { @@ -48,32 +48,32 @@ public class ${entityName}Controller { return Result.judge(result); } - @Operation(summary = "获取${businessName}表单数据") + @Operation(summary = "获取${businessName.trim()}表单数据") @GetMapping("/{id}/form") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:edit')") public Result<${entityName}Form> get${entityName}Form( - @Parameter(description = "$!{businessName}ID") @PathVariable Long id + @Parameter(description = "$!{businessName.trim()}ID") @PathVariable Long id ) { ${entityName}Form formData = ${lowerFirstEntityName}Service.get${entityName}FormData(id); return Result.success(formData); } - @Operation(summary = "修改${businessName}") + @Operation(summary = "修改${businessName.trim()}") @PutMapping(value = "/{id}") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:edit')") public Result update${entityName}( - @Parameter(description = "$!{businessName}ID") @PathVariable Long id, + @Parameter(description = "$!{businessName.trim()}ID") @PathVariable Long id, @RequestBody @Validated ${entityName}Form formData ) { boolean result = ${lowerFirstEntityName}Service.update${entityName}(id, formData); return Result.judge(result); } - @Operation(summary = "删除${businessName}") + @Operation(summary = "删除${businessName.trim()}") @DeleteMapping("/{ids}") @PreAuthorize("@ss.hasPerm('${moduleName}:${lowerFirstEntityName}:delete')") public Result delete${entityName}s( - @Parameter(description = "$!{businessName}ID,多个以英文逗号(,)分割") @PathVariable String ids + @Parameter(description = "$!{businessName.trim()}ID,多个以英文逗号(,)分割") @PathVariable String ids ) { boolean result = ${lowerFirstEntityName}Service.delete${entityName}s(ids); return Result.judge(result); diff --git a/src/main/resources/templates/codegen/converter.java.vm b/src/main/resources/templates/codegen/converter.java.vm index b56f6234..92430c0d 100644 --- a/src/main/resources/templates/codegen/converter.java.vm +++ b/src/main/resources/templates/codegen/converter.java.vm @@ -6,7 +6,7 @@ import ${packageName}.${moduleName}.model.entity.${entityName}; import ${packageName}.${moduleName}.model.form.${entityName}Form; /** - * $!{businessName}对象转换器 + * $!{businessName.trim()}对象转换器 * * @author ${author} * @since ${date} diff --git a/src/main/resources/templates/codegen/entity.java.vm b/src/main/resources/templates/codegen/entity.java.vm index 2f6b2cbf..c5faa81f 100644 --- a/src/main/resources/templates/codegen/entity.java.vm +++ b/src/main/resources/templates/codegen/entity.java.vm @@ -12,14 +12,14 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.youlai.boot.common.base.BaseEntity; /** - * $!{businessName}实体对象 + * $!{businessName.trim()}实体对象 * * @author ${author} * @since ${date} */ @Getter @Setter -@TableName("${tableName}") +@TableName("${tableName.trim()}") public class ${entityName} extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/src/main/resources/templates/codegen/form.java.vm b/src/main/resources/templates/codegen/form.java.vm index e2c07377..54a6cdb8 100644 --- a/src/main/resources/templates/codegen/form.java.vm +++ b/src/main/resources/templates/codegen/form.java.vm @@ -16,14 +16,14 @@ import jakarta.validation.constraints.*; #end /** - * $!{businessName}表单对象 + * $!{businessName.trim()}表单对象 * * @author ${author} * @since ${date} */ @Getter @Setter -@Schema(description = "$!{businessName}表单对象") +@Schema(description = "$!{businessName.trim()}表单对象") public class ${entityName}Form implements Serializable { @Serial diff --git a/src/main/resources/templates/codegen/index.vue.vm b/src/main/resources/templates/codegen/index.vue.vm index 8a486510..7bdb64b8 100644 --- a/src/main/resources/templates/codegen/index.vue.vm +++ b/src/main/resources/templates/codegen/index.vue.vm @@ -169,7 +169,7 @@ /> - + ([]); // 弹窗 @@ -279,10 +279,10 @@ visible: false, }); - // $!{businessName}表单数据 + // $!{businessName.trim()}表单数据 const formData = reactive<${entityName}Form>({}); - // $!{businessName}表单校验规则 + // $!{businessName.trim()}表单校验规则 const rules = reactive({ #if($fieldConfigs) #foreach($fieldConfig in ${fieldConfigs}) @@ -293,7 +293,7 @@ #end }); - /** 查询$!{businessName} */ + /** 查询$!{businessName.trim()} */ function handleQuery() { loading.value = true; ${entityName}API.getPage(queryParams) @@ -306,7 +306,7 @@ }); } - /** 重置$!{businessName}查询 */ + /** 重置$!{businessName.trim()}查询 */ function handleResetQuery() { queryFormRef.value!.resetFields(); queryParams.pageNum = 1; @@ -318,20 +318,20 @@ removeIds.value = selection.map((item: any) => item.id); } - /** 打开$!{businessName}弹窗 */ + /** 打开$!{businessName.trim()}弹窗 */ function handleOpenDialog(id?: number) { dialog.visible = true; if (id) { - dialog.title = "修改$!{businessName}"; + dialog.title = "修改$!{businessName.trim()}"; ${entityName}API.getFormData(id).then((data) => { Object.assign(formData, data); }); } else { - dialog.title = "新增$!{businessName}"; + dialog.title = "新增$!{businessName.trim()}"; } } - /** 提交$!{businessName}表单 */ + /** 提交$!{businessName.trim()}表单 */ function handleSubmit() { dataFormRef.value.validate((valid: any) => { if (valid) { @@ -358,7 +358,7 @@ }); } - /** 关闭$!{businessName}弹窗 */ + /** 关闭$!{businessName.trim()}弹窗 */ function handleCloseDialog() { dialog.visible = false; dataFormRef.value.resetFields(); @@ -366,7 +366,7 @@ formData.id = undefined; } - /** 删除$!{businessName} */ + /** 删除$!{businessName.trim()} */ function handleDelete(id?: number) { const ids = [id || removeIds.value].join(","); if (!ids) { diff --git a/src/main/resources/templates/codegen/mapper.java.vm b/src/main/resources/templates/codegen/mapper.java.vm index ca4eedd8..ef330027 100644 --- a/src/main/resources/templates/codegen/mapper.java.vm +++ b/src/main/resources/templates/codegen/mapper.java.vm @@ -8,7 +8,7 @@ import ${packageName}.${moduleName}.model.vo.${entityName}VO; import org.apache.ibatis.annotations.Mapper; /** - * $!{businessName}Mapper接口 + * $!{businessName.trim()}Mapper接口 * * @author ${author} * @since ${date} @@ -17,7 +17,7 @@ import org.apache.ibatis.annotations.Mapper; public interface ${entityName}Mapper extends BaseMapper<${entityName}> { /** - * 获取${businessName}分页数据 + * 获取${businessName.trim()}分页数据 * * @param page 分页对象 * @param queryParams 查询参数 diff --git a/src/main/resources/templates/codegen/mapper.xml.vm b/src/main/resources/templates/codegen/mapper.xml.vm index f690e0ee..63e3254a 100644 --- a/src/main/resources/templates/codegen/mapper.xml.vm +++ b/src/main/resources/templates/codegen/mapper.xml.vm @@ -2,7 +2,7 @@ - + SELECT #if($fieldConfigs) diff --git a/src/main/resources/templates/codegen/query.java.vm b/src/main/resources/templates/codegen/query.java.vm index 48b7bfdf..d9716036 100644 --- a/src/main/resources/templates/codegen/query.java.vm +++ b/src/main/resources/templates/codegen/query.java.vm @@ -13,12 +13,12 @@ import java.math.BigDecimal; #end /** - * $!{businessName.trim()}分页查询对象 + * $!{businessName}分页查询对象 * * @author ${author} * @since ${date} */ -@Schema(description ="$!{businessName.trim()}查询对象") +@Schema(description ="$!{businessName}查询对象") @Getter @Setter public class ${entityName}Query extends BasePageQuery { diff --git a/src/main/resources/templates/codegen/service.java.vm b/src/main/resources/templates/codegen/service.java.vm index 44538bec..08dec1b7 100644 --- a/src/main/resources/templates/codegen/service.java.vm +++ b/src/main/resources/templates/codegen/service.java.vm @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; /** - * $!{businessName.trim()}服务类 + * $!{businessName}服务类 * * @author ${author} * @since ${date} @@ -16,41 +16,41 @@ import com.baomidou.mybatisplus.extension.service.IService; public interface ${entityName}Service extends IService<${entityName}> { /** - *$!{businessName.trim()}分页列表 + *$!{businessName}分页列表 * * @return */ IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams); /** - * 获取${businessName.trim()}表单数据 + * 获取${businessName}表单数据 * - * @param id $!{businessName.trim()}ID + * @param id $!{businessName}ID * @return */ ${entityName}Form get${entityName}FormData(Long id); /** - * 新增${businessName.trim()} + * 新增${businessName} * - * @param formData $!{businessName.trim()}表单对象 + * @param formData $!{businessName}表单对象 * @return */ boolean save${entityName}(${entityName}Form formData); /** - * 修改${businessName.trim()} + * 修改${businessName} * - * @param id $!{businessName.trim()}ID - * @param formData $!{businessName.trim()}表单对象 + * @param id $!{businessName}ID + * @param formData $!{businessName}表单对象 * @return */ boolean update${entityName}(Long id, ${entityName}Form formData); /** - * 删除${businessName.trim()} + * 删除${businessName} * - * @param ids $!{businessName.trim()}ID,多个以英文逗号(,)分割 + * @param ids $!{businessName}ID,多个以英文逗号(,)分割 * @return */ boolean delete${entityName}s(String ids); diff --git a/src/main/resources/templates/codegen/serviceImpl.java.vm b/src/main/resources/templates/codegen/serviceImpl.java.vm index 6a304514..6d74c712 100644 --- a/src/main/resources/templates/codegen/serviceImpl.java.vm +++ b/src/main/resources/templates/codegen/serviceImpl.java.vm @@ -21,7 +21,7 @@ import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; /** - * $!{businessName.trim()}服务实现类 + * $!{businessName}服务实现类 * * @author ${author} * @since ${date} @@ -33,10 +33,10 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ private final ${entityName}Converter ${lowerFirstEntityName}Converter; /** - * 获取${businessName.trim()}分页列表 + * 获取${businessName}分页列表 * * @param queryParams 查询参数 - * @return {@link IPage<${entityName}VO>} $!{businessName.trim()}分页列表 + * @return {@link IPage<${entityName}VO>} $!{businessName}分页列表 */ @Override public IPage<${entityName}VO> get${entityName}Page(${entityName}Query queryParams) { @@ -48,9 +48,9 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ } /** - * 获取${businessName.trim()}表单数据 + * 获取${businessName}表单数据 * - * @param id $!{businessName.trim()}ID + * @param id $!{businessName}ID * @return */ @Override @@ -60,9 +60,9 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ } /** - * 新增${businessName.trim()} + * 新增${businessName} * - * @param formData $!{businessName.trim()}表单对象 + * @param formData $!{businessName}表单对象 * @return */ @Override @@ -72,10 +72,10 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ } /** - * 更新${businessName.trim()} + * 更新${businessName} * - * @param id $!{businessName.trim()}ID - * @param formData $!{businessName.trim()}表单对象 + * @param id $!{businessName}ID + * @param formData $!{businessName}表单对象 * @return */ @Override @@ -85,14 +85,14 @@ public class ${entityName}ServiceImpl extends ServiceImpl<${entityName}Mapper, $ } /** - * 删除${businessName.trim()} + * 删除${businessName} * - * @param ids $!{businessName.trim()}ID,多个以英文逗号(,)分割 + * @param ids $!{businessName}ID,多个以英文逗号(,)分割 * @return */ @Override public boolean delete${entityName}s(String ids) { - Assert.isTrue(StrUtil.isNotBlank(ids), "删除的${businessName.trim()}数据为空"); + Assert.isTrue(StrUtil.isNotBlank(ids), "删除的${businessName}数据为空"); // 逻辑删除 List idList = Arrays.stream(ids.split(",")) .map(Long::parseLong) diff --git a/src/main/resources/templates/codegen/vo.java.vm b/src/main/resources/templates/codegen/vo.java.vm index ad0f5ad5..b08ae47c 100644 --- a/src/main/resources/templates/codegen/vo.java.vm +++ b/src/main/resources/templates/codegen/vo.java.vm @@ -14,14 +14,14 @@ import java.math.BigDecimal; #end /** - * $!{businessName.trim()}视图对象 + * $!{businessName}视图对象 * * @author ${author} * @since ${date} */ @Getter @Setter -@Schema( description = "$!{businessName.trim()}视图对象") +@Schema( description = "$!{businessName}视图对象") public class ${entityName}VO implements Serializable { @Serial From 864006aec3c81b8f265ecf960b89e41a4a18a76d Mon Sep 17 00:00:00 2001 From: Ky10 <7703482+ky10_code@user.noreply.gitee.com> Date: Mon, 28 Oct 2024 19:14:59 +0800 Subject: [PATCH 20/25] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E7=94=9F=E6=88=90=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在移除表注释中的"表"字后,增加 trim 操作去除前后空格- 提高了代码生成的准确性和美观性 --- .../boot/shared/codegen/service/impl/GenConfigServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java b/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java index deb5cc31..bb6601f4 100644 --- a/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java +++ b/src/main/java/com/youlai/boot/shared/codegen/service/impl/GenConfigServiceImpl.java @@ -80,7 +80,7 @@ public class GenConfigServiceImpl extends ServiceImpl Date: Mon, 28 Oct 2024 19:48:56 +0800 Subject: [PATCH 21/25] =?UTF-8?q?refactor(module):=20=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?API=20=E5=AF=BC=E5=85=A5=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 API导入路径从 "@/api/${kebabCaseEntityName}" 修改为 "@/api/${moduleName}/${kebabCaseEntityName}" - 此修改提高了项目结构的可维护性和可扩展性 --- src/main/resources/templates/codegen/index.vue.vm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/codegen/index.vue.vm b/src/main/resources/templates/codegen/index.vue.vm index 8a486510..3cfdce5b 100644 --- a/src/main/resources/templates/codegen/index.vue.vm +++ b/src/main/resources/templates/codegen/index.vue.vm @@ -256,7 +256,7 @@ inheritAttrs: false, }); - import ${entityName}API, { ${entityName}PageVO, ${entityName}Form, ${entityName}PageQuery } from "@/api/${kebabCaseEntityName}"; + import ${entityName}API, { ${entityName}PageVO, ${entityName}Form, ${entityName}PageQuery } from "@/api/${moduleName}/${kebabCaseEntityName}"; const queryFormRef = ref(ElForm); const dataFormRef = ref(ElForm); From a682ca725c82f5688deb3c9bc1b71cef7da96073 Mon Sep 17 00:00:00 2001 From: Ky10 <7703482+ky10_code@user.noreply.gitee.com> Date: Mon, 28 Oct 2024 19:59:39 +0800 Subject: [PATCH 22/25] =?UTF-8?q?refactor:=20=E5=B0=86=20dictionary=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BA=20dict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在查询表单和数据表单中,将 标签替换为 - 该改动统一了字典组件的使用,提高了代码的一致性和可维护性 --- src/main/resources/templates/codegen/index.vue.vm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/templates/codegen/index.vue.vm b/src/main/resources/templates/codegen/index.vue.vm index 3cfdce5b..9b3ed967 100644 --- a/src/main/resources/templates/codegen/index.vue.vm +++ b/src/main/resources/templates/codegen/index.vue.vm @@ -14,7 +14,7 @@ /> #elseif($fieldConfig.formType == "SELECT") #if($fieldConfig.dictType != "") - + #else @@ -187,7 +187,7 @@ /> #elseif($fieldConfig.formType == "SELECT") #if($fieldConfig.dictType != "") - + #else From e1f61e2d228944744fd42cc85c7fc318ae46caf7 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Wed, 30 Oct 2024 15:16:25 +0800 Subject: [PATCH 23/25] =?UTF-8?q?refactor:=20banner.txt=20=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=9A=84=E7=89=88=E6=9C=AC=E5=8F=B7=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=20pom.xml=20=E7=9A=84=20project.version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/application.yml | 2 ++ src/main/resources/banner.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 27ddf31e..979258be 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -3,6 +3,8 @@ spring: name: youlai-boot profiles: active: dev +project: + version: @project.version@ # 代码生成器配置 codegen: diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index c8ffd395..c3c28124 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -7,7 +7,7 @@ ${AnsiColor.BRIGHT_BLUE} |_|\___/ \__,_| |______\__,_|_| ${AnsiColor.BRIGHT_GREEN} -YouLai Boot Version: 2.8.1 +YouLai Boot Version: ${project.version} Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} 有来官网: https://www.youlai.tech/ 版权所属: 有来开源组织 From 308ae7d147cba554ed1d679e969eae5b0b202b57 Mon Sep 17 00:00:00 2001 From: "Ray.Hao" <1490493387@qq.com> Date: Thu, 31 Oct 2024 01:23:39 +0800 Subject: [PATCH 24/25] =?UTF-8?q?refactor:=20=E9=87=8D=E6=9E=84=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增字典编码枚举 DictCodeEnum -移除 GenderEnum 枚举- 更新 NoticePublishStatusEnum 枚举 - 修改 UserConverter 接口 - 重构 UserImportListener 类 - 更新 UserPageVO 数据结构 --- .../boot/system/converter/UserConverter.java | 3 -- .../boot/system/enums/DictCodeEnum.java | 28 +++++++++++++++++++ .../youlai/boot/system/enums/GenderEnum.java | 28 ------------------- .../system/enums/NoticePublishStatusEnum.java | 2 +- .../system/listener/UserImportListener.java | 27 ++++++++++-------- .../boot/system/model/vo/UserPageVO.java | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 src/main/java/com/youlai/boot/system/enums/DictCodeEnum.java delete mode 100644 src/main/java/com/youlai/boot/system/enums/GenderEnum.java diff --git a/src/main/java/com/youlai/boot/system/converter/UserConverter.java b/src/main/java/com/youlai/boot/system/converter/UserConverter.java index 9379954e..96840c8a 100644 --- a/src/main/java/com/youlai/boot/system/converter/UserConverter.java +++ b/src/main/java/com/youlai/boot/system/converter/UserConverter.java @@ -23,9 +23,6 @@ import org.mapstruct.Mappings; @Mapper(componentModel = "spring") public interface UserConverter { - @Mappings({ - @Mapping(target = "genderLabel", expression = "java(com.youlai.boot.common.base.IBaseEnum.getLabelByValue(bo.getGender(), com.youlai.boot.system.enums.GenderEnum.class))") - }) UserPageVO toPageVo(UserBO bo); Page toPageVo(Page bo); diff --git a/src/main/java/com/youlai/boot/system/enums/DictCodeEnum.java b/src/main/java/com/youlai/boot/system/enums/DictCodeEnum.java new file mode 100644 index 00000000..add33329 --- /dev/null +++ b/src/main/java/com/youlai/boot/system/enums/DictCodeEnum.java @@ -0,0 +1,28 @@ +package com.youlai.boot.system.enums; + +import com.youlai.boot.common.base.IBaseEnum; +import lombok.Getter; + +/** + * 字典编码枚举 + * + * @author Ray + * @since 2024/10/30 + */ +@Getter +public enum DictCodeEnum implements IBaseEnum { + + GENDER("gender", "性别"), + NOTICE_TYPE("notice_type", "通知类型"), + NOTICE_LEVEL("notice_level", "通知级别"); + + private final String value; + + private final String label; + + DictCodeEnum(String value, String label) { + this.value = value; + this.label = label; + } + +} diff --git a/src/main/java/com/youlai/boot/system/enums/GenderEnum.java b/src/main/java/com/youlai/boot/system/enums/GenderEnum.java deleted file mode 100644 index 114fd543..00000000 --- a/src/main/java/com/youlai/boot/system/enums/GenderEnum.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.youlai.boot.system.enums; - -import com.youlai.boot.common.base.IBaseEnum; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Getter; - -/** - * 性别枚举 - * - * @author haoxr - * @since 2022/10/14 - */ -@Getter -@Schema(enumAsRef = true) -public enum GenderEnum implements IBaseEnum { - - MALE(1, "男"), - FEMALE (2, "女"); - - private final Integer value; - - private final String label; - - GenderEnum(Integer value, String label) { - this.value = value; - this.label = label; - } -} diff --git a/src/main/java/com/youlai/boot/system/enums/NoticePublishStatusEnum.java b/src/main/java/com/youlai/boot/system/enums/NoticePublishStatusEnum.java index f7f5d007..cd5e718e 100644 --- a/src/main/java/com/youlai/boot/system/enums/NoticePublishStatusEnum.java +++ b/src/main/java/com/youlai/boot/system/enums/NoticePublishStatusEnum.java @@ -8,7 +8,7 @@ import lombok.Getter; * 通告发布状态枚举 * * @author haoxr - * @since 2022/10/14 + * @since 2024/10/14 */ @Getter @Schema(enumAsRef = true) diff --git a/src/main/java/com/youlai/boot/system/listener/UserImportListener.java b/src/main/java/com/youlai/boot/system/listener/UserImportListener.java index 65c470df..4d5cc56f 100644 --- a/src/main/java/com/youlai/boot/system/listener/UserImportListener.java +++ b/src/main/java/com/youlai/boot/system/listener/UserImportListener.java @@ -8,20 +8,14 @@ import cn.hutool.json.JSONUtil; import com.alibaba.excel.context.AnalysisContext; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.youlai.boot.common.base.BaseAnalysisEventListener; -import com.youlai.boot.system.enums.GenderEnum; -import com.youlai.boot.system.model.entity.Dept; -import com.youlai.boot.system.model.entity.Role; -import com.youlai.boot.system.model.entity.User; -import com.youlai.boot.system.model.entity.UserRole; +import com.youlai.boot.system.enums.DictCodeEnum; +import com.youlai.boot.system.model.entity.*; import com.youlai.boot.common.base.IBaseEnum; import com.youlai.boot.common.constant.SystemConstants; import com.youlai.boot.common.enums.StatusEnum; import com.youlai.boot.system.converter.UserConverter; import com.youlai.boot.system.model.dto.UserImportDTO; -import com.youlai.boot.system.service.DeptService; -import com.youlai.boot.system.service.RoleService; -import com.youlai.boot.system.service.UserRoleService; -import com.youlai.boot.system.service.UserService; +import com.youlai.boot.system.service.*; import lombok.extern.slf4j.Slf4j; import org.springframework.security.crypto.password.PasswordEncoder; @@ -55,6 +49,7 @@ public class UserImportListener extends BaseAnalysisEventListener private final RoleService roleService; private final UserRoleService userRoleService; private final DeptService deptService; + private final DictDataService dictDataService; public UserImportListener() { this.userService = SpringUtil.getBean(UserService.class); @@ -62,6 +57,7 @@ public class UserImportListener extends BaseAnalysisEventListener this.roleService = SpringUtil.getBean(RoleService.class); this.userRoleService = SpringUtil.getBean(UserRoleService.class); this.deptService = SpringUtil.getBean(DeptService.class); + this.dictDataService = SpringUtil.getBean(DictDataService.class); this.userConverter = SpringUtil.getBean(UserConverter.class); } @@ -107,11 +103,18 @@ public class UserImportListener extends BaseAnalysisEventListener // 校验通过,持久化至数据库 User entity = userConverter.toEntity(userImportDTO); entity.setPassword(passwordEncoder.encode(SystemConstants.DEFAULT_PASSWORD)); // 默认密码 - // 性别逆向解析 + // 性别逆向翻译 根据字典标签得到字典值 String genderLabel = userImportDTO.getGenderLabel(); if (StrUtil.isNotBlank(genderLabel)) { - Integer genderValue = (Integer) IBaseEnum.getValueByLabel(genderLabel, GenderEnum.class); - entity.setGender(genderValue); + DictData dictData = dictDataService.getOne(new LambdaQueryWrapper() + .eq(DictData::getDictCode, DictCodeEnum.GENDER.getValue()) + .eq(DictData::getLabel, genderLabel) + .last("limit 1") + ); + if (dictData != null) { + Integer genderValue = Integer.parseInt(dictData.getValue()); + entity.setGender(genderValue); + } } // 角色解析 String roleCodes = userImportDTO.getRoleCodes(); diff --git a/src/main/java/com/youlai/boot/system/model/vo/UserPageVO.java b/src/main/java/com/youlai/boot/system/model/vo/UserPageVO.java index 770a9424..abd2ddbe 100644 --- a/src/main/java/com/youlai/boot/system/model/vo/UserPageVO.java +++ b/src/main/java/com/youlai/boot/system/model/vo/UserPageVO.java @@ -29,7 +29,7 @@ public class UserPageVO { private String mobile; @Schema(description="性别") - private String genderLabel; + private Integer gender; @Schema(description="用户头像地址") private String avatar; From 138b7005d2cdcd074c1f6ab955c6f2f77a46a225 Mon Sep 17 00:00:00 2001 From: Time Lord <2393686479@qq.com> Date: Sun, 3 Nov 2024 20:54:59 +0800 Subject: [PATCH 25/25] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=99=90?= =?UTF-8?q?=E6=B5=81=E6=96=B9=E6=B3=95doFilterInternal=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/youlai/boot/core/filter/RateLimiterFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/youlai/boot/core/filter/RateLimiterFilter.java b/src/main/java/com/youlai/boot/core/filter/RateLimiterFilter.java index 62de5609..eba72de6 100644 --- a/src/main/java/com/youlai/boot/core/filter/RateLimiterFilter.java +++ b/src/main/java/com/youlai/boot/core/filter/RateLimiterFilter.java @@ -61,7 +61,7 @@ public class RateLimiterFilter extends OncePerRequestFilter { /** * IP限流过滤器 - * 默认情况下:限制同一个IP在一分钟内只能访问10次,可以通过修改系统配置进行调整 + * 默认情况下:限制同一个IP在一秒内只能访问10次,可以通过修改系统配置进行调整 * * @param request 请求体 * @param response 响应体