This commit is contained in:
Kang_Yang
2024-11-05 13:24:14 +08:00
44 changed files with 302 additions and 363 deletions

View File

@@ -6,7 +6,7 @@
<groupId>com.youlai</groupId>
<artifactId>youlai-boot</artifactId>
<version>2.14.0</version>
<version>2.15.0</version>
<description>基于 Java 17 + SpringBoot 3 + Spring Security 构建的权限管理系统。</description>
<parent>

View File

@@ -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
-- ----------------------------
@@ -439,14 +421,13 @@ 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
-- ----------------------------
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地址',
@@ -462,7 +443,6 @@ CREATE TABLE `sys_log` (
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB ROW_FORMAT=DYNAMIC COMMENT='系统日志表';
-- ----------------------------
-- Table structure for gen_config
-- ----------------------------

View File

@@ -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
@@ -246,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
@@ -447,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地址',
@@ -470,12 +417,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 +438,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 +452,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 '通知类型(字典codenotice_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 '通知等级字典codenotice_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 +502,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;
-- 提交事务

View File

@@ -61,7 +61,7 @@ public class RateLimiterFilter extends OncePerRequestFilter {
/**
* IP限流过滤器
* 默认情况下限制同一个IP在一分钟内只能访问10次可以通过修改系统配置进行调整
* 默认情况下限制同一个IP在一内只能访问10次可以通过修改系统配置进行调整
*
* @param request 请求体
* @param response 响应体

View File

@@ -73,8 +73,8 @@ public enum FormTypeEnum implements IBaseEnum<Integer> {
@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;
}

View File

@@ -169,14 +169,18 @@ 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)) {
// 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
@@ -241,8 +245,6 @@ public class CodegenServiceImpl implements CodegenService {
hasRequiredField = true;
}
fieldConfig.setTsType(JavaTypeEnum.getTsTypeByJavaType(fieldConfig.getFieldType()));
}
bindMap.put("hasLocalDateTime", hasLocalDateTime);

View File

@@ -80,7 +80,7 @@ public class GenConfigServiceImpl extends ServiceImpl<GenConfigMapper, GenConfig
String tableComment = tableMetadata.getTableComment();
if (StrUtil.isNotBlank(tableComment)) {
genConfig.setBusinessName(tableComment.replace("", ""));
genConfig.setBusinessName(tableComment.replace("", "").trim());
}
// 实体类名 = 表名去掉前缀后转驼峰,前缀默认为下划线分割的第一个元素
String entityName = StrUtil.toCamelCase(StrUtil.removePrefix(tableName, tableName.split("_")[0]));
@@ -132,7 +132,7 @@ public class GenConfigServiceImpl extends ServiceImpl<GenConfigMapper, GenConfig
genFieldConfigs.add(fieldConfig);
}
}
//genFieldConfigs按照fieldSort排序
//genFieldConfigs 按照 fieldSort 排序
genFieldConfigs = genFieldConfigs.stream().sorted(Comparator.comparing(GenFieldConfig::getFieldSort)).toList();
GenConfigForm genConfigForm = codegenConverter.toGenConfigForm(genConfig, genFieldConfigs);

View File

@@ -17,7 +17,6 @@ import org.springdoc.core.annotations.ParameterObject;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
/**
* 系统配置前端控制层
*

View File

@@ -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<List<Option<String>>> getDictList() {
List<Option<String>> list = dictService.getDictList();
public Result<List<DictVO>> getAllDictWithData() {
List<DictVO> list = dictService.getAllDictWithData();
return Result.success(list);
}

View File

@@ -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<UserPageVO> toPageVo(Page<UserBO> bo);

View File

@@ -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<String> {
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;
}
}

View File

@@ -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<Integer> {
MALE(1, ""),
FEMALE (2, "");
private final Integer value;
private final String label;
GenderEnum(Integer value, String label) {
this.value = value;
this.label = label;
}
}

View File

@@ -8,7 +8,7 @@ import lombok.Getter;
* 通告发布状态枚举
*
* @author haoxr
* @since 2022/10/14
* @since 2024/10/14
*/
@Getter
@Schema(enumAsRef = true)

View File

@@ -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<UserImportDTO>
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<UserImportDTO>
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<UserImportDTO>
// 校验通过,持久化至数据库
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<DictData>()
.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();

View File

@@ -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;

View File

@@ -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<Dict> {
* @return
*/
Page<DictPageVO> getDictPage(Page<DictPageVO> page, DictPageQuery queryParams);
/**
* 获取所有字典和字典数据
*
* @return
*/
List<DictVO> getAllDictWithData();
}

View File

@@ -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 {
@@ -51,7 +51,6 @@ public class Config extends BaseEntity {
/**
* 逻辑删除标识(0-未删除 1-已删除)
*/
@TableLogic(value = "0", delval = "1")
private Integer isDeleted;
}

View File

@@ -58,9 +58,8 @@ public class Dept extends BaseEntity {
private Long updateBy;
/**
* 逻辑删除标识(0-未删除 1-已删除)
* 是否删除(0-否 1-是)
*/
@TableLogic(value = "0", delval = "1")
private Integer isDeleted;
}

View File

@@ -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 {
/**
@@ -37,4 +37,9 @@ public class Dict extends BaseEntity {
*/
private String remark;
/**
* 逻辑删除标识(0-未删除 1-已删除)
*/
private Integer isDeleted;
}

View File

@@ -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 {

View File

@@ -79,9 +79,9 @@ public class Notice extends BaseEntity {
* 更新人ID
*/
private Long updateBy;
/**
* 逻辑删除标识(0-未删除 1-已删除)
*/
@TableLogic(value = "0", delval = "1")
private Integer isDeleted;
}

View File

@@ -50,4 +50,9 @@ public class Role extends BaseEntity {
* 更新人 ID
*/
private Long updateBy;
/**
* 是否删除(0-否 1-是)
*/
private Integer isDeleted;
}

View File

@@ -67,4 +67,9 @@ public class User extends BaseEntity {
* 更新人 ID
*/
private Long updateBy;
/**
* 是否删除(0-否 1-是)
*/
private Integer isDeleted;
}

View File

@@ -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;
}

View File

@@ -7,7 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description ="字典数据分页查询对象")
public class DictDataPageQuery extends BasePageQuery {

View File

@@ -7,7 +7,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@Schema(description ="字典数据项分页查询对象")
public class DictPageQuery extends BasePageQuery {

View File

@@ -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 {

View File

@@ -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<String> readTime;
}

View File

@@ -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;
}

View File

@@ -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 {

View File

@@ -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<DictData> dictDataList;
@Schema(description = "字典数据")
@Getter
@Setter
public static class DictData {
@Schema(description = "字典数据值")
private String value;
@Schema(description = "字典数据标签")
private String label;
@Schema(description = "标签类型")
private String tagType;
}
}

View File

@@ -29,7 +29,7 @@ public class UserPageVO {
private String mobile;
@Schema(description="性别")
private String genderLabel;
private Integer gender;
@Schema(description="用户头像地址")
private String avatar;

View File

@@ -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<Dict> {
/**
* 修改字典
*
* @param id
* @param id 字典ID
* @param dictForm 字典表单
* @return
*/
@@ -63,19 +64,10 @@ public interface DictService extends IService<Dict> {
void deleteDictByIds(String idsStr);
/**
* 获取字典的数据项
*
* @param code 字典编码
* @return
*/
List<Option<Long>> listDictItemsByCode(String code);
/**
* 获取字典列表
*
* @return
*/
List<Option<String>> getDictList();
List<DictVO> getAllDictWithData();
}

View File

@@ -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<DictMapper, Dict> implements Di
}
/**
* 获取字典数据
*
* @param code 字典编码
* 获取所有字典和字典数据
*/
@Override
public List<Option<Long>> listDictItemsByCode(String code) {
// 根据字典编码获取字典ID
Dict dict = this.getOne(new LambdaQueryWrapper<Dict>()
.eq(Dict::getDictCode, code)
.select(Dict::getId)
.last("limit 1")
);
// 如果字典不存在,则返回空集合
if (dict == null) {
return CollectionUtil.newArrayList();
}
// 获取字典项
List<DictData> dictData = dictDataService.list(
new LambdaQueryWrapper<DictData>()
.eq(DictData::getDictCode, dict.getDictCode())
);
// 转换为 Option
return dictDataConverter.toOption(dictData);
}
/**
* 获取字典列表
*/
@Override
public List<Option<String>> getDictList() {
return this.list(new LambdaQueryWrapper<Dict>()
.eq(Dict::getStatus, 1)
.select(Dict::getName, Dict::getDictCode)
).stream()
.map(dict -> new Option<>(dict.getDictCode(), dict.getName()))
.toList();
public List<DictVO> getAllDictWithData() {
return this.baseMapper.getAllDictWithData();
}
}

View File

@@ -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
# 逻辑删除-未删除值

View File

@@ -46,7 +46,7 @@ mybatis-plus:
# 主键ID类型
id-type: none
# 逻辑删除字段名称
logic-delete-field: is_deleted
logic-delete-field: isDeleted
# 逻辑删除-删除值
logic-delete-value: 1
# 逻辑删除-未删除值

View File

@@ -3,6 +3,8 @@ spring:
name: youlai-boot
profiles:
active: dev
project:
version: @project.version@
# 代码生成器配置
codegen:

View File

@@ -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/
版权所属: 有来开源组织

View File

@@ -30,14 +30,16 @@
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} -%5level ---[%15.15thread] %-40.40logger{39} : %msg%n%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志记录器的滚动策略,按大小和时间记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 滚动后的日志文件命名模式 -->
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!--日志文档保留天数-->
<!-- 单个日志文件的最大大小 -->
<maxFileSize>10MB</maxFileSize>
<!-- 最大保留30天的日志 -->
<maxHistory>30</maxHistory>
<!-- 总日志文件大小不超过3GB -->
<totalSizeCap>1GB</totalSizeCap>
</rollingPolicy>
<!-- 临界值过滤器输出大于INFO级别日志 -->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
@@ -59,4 +61,4 @@
<appender-ref ref="FILE"/>
</root>
</springProfile>
</configuration>
</configuration>

View File

@@ -35,12 +35,26 @@
value,
label
FROM
sys_dict_data
sys_dict_data
<where>
dict_code = #{dictCode}
</where>
ORDER BY
sort ASC
sort ASC
</select>
<!-- 根据字典编码获取字典数据列表 -->
<select id="getDictDataList" resultType="com.youlai.boot.system.model.vo.DictVO$DictData">
SELECT
value,
label,
tag_type
FROM
sys_dict_data
WHERE
status = 1 AND dict_code = #{dictCode}
ORDER BY
sort ASC
</select>
</mapper>

View File

@@ -25,4 +25,26 @@
ORDER BY
t1.create_time DESC
</select>
<resultMap id="DictWithDataMap" type="com.youlai.boot.system.model.vo.DictVO">
<result column="name" property="name"/>
<result column="dict_code" property="dictCode"/>
<collection property="dictDataList"
column="{dictCode=dict_code}"
select="com.youlai.boot.system.mapper.DictDataMapper.getDictDataList">
</collection>
</resultMap>
<!-- 获取所有字典和字典数据 -->
<select id="getAllDictWithData" resultMap="DictWithDataMap">
SELECT
t1.name,
t1.dict_code
FROM
sys_dict t1
WHERE
t1.is_deleted = 0 AND t1.status = 1
ORDER BY
t1.create_time DESC
</select>
</mapper>

View File

@@ -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<any, PageResult<${entityName}PageVO[]>>({
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<any, ${entityName}Form>({
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",

View File

@@ -14,7 +14,7 @@
/>
#elseif($fieldConfig.formType == "SELECT")
#if($fieldConfig.dictType != "")
<dictionary v-model="queryParams.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
<dict v-model="queryParams.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
#else
<el-select v-model="queryParams.$fieldConfig.fieldName" placeholder="请选择$fieldConfig.fieldComment">
<el-option :key="1" :value="1" label="选项一"/>
@@ -187,7 +187,7 @@
/>
#elseif($fieldConfig.formType == "SELECT")
#if($fieldConfig.dictType != "")
<dictionary v-model="formData.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
<dict v-model="formData.$fieldConfig.fieldName" code="$fieldConfig.dictType" />
#else
<el-select v-model="formData.$fieldConfig.fieldName" placeholder="请选择$fieldConfig.fieldComment">
<el-option :value="0" label="选项一"/>
@@ -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);

View File

@@ -49,7 +49,7 @@ public class SystemCodeGenerator {
.injectionConfig(consumer -> {
List<CustomFile> 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());