From 1eba84910eb809dc5d90dcd9c084b63d873b535a Mon Sep 17 00:00:00 2001 From: RB Date: Sat, 28 Dec 2024 18:40:14 +0800 Subject: [PATCH 01/15] Fixs timestamp to datetime --- .../core/metadata/impl/Entity2Schema.java | 2 +- .../core/metadata/impl/Field2Schema.java | 14 ++++---- .../rebuild/core/metadata/impl/Table40.java | 34 +++++++++++++++++++ 3 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/rebuild/core/metadata/impl/Table40.java diff --git a/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java b/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java index bf14d531ee..c3f59a4df9 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Entity2Schema.java @@ -271,7 +271,7 @@ private Field createBuiltinField(Entity entity, String fieldName, String fieldLa */ private boolean schema2Database(Entity entity) { Dialect dialect = Application.getPersistManagerFactory().getDialect(); - Table table = new Table(entity, dialect); + Table table = new Table40(entity, dialect); String[] ddls = table.generateDDL(false, false, false); try { diff --git a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java index bc1ac49ddb..07f485d2d0 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java @@ -168,9 +168,9 @@ public boolean dropField(Field field, boolean force) { } catch (Throwable ex) { // ? if (ThrowableUtils.getRootCause(ex).getLocalizedMessage().contains("exists")) { - log.warn("Column not exists? " + ex.getLocalizedMessage()); + log.warn("Column not exists? {}", ex.getLocalizedMessage()); } else { - log.error("DDL ERROR : \n" + ddl, ex); + log.error("DDL ERROR : \n{}", ddl, ex); return false; } } @@ -208,7 +208,7 @@ public boolean schema2Database(Entity entity, Field[] fields) { */ public boolean schema2Database(Entity entity, Field[] fields, Collection uniqueKeyFields) { Dialect dialect = Application.getPersistManagerFactory().getDialect(); - final Table table = new Table(entity, dialect); + final Table table = new Table40(entity, dialect); final String alterSql = "alter table `" + entity.getPhysicalName() + "`"; // H2 只能一个个字段的加 @@ -220,7 +220,7 @@ public boolean schema2Database(Entity entity, Field[] fields, Collection try { Application.getSqlExecutor().executeBatch(new String[]{ddl.toString()}, DDL_TIMEOUT); } catch (Throwable ex) { - log.error("DDL ERROR : \n" + ddl, ex); + log.error("DDL ERROR : \n{}", ddl, ex); return false; } } @@ -249,9 +249,9 @@ public boolean schema2Database(Entity entity, Field[] fields, Collection // Duplicate column name: 'xxx' if (fields.length == 1 && ThrowableUtils.getRootCause(ex).getLocalizedMessage().contains("Duplicate column")) { - log.warn("Duplicate column exists? " + ex.getLocalizedMessage()); + log.warn("Duplicate column exists? {}", ex.getLocalizedMessage()); } else { - log.error("DDL ERROR : \n" + ddl, ex); + log.error("DDL ERROR : \n{}", ddl, ex); return false; } } @@ -487,7 +487,7 @@ public boolean castType(Field field, DisplayType toType, boolean force) { String alterTypeSql = null; try { Dialect dialect = Application.getPersistManagerFactory().getDialect(); - final Table table = new Table(field.getOwnEntity(), dialect); + final Table table = new Table40(field.getOwnEntity(), dialect); StringBuilder ddl = new StringBuilder(); table.generateFieldDDL(field, ddl); diff --git a/src/main/java/com/rebuild/core/metadata/impl/Table40.java b/src/main/java/com/rebuild/core/metadata/impl/Table40.java new file mode 100644 index 0000000000..82da2b9eeb --- /dev/null +++ b/src/main/java/com/rebuild/core/metadata/impl/Table40.java @@ -0,0 +1,34 @@ +/*! +Copyright (c) REBUILD and/or its owners. All rights reserved. + +rebuild is dual-licensed under commercial and open source licenses (GPLv3). +See LICENSE and COMMERCIAL in the project root for license information. +*/ + +package com.rebuild.core.metadata.impl; + +import cn.devezhao.persist4j.Entity; +import cn.devezhao.persist4j.Field; +import cn.devezhao.persist4j.dialect.Dialect; +import cn.devezhao.persist4j.util.support.Table; + +/** + * Fixs timestamp to datetime + * + * @author Zixin (RB) + * @since 12/28/2024 + */ +public class Table40 extends Table { + + public Table40(Entity entity, Dialect dialect) { + super(entity, dialect); + } + + @Override + public void generateFieldDDL(Field field, StringBuilder into, boolean allowZeroDate) { + StringBuilder tmp = new StringBuilder(); + super.generateFieldDDL(field, tmp, allowZeroDate); + String tmpFix = tmp.toString().replace(" timestamp ", " datetime "); + into.append(tmpFix); + } +} From 31b58e55aa2b4d31c5d119b537f2bb63732cea7e Mon Sep 17 00:00:00 2001 From: RB Date: Sat, 28 Dec 2024 18:40:29 +0800 Subject: [PATCH 02/15] rebuild40 --- .travis.yml | 6 +++--- .../java/com/rebuild/core/BootEnvironmentPostProcessor.java | 2 +- src/main/resources/application-dev.yml | 2 +- src/main/resources/scripts/db-init.sql | 6 +++--- src/main/resources/web/assets/js/admin/setup-install.js | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index f84781d49b..a18d810c9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,9 @@ git: submodules: false before_script: - - mysql -e "CREATE DATABASE rebuild30 COLLATE utf8mb4_general_ci;" - - mysql -e "CREATE USER 'rebuild'@'127.0.0.1' IDENTIFIED BY 'rebuild'; GRANT ALL PRIVILEGES ON rebuild30.* TO 'rebuild'@'127.0.0.1'; FLUSH PRIVILEGES;" - - mysql -D rebuild30 < src/main/resources/scripts/db-init.sql + - mysql -e "CREATE DATABASE rebuild40 COLLATE utf8mb4_general_ci;" + - mysql -e "CREATE USER 'rebuild'@'127.0.0.1' IDENTIFIED BY 'rebuild'; GRANT ALL PRIVILEGES ON rebuild40.* TO 'rebuild'@'127.0.0.1'; FLUSH PRIVILEGES;" + - mysql -D rebuild40 < src/main/resources/scripts/db-init.sql # codecov after_success: diff --git a/src/main/java/com/rebuild/core/BootEnvironmentPostProcessor.java b/src/main/java/com/rebuild/core/BootEnvironmentPostProcessor.java index dcc14d6b51..84bdb2e2d6 100644 --- a/src/main/java/com/rebuild/core/BootEnvironmentPostProcessor.java +++ b/src/main/java/com/rebuild/core/BootEnvironmentPostProcessor.java @@ -107,7 +107,7 @@ public void postProcessEnvironment(ConfigurableEnvironment env, SpringApplicatio // `application-bean.xml` 占位符必填 if (dbUrl == null) { - dbUrl = "jdbc:mysql://127.0.0.1:3306/rebuild30?characterEncoding=UTF8"; + dbUrl = "jdbc:mysql://127.0.0.1:3306/rebuild40?characterEncoding=UTF8"; confPs.put("db.url", dbUrl); } if (env.getProperty("db.user") == null) confPs.put("db.user", "rebuild"); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index cad6fc373f..1cc81c3310 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ # !!! `db.*` ONLY FOR DEV MODE !!! -db.url: jdbc:mysql://127.0.0.1:3306/rebuild30?characterEncoding=UTF8&useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B08:00 +db.url: jdbc:mysql://127.0.0.1:4653/rebuild40?characterEncoding=UTF8&useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B08:00 db.user: rebuild db.passwd: rebuild # Use built-in ehcache if redis not defined or unavailable diff --git a/src/main/resources/scripts/db-init.sql b/src/main/resources/scripts/db-init.sql index 1dc803b14c..18e5063071 100644 --- a/src/main/resources/scripts/db-init.sql +++ b/src/main/resources/scripts/db-init.sql @@ -7,12 +7,12 @@ -- #1 database/user -- 首次使用请移除以下注释以创建数据库和用户 /* -CREATE DATABASE rebuild30 COLLATE utf8mb4_general_ci; +CREATE DATABASE rebuild40 COLLATE utf8mb4_general_ci; CREATE USER 'rebuild'@'127.0.0.1' IDENTIFIED BY 'rebuild'; -GRANT ALL PRIVILEGES ON rebuild30.* TO 'rebuild'@'127.0.0.1'; +GRANT ALL PRIVILEGES ON rebuild40.* TO 'rebuild'@'127.0.0.1'; GRANT RELOAD ON *.* TO 'rebuild'@'127.0.0.1'; FLUSH PRIVILEGES; -USE rebuild30; +USE rebuild40; */ -- #2 schemas diff --git a/src/main/resources/web/assets/js/admin/setup-install.js b/src/main/resources/web/assets/js/admin/setup-install.js index 58d3b5abb3..67ce5a7f50 100644 --- a/src/main/resources/web/assets/js/admin/setup-install.js +++ b/src/main/resources/web/assets/js/admin/setup-install.js @@ -193,7 +193,7 @@ class DatabaseConf extends React.Component {
{$L('数据库名称')}
- +
{$L('如数据库不存在系统将自动创建')}
@@ -260,7 +260,7 @@ class DatabaseConf extends React.Component { dbType: 'mysql', dbHost: this.state.dbHost || '127.0.0.1', dbPort: this.state.dbPort || 3306, - dbName: this.state.dbName || 'rebuild30', + dbName: this.state.dbName || 'rebuild40', dbUser: this.state.dbUser || 'rebuild', dbPassword: this.state.dbPassword || 'rebuild', } From ab189fc875d1c70462be46e1bc216c147bcbe7b8 Mon Sep 17 00:00:00 2001 From: RB Date: Sat, 28 Dec 2024 19:09:36 +0800 Subject: [PATCH 03/15] fixs datetime40 --- @rbv | 2 +- .../core/metadata/impl/Field2Schema.java | 23 ++- .../rebuild/core/metadata/impl/Table40.java | 6 + src/main/resources/scripts/db-init.sql | 185 +++++++++--------- src/main/resources/scripts/db-upgrade.sql | 124 ++++++------ .../web/assets/js/metadata/field-edit.js | 7 +- .../com/rebuild/support/SchemaGenerator.java | 3 +- 7 files changed, 191 insertions(+), 159 deletions(-) diff --git a/@rbv b/@rbv index e2802498e7..c71189264c 160000 --- a/@rbv +++ b/@rbv @@ -1 +1 @@ -Subproject commit e2802498e73305c30663775a6bfa5bd195e84017 +Subproject commit c71189264c0352965be790dd074329644c9c33ae diff --git a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java index 07f485d2d0..3331d579a5 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Field2Schema.java @@ -493,7 +493,7 @@ public boolean castType(Field field, DisplayType toType, boolean force) { alterTypeSql = String.format("alter table `%s` change column `%s` ", field.getOwnEntity().getPhysicalName(), field.getPhysicalName()); - alterTypeSql += ddl.toString().trim().replace(" ", " "); + alterTypeSql += ddl.toString().trim().replaceAll("\\s+", " "); Application.getSqlExecutor().executeBatch(new String[]{alterTypeSql}, DDL_TIMEOUT); log.info("Cast field type : {}", alterTypeSql); @@ -519,4 +519,25 @@ public boolean castType(Field field, DisplayType toType, boolean force) { return true; } + + /** + * @param field + * @return + */ + public boolean fixsDatetime40(Field field) { + if (field.getType() != FieldType.TIMESTAMP) return false; + + Dialect dialect = Application.getPersistManagerFactory().getDialect(); + final Table table = new Table40(field.getOwnEntity(), dialect); + StringBuilder ddl = new StringBuilder(); + table.generateFieldDDL(field, ddl); + + String alterTypeSql = String.format("alter table `%s` change column `%s` ", + field.getOwnEntity().getPhysicalName(), field.getPhysicalName()); + alterTypeSql += ddl.toString().trim().replaceAll("\\s+", " "); + + Application.getSqlExecutor().executeBatch(new String[]{alterTypeSql}, DDL_TIMEOUT); + log.info("Fixs datetime field : {}", alterTypeSql); + return true; + } } diff --git a/src/main/java/com/rebuild/core/metadata/impl/Table40.java b/src/main/java/com/rebuild/core/metadata/impl/Table40.java index 82da2b9eeb..3277444fe2 100644 --- a/src/main/java/com/rebuild/core/metadata/impl/Table40.java +++ b/src/main/java/com/rebuild/core/metadata/impl/Table40.java @@ -12,6 +12,8 @@ import cn.devezhao.persist4j.dialect.Dialect; import cn.devezhao.persist4j.util.support.Table; +import java.util.List; + /** * Fixs timestamp to datetime * @@ -24,6 +26,10 @@ public Table40(Entity entity, Dialect dialect) { super(entity, dialect); } + public Table40(Entity entity, Dialect dialect, List indexList) { + super(entity, dialect, indexList); + } + @Override public void generateFieldDDL(Field field, StringBuilder into, boolean allowZeroDate) { StringBuilder tmp = new StringBuilder(); diff --git a/src/main/resources/scripts/db-init.sql b/src/main/resources/scripts/db-init.sql index 18e5063071..a41fa24665 100644 --- a/src/main/resources/scripts/db-init.sql +++ b/src/main/resources/scripts/db-init.sql @@ -32,12 +32,12 @@ create table if not exists `user` ( `ROLE_ID` char(20) comment '角色', `IS_DISABLED` char(1) default 'F' comment '是否禁用', `QUICK_CODE` varchar(50), - `SEQ` int(11) default '0' comment '排序 (小到大)', + `SEQ` int(11) default '0' comment '显示顺序', `EXTERNAL_ID` varchar(100) comment '外部用户ID', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`USER_ID`), unique index UIX0_user (`LOGIN_NAME`), unique index UIX1_user (`EMAIL`), @@ -53,12 +53,12 @@ create table if not exists `department` ( `PRINCIPAL_ID` char(20) comment '负责人', `IS_DISABLED` char(1) default 'F' comment '是否禁用', `QUICK_CODE` varchar(50), - `SEQ` int(11) default '0' comment '排序 (小到大)', + `SEQ` int(11) default '0' comment '显示顺序', `EXTERNAL_ID` varchar(100) comment '外部部门ID', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`DEPT_ID`), unique index UIX0_department (`EXTERNAL_ID`) )Engine=InnoDB; @@ -70,8 +70,8 @@ create table if not exists `role` ( `IS_DISABLED` char(1) default 'F' comment '是否禁用', `QUICK_CODE` varchar(50), `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`ROLE_ID`) )Engine=InnoDB; @@ -104,8 +104,8 @@ create table if not exists `team` ( `IS_DISABLED` char(1) default 'F' comment '是否禁用', `QUICK_CODE` varchar(50), `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`TEAM_ID`) )Engine=InnoDB; @@ -142,8 +142,8 @@ create table if not exists `meta_entity` ( `MASTER_ENTITY` varchar(100) comment '所属主实体 (明细实体)', `EXT_CONFIG` varchar(700) comment '扩展配置 (JSON Map)', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`ENTITY_ID`), unique index UIX0_meta_entity (`TYPE_CODE`), @@ -170,9 +170,9 @@ create table if not exists `meta_field` ( `CASCADE` varchar(20), `COMMENTS` varchar(300), `EXT_CONFIG` varchar(700) comment '扩展配置 (JSON Map)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`FIELD_ID`), unique index UIX0_meta_field (`BELONG_ENTITY`, `FIELD_NAME`), @@ -190,9 +190,9 @@ create table if not exists `pick_list` ( `IS_HIDE` char(1) default 'F', `MASK_VALUE` bigint(20) default '0' comment '(MultiSelect专用)', `COLOR` varchar(10), - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `CREATED_BY` char(20) not null comment '创建人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`ITEM_ID`), index IX0_pick_list (`BELONG_ENTITY`, `BELONG_FIELD`, `SEQ`) @@ -207,9 +207,9 @@ create table if not exists `layout_config` ( `APPLY_TYPE` varchar(20) not null comment '(FORM,DATALIST,NAV,TBA,ADD)', `CONFIG_NAME` varchar(100) comment '名称', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -221,9 +221,9 @@ create table if not exists `filter_config` ( `SHARE_TO` varchar(420) default 'SELF' comment '共享给谁 (可选值: ALL/SELF/$MemberID)', `FILTER_NAME` varchar(100) not null comment '名称', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -233,9 +233,9 @@ create table if not exists `dashboard_config` ( `CONFIG` text(65535) not null, `SHARE_TO` varchar(420) default 'SELF' comment '共享给谁 (可选值: ALL/SELF/$MemberID)', `TITLE` varchar(100) not null comment '名称', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `CREATED_BY` char(20) not null comment '创建人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -247,10 +247,10 @@ create table if not exists `chart_config` ( `CONFIG` text(65535) not null, `CHART_TYPE` varchar(100) not null, `TITLE` varchar(100) not null comment '名称', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CHART_ID`) )Engine=InnoDB; @@ -262,9 +262,9 @@ create table if not exists `classification` ( `IS_DISABLED` char(1) default 'F', `OPEN_LEVEL` smallint(6) default '0', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', primary key (`DATA_ID`) )Engine=InnoDB; @@ -280,10 +280,10 @@ create table if not exists `classification_data` ( `IS_HIDE` char(1) default 'F', `QUICK_CODE` varchar(50), `COLOR` varchar(10), - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`ITEM_ID`), index IX0_classification_data (`DATA_ID`, `PARENT`, `CODE`), index IX1_classification_data (`DATA_ID`, `FULL_NAME`, `QUICK_CODE`, `CODE`) @@ -296,10 +296,10 @@ create table if not exists `share_access` ( `RECORD_ID` char(20) not null comment '记录 ID', `SHARE_TO` char(20) not null comment '共享给谁', `RIGHTS` int(11) not null default '0' comment '共享权限 (R=2,U=4,D=8,0=Auto)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`ACCESS_ID`), index IX0_share_access (`BELONG_ENTITY`, `RECORD_ID`, `SHARE_TO`) )Engine=InnoDB; @@ -323,8 +323,8 @@ create table if not exists `notification` ( `TYPE` smallint(6) default '0' comment '消息分类', `RELATED_RECORD` char(20) comment '相关记录', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`MESSAGE_ID`), index IX0_notification (`TO_USER`, `UNREAD`, `CREATED_ON`), @@ -343,10 +343,10 @@ create table if not exists `attachment` ( `FILE_NAME` varchar(100) comment '文件名称', `IN_FOLDER` char(20) comment '所在目录', `IS_DELETED` char(1) default 'F' comment '是否删除', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`ATTACHMENT_ID`), index IX0_attachment (`BELONG_ENTITY`, `BELONG_FIELD`, `FILE_NAME`, `IS_DELETED`), index IX1_attachment (`IN_FOLDER`, `CREATED_ON`, `FILE_NAME`), @@ -360,8 +360,8 @@ create table if not exists `attachment_folder` ( `PARENT` char(20) comment '父级', `SCOPE` varchar(420) default 'ALL' comment '哪些人可见 (可选值: ALL/SELF/$MemberID)', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`FOLDER_ID`), index IX0_attachment_folder (`SCOPE`, `CREATED_BY`) @@ -373,8 +373,8 @@ create table if not exists `login_log` ( `USER` char(20) not null comment '登陆用户', `IP_ADDR` varchar(100) comment 'IP 地址', `USER_AGENT` varchar(200) comment '客户端', - `LOGIN_TIME` timestamp not null default current_timestamp comment '登陆时间', - `LOGOUT_TIME` timestamp null default null comment '退出时间', + `LOGIN_TIME` datetime not null default current_timestamp comment '登陆时间', + `LOGOUT_TIME` datetime null default null comment '退出时间', primary key (`LOG_ID`), index IX0_login_log (`USER`, `LOGIN_TIME`) )Engine=InnoDB; @@ -387,10 +387,10 @@ create table if not exists `auto_fillin_config` ( `SOURCE_FIELD` varchar(100) not null comment '引用实体的字段', `TARGET_FIELD` varchar(100) not null comment '当前实体的字段', `EXT_CONFIG` varchar(700) comment '扩展配置 (JSON Map)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -407,8 +407,8 @@ create table if not exists `robot_trigger_config` ( `NAME` varchar(100) comment '触发器名称', `IS_DISABLED` char(1) default 'F' comment '是否禁用', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -420,10 +420,10 @@ create table if not exists `robot_approval_config` ( `NAME` varchar(100) not null comment '流程名称', `FLOW_DEFINITION` text(65535) comment '流程定义', `IS_DISABLED` char(1) default 'F' comment '是否禁用', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -436,7 +436,7 @@ create table if not exists `robot_approval_step` ( `APPROVER` char(20) not null comment '审批人', `STATE` smallint(6) default '1' comment '审批结果', `REMARK` varchar(600) comment '批注', - `APPROVED_TIME` timestamp null default null comment '审批时间', + `APPROVED_TIME` datetime null default null comment '审批时间', `PREV_NODE` varchar(100) not null comment '上一审批节点', `IS_CANCELED` char(1) default 'F' comment '是否取消', `IS_WAITING` char(1) default 'F' comment '是否生效', @@ -445,10 +445,10 @@ create table if not exists `robot_approval_step` ( `CC_USERS` varchar(420) comment '抄送人', `CC_ACCOUNTS` varchar(500) comment '抄送外部人员', `ATTR_MORE` varchar(700) comment '扩展属性 (JSON Map)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STEP_ID`), index IX0_robot_approval_step (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`, `IS_BACKED`, `NODE_BATCH`) )Engine=InnoDB; @@ -460,10 +460,10 @@ create table if not exists `rebuild_api` ( `APP_SECRET` varchar(60) not null comment 'APPSECRET', `BIND_USER` char(20) comment '绑定用户 (权限)', `BIND_IPS` varchar(300) comment 'IP 白名单', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`UNIQUE_ID`), unique index UIX0_rebuild_api (`APP_ID`) )Engine=InnoDB; @@ -476,8 +476,8 @@ create table if not exists `rebuild_api_request` ( `REQUEST_URL` varchar(300) not null comment '请求 URL', `REQUEST_BODY` text(65535) comment '请求数据', `RESPONSE_BODY` text(65535) not null comment '响应数据', - `REQUEST_TIME` timestamp not null default current_timestamp comment '请求时间', - `RESPONSE_TIME` timestamp not null default current_timestamp comment '响应时间', + `REQUEST_TIME` datetime not null default current_timestamp comment '请求时间', + `RESPONSE_TIME` datetime not null default current_timestamp comment '响应时间', primary key (`REQUEST_ID`), index IX0_rebuild_api_request (`APP_ID`, `REMOTE_IP`, `REQUEST_TIME`), fulltext index FIX1_rebuild_api_request (`REQUEST_BODY`), @@ -494,10 +494,10 @@ create table if not exists `data_report_config` ( `TEMPLATE_TYPE` smallint(6) default '1' comment '模板类型 (1=记录, 2=列表)', `EXTRA_DEFINITION` text(65535) comment '扩展配置 (JSON Map)', `IS_DISABLED` char(1) default 'F' comment '是否禁用', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -509,7 +509,7 @@ create table if not exists `recycle_bin` ( `RECORD_NAME` varchar(191) not null comment '名称字段值', `RECORD_CONTENT` longtext not null comment '数据', `DELETED_BY` char(20) not null comment '删除人', - `DELETED_ON` timestamp not null default current_timestamp comment '删除时间', + `DELETED_ON` datetime not null default current_timestamp comment '删除时间', `CHANNEL_WITH` char(20) comment '删除渠道 (空为直接删除, 否则为关联删除)', primary key (`RECYCLE_ID`), index IX0_recycle_bin (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`), @@ -524,7 +524,7 @@ create table if not exists `revision_history` ( `REVISION_TYPE` smallint(6) default '1' comment '变更类型', `REVISION_CONTENT` longtext not null comment '变更数据', `REVISION_BY` char(20) not null comment '操作人', - `REVISION_ON` timestamp not null default current_timestamp comment '操作时间', + `REVISION_ON` datetime not null default current_timestamp comment '操作时间', `CHANNEL_WITH` char(20) comment '变更渠道 (空为直接, 否则为关联)', `IP_ADDR` varchar(100) comment 'IP 地址', `AUTO_ID` bigint(20) not null auto_increment comment '执行顺序', @@ -540,7 +540,7 @@ create table if not exists `smsend_log` ( `TO` varchar(100) not null comment '接收人', `CONTENT` text(65535) not null comment '发送内容', `TYPE` smallint(6) default '0' comment '(1=短信; 2=邮件)', - `SEND_TIME` timestamp not null default current_timestamp comment '发送时间', + `SEND_TIME` datetime not null default current_timestamp comment '发送时间', `SEND_RESULT` varchar(191) comment '发送结果 (xxx|ERR:xxx)', primary key (`SEND_ID`), index IX0_smsend_log (`TYPE`, `SEND_TIME`, `SEND_RESULT`) @@ -564,10 +564,10 @@ create table if not exists `transform_config` ( `NAME` varchar(100) comment '名称', `CONFIG` text(65535) comment '映射配置', `IS_DISABLED` char(1) default 'F' comment '是否禁用', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -578,10 +578,10 @@ create table if not exists `frontjs_code` ( `APPLY_PATH` varchar(200) comment '匹配路径', `CODE` text(65535) comment '代码', `ES5_CODE` text(65535) comment 'ES5 代码', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CODE_ID`) )Engine=InnoDB; @@ -608,12 +608,12 @@ create table if not exists `feeds` ( `IMAGES` varchar(700) comment '图片', `ATTACHMENTS` varchar(700) comment '附件', `RELATED_RECORD` char(20) comment '相关记录', - `SCHEDULE_TIME` timestamp null default null comment '日程时间', + `SCHEDULE_TIME` datetime null default null comment '日程时间', `SCOPE` varchar(20) default 'ALL' comment '可见范围 (ALL/SELF/$TeamID)', `AUTO_LOCATION` varchar(100) comment '发布位置', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`FEEDS_ID`), index IX0_feeds (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`), @@ -629,10 +629,10 @@ create table if not exists `feeds_comment` ( `CONTENT` text(65535) not null comment '内容', `IMAGES` varchar(700) comment '图片', `ATTACHMENTS` varchar(700) comment '附件', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`COMMENT_ID`), index IX0_feeds_comment (`FEEDS_ID`) )Engine=InnoDB; @@ -642,7 +642,7 @@ create table if not exists `feeds_like` ( `LIKE_ID` char(20) not null, `SOURCE` char(20) not null comment '哪个动态/评论', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`LIKE_ID`), index IX0_feeds_like (`SOURCE`, `CREATED_BY`) )Engine=InnoDB; @@ -663,7 +663,7 @@ create table if not exists `feeds_status` ( `FEEDS_ID` char(20) not null comment '哪个动态', `CONTENT` text(65535) comment '扩展内容', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STATUS_ID`), index IX0_feeds_status (`FEEDS_ID`, `CREATED_BY`, `CREATED_ON`) )Engine=InnoDB; @@ -681,9 +681,9 @@ create table if not exists `project_config` ( `EXTRA_DEFINITION` text(65535) comment '扩展配置 (JSON Map)', `STATUS` smallint(6) default '1' comment '状态 (1=正常 2=归档)', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', primary key (`CONFIG_ID`), unique index UIX0_project_config (`PROJECT_CODE`) )Engine=InnoDB; @@ -712,18 +712,18 @@ create table if not exists `project_task` ( `PARTNERS` varchar(420) default 'ALL' comment '参与者 (可选值: $UserID)', `PRIORITY` smallint(6) default '1' comment '优先级 (0=较低 1=普通 2=紧急 3=非常紧急)', `STATUS` smallint(6) default '0' comment '状态 (0=未完成/未开始)', - `DEADLINE` timestamp null default null comment '截至时间', - `START_TIME` timestamp null default null comment '开始时间', - `END_TIME` timestamp null default null comment '完成时间', + `DEADLINE` datetime null default null comment '截至时间', + `START_TIME` datetime null default null comment '开始时间', + `END_TIME` datetime null default null comment '完成时间', `DESCRIPTION` text(65535) comment '备注', `ATTACHMENTS` varchar(700) comment '附件', `PARENT_TASK_ID` char(20) comment '父级任务', `RELATED_RECORD` char(20) comment '相关记录', `SEQ` int(11) default '0' comment '排序 (小到大)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`TASK_ID`), index IX0_project_task (`PROJECT_ID`, `PROJECT_PLAN_ID`, `SEQ`), index IX1_project_task (`PROJECT_ID`, `TASK_NUMBER`, `TASK_NAME`, `STATUS`), @@ -746,10 +746,10 @@ create table if not exists `project_task_comment` ( `TASK_ID` char(20) not null comment '相关任务', `CONTENT` text(65535) not null comment '评论内容', `ATTACHMENTS` varchar(700) comment '附件', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`COMMENT_ID`), index IX0_project_task_comment (`TASK_ID`) )Engine=InnoDB; @@ -761,7 +761,7 @@ create table if not exists `project_task_tag` ( `TAG_NAME` varchar(100) not null comment '标签', `COLOR` varchar(20) comment '颜色', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`TAG_ID`), index IX0_project_task_tag (`TAG_NAME`, `PROJECT_ID`) )Engine=InnoDB; @@ -772,7 +772,7 @@ create table if not exists `project_task_tag_relation` ( `TASK_ID` char(20) not null, `TAG_ID` char(20) not null, `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`RELATION_ID`), unique index UIX0_project_task_tag_relation (`TASK_ID`, `TAG_ID`), index IX1_project_task_tag_relation (`CREATED_ON`) @@ -784,15 +784,15 @@ create table if not exists `extform_config` ( `BELONG_ENTITY` varchar(100) not null comment '所属实体', `NAME` varchar(100) not null comment '名称', `PORTAL_CONFIG` text(65535) comment '表单配置 (JSON Map)', - `START_TIME` timestamp null default null comment '开始时间', - `END_TIME` timestamp null default null comment '结束时间', + `START_TIME` datetime null default null comment '开始时间', + `END_TIME` datetime null default null comment '结束时间', `BIND_USER` char(20) comment '数据绑定用户', `HOOK_URL` varchar(300) comment '回调地址', `HOOK_SECRET` varchar(300) comment '回调安全码', `NO_RATE_LIMITER` char(1) default 'F' comment '关闭限流', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -805,9 +805,9 @@ create table if not exists `robot_sop_config` ( `SOP_DEFINITION` text(65535) comment '进度定义', `IS_DISABLED` char(1) default 'F' comment '是否禁用', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -818,13 +818,13 @@ create table if not exists `robot_sop_step` ( `SOP_ID` char(20) not null comment '业务进度', `NODE` varchar(100) not null comment '进度节点', `OPERATOR` char(20) not null comment '操作人', - `ACHIEVED_TIME` timestamp not null default current_timestamp comment '达成时间', + `ACHIEVED_TIME` datetime not null default current_timestamp comment '达成时间', `ACHIEVED_CONTENT` text(65535) comment '达成内容', `PREV_STEP` char(20), - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STEP_ID`), index IX0_robot_sop_step (`RECORD_ID`, `SOP_ID`, `NODE`, `PREV_STEP`) )Engine=InnoDB; @@ -848,10 +848,10 @@ create table if not exists `short_url` ( `SHORT_ID` char(20) not null, `SHORT_KEY` varchar(40) not null comment '短链ID', `LONG_URL` varchar(600) not null comment '对应长链/文件', - `EXPIRE_TIME` timestamp null default null comment '到期时间', - `CHECK_PASSWD` timestamp null default null comment '密码', + `EXPIRE_TIME` datetime null default null comment '到期时间', + `CHECK_PASSWD` datetime null default null comment '密码', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`SHORT_ID`), index IX0_short_url (`CREATED_BY`, `CREATED_ON`, `EXPIRE_TIME`), index IX1_short_url (`SHORT_KEY`) @@ -862,7 +862,7 @@ create table if not exists `commons_lock` ( `LOCK_ID` char(20) not null, `SOURCE` char(20) not null comment '锁定记录', `LOCK_USER` char(20) not null comment '锁定人', - `LOCK_TIME` timestamp not null default current_timestamp comment '锁定时间', + `LOCK_TIME` datetime not null default current_timestamp comment '锁定时间', primary key (`LOCK_ID`), index IX0_commons_lock (`LOCK_USER`, `LOCK_TIME`), unique index UIX1_commons_lock (`SOURCE`) @@ -875,12 +875,13 @@ create table if not exists `commons_log` ( `USER` char(20) not null, `SOURCE` char(20) not null, `LOG_CONTENT` text(65535), - `LOG_TIME` timestamp not null default current_timestamp, + `LOG_TIME` datetime not null default current_timestamp, `STATUS` smallint(6) default '1', primary key (`LOG_ID`), index IX0_commons_log (`TYPE`, `LOG_TIME`, `SOURCE`) )Engine=InnoDB; + -- #3 datas -- User diff --git a/src/main/resources/scripts/db-upgrade.sql b/src/main/resources/scripts/db-upgrade.sql index df4425c4c5..c9104dd185 100644 --- a/src/main/resources/scripts/db-upgrade.sql +++ b/src/main/resources/scripts/db-upgrade.sql @@ -24,9 +24,9 @@ create table if not exists `robot_sop_config` ( `SOP_DEFINITION` text(65535) comment '进度定义', `IS_DISABLED` char(1) default 'F' comment '是否禁用', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; -- ************ Entity [RobotSopStep] DDL ************ @@ -36,13 +36,13 @@ create table if not exists `robot_sop_step` ( `SOP_ID` char(20) not null comment '业务进度', `NODE` varchar(100) not null comment '进度节点', `OPERATOR` char(20) not null comment '操作人', - `ACHIEVED_TIME` timestamp not null default current_timestamp comment '达成时间', + `ACHIEVED_TIME` datetime not null default current_timestamp comment '达成时间', `ACHIEVED_CONTENT` text(65535) comment '达成内容', `PREV_STEP` char(20), - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STEP_ID`), index IX0_robot_sop_step (`RECORD_ID`, `SOP_ID`, `NODE`, `PREV_STEP`) )Engine=InnoDB; @@ -57,7 +57,7 @@ create table if not exists `feeds_status` ( `FEEDS_ID` char(20) not null comment '哪个动态', `CONTENT` text(65535) comment '扩展内容', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STATUS_ID`), index IX0_feeds_status (`FEEDS_ID`, `CREATED_BY`, `CREATED_ON`) )Engine=InnoDB; @@ -77,10 +77,10 @@ create table if not exists `short_url` ( `SHORT_ID` char(20) not null, `SHORT_KEY` varchar(40) not null comment '短链ID', `LONG_URL` varchar(600) not null comment '对应长链/文件', - `EXPIRE_TIME` timestamp null default null comment '到期时间', - `CHECK_PASSWD` timestamp null default null comment '密码', + `EXPIRE_TIME` datetime null default null comment '到期时间', + `CHECK_PASSWD` datetime null default null comment '密码', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`SHORT_ID`), index IX0_short_url (`CREATED_BY`, `CREATED_ON`, `EXPIRE_TIME`), index IX1_short_url (`SHORT_KEY`) @@ -133,7 +133,7 @@ create table if not exists `commons_lock` ( `LOCK_ID` char(20) not null, `SOURCE` char(20) not null, `LOCK_USER` char(20) not null, - `LOCK_TIME` timestamp not null default current_timestamp, + `LOCK_TIME` datetime not null default current_timestamp, primary key (`LOCK_ID`), index IX0_commons_lock (`LOCK_USER`, `LOCK_TIME`), unique index UIX1_commons_lock (`SOURCE`) @@ -147,7 +147,7 @@ create table if not exists `commons_log` ( `USER` char(20) not null, `SOURCE` char(20) not null, `LOG_CONTENT` text(65535), - `LOG_TIME` timestamp not null default current_timestamp, + `LOG_TIME` datetime not null default current_timestamp, `STATUS` smallint(6) default '1', primary key (`LOG_ID`), index IX0_commons_log (`TYPE`, `LOG_TIME`, `SOURCE`) @@ -207,10 +207,10 @@ create table if not exists `frontjs_code` ( `APPLY_PATH` varchar(200) comment '匹配路径', `CODE` text(65535) comment '代码', `ES5_CODE` text(65535) comment 'ES5 代码', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CODE_ID`) )Engine=InnoDB; @@ -230,14 +230,14 @@ create table if not exists `extform_config` ( `BELONG_ENTITY` varchar(100) not null comment '所属实体', `NAME` varchar(100) not null comment '名称', `PORTAL_CONFIG` text(65535) comment '表单配置 (JSON Map)', - `START_TIME` timestamp null default null comment '开始时间', - `END_TIME` timestamp null default null comment '结束时间', + `START_TIME` datetime null default null comment '开始时间', + `END_TIME` datetime null default null comment '结束时间', `BIND_USER` char(20) comment '数据绑定用户', `HOOK_URL` varchar(300) comment '回调地址', `HOOK_SECRET` varchar(300) comment '回调安全码', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -245,10 +245,10 @@ create table if not exists `extform_config` ( -- #32 (v2.1) TaskTag alter table `project_task_tag` add column `CREATED_BY` char(20) not null comment '创建人', - add column `CREATED_ON` timestamp not null default current_timestamp comment '创建时间'; + add column `CREATED_ON` datetime not null default current_timestamp comment '创建时间'; alter table `project_task_tag_relation` add column `CREATED_BY` char(20) not null comment '创建人', - add column `CREATED_ON` timestamp not null default current_timestamp comment '创建时间'; + add column `CREATED_ON` datetime not null default current_timestamp comment '创建时间'; -- #31 (v2.1) -- ************ Entity [TransformConfig] DDL ************ @@ -259,10 +259,10 @@ create table if not exists `transform_config` ( `NAME` varchar(100) comment '名称', `CONFIG` text(65535) comment '映射配置', `IS_DISABLED` char(1) default 'F' comment '是否禁用', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -281,9 +281,9 @@ create table if not exists `language` ( -- Add commons fields alter table `project_config` add column `CREATED_BY` char(20) not null comment '创建人' default '001-0000000000000000', - add column `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + add column `CREATED_ON` datetime not null default current_timestamp comment '创建时间', add column `MODIFIED_BY` char(20) not null comment '修改人' default '001-0000000000000000', - add column `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间'; + add column `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间'; -- Meta config alter table `meta_field` add column `QUERYABLE` char(1) default 'T'; @@ -331,17 +331,17 @@ create table if not exists `project_task` ( `PARTNERS` varchar(420) default 'ALL' comment '参与者(可选值: $UserID)', `PRIORITY` smallint(6) default '1' comment '优先级(0=较低 1=普通 2=紧急 3=非常紧急)', `STATUS` smallint(6) default '0' comment '状态(0=未完成/未开始)', - `DEADLINE` timestamp null default null comment '截至时间', - `START_TIME` timestamp null default null comment '开始时间', - `END_TIME` timestamp null default null comment '完成时间', + `DEADLINE` datetime null default null comment '截至时间', + `START_TIME` datetime null default null comment '开始时间', + `END_TIME` datetime null default null comment '完成时间', `DESCRIPTION` text(65535) comment '详情', `ATTACHMENTS` varchar(700) comment '附件', `PARENT_TASK_ID` char(20) comment '父级任务', `SEQ` int(11) default '0' comment '排序(小到大)', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`TASK_ID`), index IX0_project_task (`PROJECT_ID`, `PROJECT_PLAN_ID`, `SEQ`), index IX1_project_task (`PROJECT_ID`, `TASK_NUMBER`, `TASK_NAME`, `STATUS`) @@ -361,10 +361,10 @@ create table if not exists `project_task_comment` ( `TASK_ID` char(20) not null comment '哪个任务', `CONTENT` text(65535) not null comment '内容', `ATTACHMENTS` varchar(700) comment '附件', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `MODIFIED_BY` char(20) not null comment '修改人', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`COMMENT_ID`), index IX0_project_task_comment (`TASK_ID`) )Engine=InnoDB; @@ -400,7 +400,7 @@ create table if not exists `smsend_log` ( `SEND_ID` char(20) not null, `TO` varchar(100) not null comment '收件人', `CONTENT` text(65535) not null comment '发送内容', - `SEND_TIME` timestamp not null default current_timestamp comment '发送时间', + `SEND_TIME` datetime not null default current_timestamp comment '发送时间', `SEND_RESULT` varchar(191) comment '发送结果(OK:xxx|ERR:xxx)', primary key (`SEND_ID`), index IX0_smsend_log (`SEND_TIME`, `SEND_RESULT`) @@ -413,7 +413,7 @@ alter table `user` -- #22 scheduleTime for Feeds alter table `feeds` - add column `SCHEDULE_TIME` timestamp null default null comment '日程时间', + add column `SCHEDULE_TIME` datetime null default null comment '日程时间', add index IX91_feeds (`TYPE`, `SCHEDULE_TIME`, `CREATED_BY`); -- #21 QuickCode for ClassificationData @@ -441,9 +441,9 @@ create table if not exists `team` ( `PRINCIPAL_ID` char(20) comment '负责人', `IS_DISABLED` char(1) default 'F' comment '是否停用', `QUICK_CODE` varchar(70), - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`TEAM_ID`) )Engine=InnoDB; @@ -476,10 +476,10 @@ create table if not exists `feeds` ( `ATTACHMENTS` varchar(700) comment '附件', `RELATED_RECORD` char(20) comment '相关业务记录', `SCOPE` varchar(20) default 'ALL' comment '哪些人可见, 可选值: ALL/SELF/$TeamID', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`FEEDS_ID`), index IX0_feeds (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`), index IX1_feeds (`RELATED_RECORD`), @@ -493,8 +493,8 @@ create table if not exists `feeds_comment` ( `IMAGES` varchar(700) comment '图片', `ATTACHMENTS` varchar(700) comment '附件', `MODIFIED_BY` char(20) not null comment '修改人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', primary key (`COMMENT_ID`), index IX0_feeds_comment (`FEEDS_ID`) @@ -504,7 +504,7 @@ create table if not exists `feeds_like` ( `LIKE_ID` char(20) not null, `SOURCE` char(20) not null comment '哪个动态/评论', `CREATED_BY` char(20) not null comment '创建人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`LIKE_ID`), index IX0_feeds_like (`SOURCE`, `CREATED_BY`) )Engine=InnoDB; @@ -543,7 +543,7 @@ create table if not exists `recycle_bin` ( `RECORD_NAME` varchar(191) not null comment '名称字段值', `RECORD_CONTENT` longtext not null comment '数据', `DELETED_BY` char(20) not null comment '删除人', - `DELETED_ON` timestamp not null default current_timestamp comment '删除时间', + `DELETED_ON` datetime not null default current_timestamp comment '删除时间', `CHANNEL_WITH` char(20) comment '删除渠道(空为直接删除,否则为关联删除)', primary key (`RECYCLE_ID`), index IX0_recycle_bin (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`), @@ -557,7 +557,7 @@ create table if not exists `revision_history` ( `REVISION_TYPE` smallint(6) default '1' comment '变更类型', `REVISION_CONTENT` longtext not null comment '变更数据', `REVISION_BY` char(20) not null comment '操作人', - `REVISION_ON` timestamp not null default current_timestamp comment '操作时间', + `REVISION_ON` datetime not null default current_timestamp comment '操作时间', `CHANNEL_WITH` char(20) comment '变更渠道(空为直接,否则为关联)', primary key (`REVISION_ID`), index IX0_revision_history (`BELONG_ENTITY`, `REVISION_TYPE`, `REVISION_BY`, `REVISION_ON`), @@ -573,9 +573,9 @@ create table if not exists `data_report_config` ( `TEMPLATE_FILE` varchar(200) comment '模板文件', `TEMPLATE_CONTENT` text(65535) comment '模板内容', `IS_DISABLED` char(1) default 'F' comment '是否停用', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -594,9 +594,9 @@ create table if not exists `rebuild_api` ( `BIND_USER` char(20) comment '绑定用户(权限)', `BIND_IPS` varchar(300) comment 'IP白名单', `MODIFIED_BY` char(20) not null comment '修改人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `CREATED_BY` char(20) not null comment '创建人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', primary key (`UNIQUE_ID`), unique index UIX0_rebuild_api (`APP_ID`) )Engine=InnoDB; @@ -608,8 +608,8 @@ create table if not exists `rebuild_api_request` ( `REQUEST_URL` varchar(300) not null comment '请求URL', `REQUEST_BODY` text(65535) comment '请求数据', `RESPONSE_BODY` text(65535) not null comment '响应数据', - `REQUEST_TIME` timestamp not null default current_timestamp comment '请求时间', - `RESPONSE_TIME` timestamp not null default current_timestamp comment '响应时间', + `REQUEST_TIME` datetime not null default current_timestamp comment '请求时间', + `RESPONSE_TIME` datetime not null default current_timestamp comment '响应时间', primary key (`REQUEST_ID`), index IX0_rebuild_api_request (`APP_ID`, `REMOTE_IP`, `REQUEST_TIME`) )Engine=InnoDB; @@ -629,8 +629,8 @@ create table if not exists `robot_approval_config` ( `IS_DISABLED` char(1) default 'F' comment '是否停用', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`CONFIG_ID`) )Engine=InnoDB; -- ************ Entity [RobotApprovalStep] DDL ************ @@ -642,14 +642,14 @@ create table if not exists `robot_approval_step` ( `APPROVER` char(20) not null comment '审批人', `STATE` smallint(6) default '1' comment '审批结果', `REMARK` varchar(600) comment '批注', - `APPROVED_TIME` timestamp null default null comment '审批时间', + `APPROVED_TIME` datetime null default null comment '审批时间', `PREV_NODE` varchar(100) not null comment '上一审批节点', `IS_CANCELED` char(1) default 'F' comment '是否取消', `IS_WAITING` char(1) default 'F' comment '是否生效', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`STEP_ID`), index IX0_robot_approval_step (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`) )Engine=InnoDB; @@ -669,8 +669,8 @@ create table if not exists `auto_fillin_config` ( `TARGET_FIELD` varchar(100) not null comment '当前实体的字段', `EXT_CONFIG` varchar(700) comment '更多扩展配置, JSON格式KV', `CREATED_BY` char(20) not null comment '创建人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`CONFIG_ID`) )Engine=InnoDB; @@ -685,8 +685,8 @@ create table if not exists `robot_trigger_config` ( `PRIORITY` int(11) default '1' comment '执行优先级, 越大越高(越先执行)', `NAME` varchar(100) comment '触发器名称', `IS_DISABLED` char(1) default 'F' comment '是否停用', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', primary key (`CONFIG_ID`) @@ -708,10 +708,10 @@ create table if not exists `classification` ( `DESCRIPTION` varchar(600), `IS_DISABLED` char(1) default 'F', `OPEN_LEVEL` smallint(6) default '0', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', primary key (`DATA_ID`) )Engine=InnoDB; -- ************ Entity [ClassificationData] DDL ************ @@ -724,10 +724,10 @@ create table if not exists `classification_data` ( `CODE` varchar(50), `LEVEL` smallint(6) default '0', `IS_HIDE` char(1) default 'F', - `CREATED_ON` timestamp not null default current_timestamp comment '创建时间', + `CREATED_ON` datetime not null default current_timestamp comment '创建时间', `CREATED_BY` char(20) not null comment '创建人', `MODIFIED_BY` char(20) not null comment '修改人', - `MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间', + `MODIFIED_ON` datetime not null default current_timestamp comment '修改时间', primary key (`ITEM_ID`), index IX0_classification_data (`DATA_ID`, `PARENT`), index IX1_classification_data (`DATA_ID`, `FULL_NAME`) @@ -744,8 +744,8 @@ create table if not exists `login_log` ( `USER` char(20) not null comment '登陆用户', `IP_ADDR` varchar(100) comment 'IP地址', `USER_AGENT` varchar(200) comment '客户端', - `LOGIN_TIME` timestamp not null default current_timestamp comment '登陆时间', - `LOGOUT_TIME` timestamp null default null comment '退出时间', + `LOGIN_TIME` datetime not null default current_timestamp comment '登陆时间', + `LOGOUT_TIME` datetime null default null comment '退出时间', primary key (`LOG_ID`), index IX0_login_log (`USER`, `LOGIN_TIME`) )Engine=InnoDB; diff --git a/src/main/resources/web/assets/js/metadata/field-edit.js b/src/main/resources/web/assets/js/metadata/field-edit.js index 63549d6952..18caa8497a 100644 --- a/src/main/resources/web/assets/js/metadata/field-edit.js +++ b/src/main/resources/web/assets/js/metadata/field-edit.js @@ -862,6 +862,9 @@ class FieldTypeCast extends RbFormHandler { + @@ -880,8 +883,8 @@ class FieldTypeCast extends RbFormHandler { }) } - post() { - const toType = $(this._$toType).val() + post(fixsType) { + const toType = fixsType || $(this._$toType).val() if (!toType) return RbHighbar.create($L('不可转换')) const $btn = $(this._$btns).find('.btn').button('loading') diff --git a/src/test/java/com/rebuild/support/SchemaGenerator.java b/src/test/java/com/rebuild/support/SchemaGenerator.java index 7d2ae45048..9176450fbb 100644 --- a/src/test/java/com/rebuild/support/SchemaGenerator.java +++ b/src/test/java/com/rebuild/support/SchemaGenerator.java @@ -14,6 +14,7 @@ import cn.devezhao.persist4j.metadata.impl.ConfigurationMetadataFactory; import cn.devezhao.persist4j.util.support.Table; import com.rebuild.core.metadata.easymeta.EasyMetaFactory; +import com.rebuild.core.metadata.impl.Table40; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.math.NumberUtils; import org.dom4j.Element; @@ -68,7 +69,7 @@ static void generate() { static void generate(int entityCode) { Entity entity = metadataFactory.getEntity(entityCode); Element root = ((ConfigurationMetadataFactory) metadataFactory).getConfigDocument().getRootElement(); - Table table = new Table( + Table table = new Table40( entity, dialect, root.selectSingleNode("//entity[@name='" + entity.getName() + "']").selectNodes("index")); From 1b860f3dc6f30b1edd6820759d9fb856485670a7 Mon Sep 17 00:00:00 2001 From: RB Date: Sat, 28 Dec 2024 19:34:10 +0800 Subject: [PATCH 04/15] DATETIME40 --- @rbv | 2 +- src/main/resources/web/assets/js/metadata/field-edit.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/@rbv b/@rbv index c71189264c..590565da37 160000 --- a/@rbv +++ b/@rbv @@ -1 +1 @@ -Subproject commit c71189264c0352965be790dd074329644c9c33ae +Subproject commit 590565da373b31594e941a4bd67537c398659488 diff --git a/src/main/resources/web/assets/js/metadata/field-edit.js b/src/main/resources/web/assets/js/metadata/field-edit.js index 18caa8497a..210f294f76 100644 --- a/src/main/resources/web/assets/js/metadata/field-edit.js +++ b/src/main/resources/web/assets/js/metadata/field-edit.js @@ -862,7 +862,7 @@ class FieldTypeCast extends RbFormHandler { - From e2a334ea2eefd4837ef7229a12b84c6cf6ea9a86 Mon Sep 17 00:00:00 2001 From: RB Date: Sun, 29 Dec 2024 12:59:48 +0800 Subject: [PATCH 05/15] enh: SimpleEntity, appstore, AdminCli4 --- .../core/metadata/impl/TsetEntity.java | 71 ----------- .../rebuild/core/support/setup/Installer.java | 2 +- .../core/support/setup/SimpleEntity.java | 111 ++++++++++++++++++ .../admin/{AdminCli3.java => AdminCli4.java} | 40 +------ .../web/admin/AdminVerfiyController.java | 4 +- src/main/resources/application-dev.yml | 2 +- .../resources/web/admin/setup/rbsystem.html | 7 +- ...{rbsystem-install.js => setup-rbsystem.js} | 24 +++- src/test/java/com/rebuild/TestSupport.java | 57 +-------- 9 files changed, 147 insertions(+), 171 deletions(-) delete mode 100644 src/main/java/com/rebuild/core/metadata/impl/TsetEntity.java create mode 100644 src/main/java/com/rebuild/core/support/setup/SimpleEntity.java rename src/main/java/com/rebuild/web/admin/{AdminCli3.java => AdminCli4.java} (87%) rename src/main/resources/web/assets/js/admin/{rbsystem-install.js => setup-rbsystem.js} (77%) diff --git a/src/main/java/com/rebuild/core/metadata/impl/TsetEntity.java b/src/main/java/com/rebuild/core/metadata/impl/TsetEntity.java deleted file mode 100644 index 9956dd0438..0000000000 --- a/src/main/java/com/rebuild/core/metadata/impl/TsetEntity.java +++ /dev/null @@ -1,71 +0,0 @@ -/*! -Copyright (c) REBUILD and/or its owners. All rights reserved. - -rebuild is dual-licensed under commercial and open source licenses (GPLv3). -See LICENSE and COMMERCIAL in the project root for license information. -*/ - -package com.rebuild.core.metadata.impl; - -import cn.devezhao.persist4j.Entity; -import cn.devezhao.persist4j.engine.ID; -import com.alibaba.fastjson.JSON; -import com.rebuild.core.metadata.MetadataHelper; -import com.rebuild.core.metadata.easymeta.DisplayType; -import com.rebuild.core.privileges.UserService; -import com.rebuild.utils.BlockList; - -/** - * @author Zixin - * @since 4/26/2024 - */ -public class TsetEntity { - - /** - * @return - */ - public String create() { - return create("TestAllFields999"); - } - - /** - * @param name - * @return - */ - public String create(final String name) { - if (MetadataHelper.containsEntity(name)) return "EXISTS:" + name; - - final ID user = UserService.SYSTEM_USER; - - Entity2Schema entity2Schema = new Entity2Schema(user); - String entityName = entity2Schema.createEntity( - null, name.toUpperCase(), "测试专用实体", null, Boolean.TRUE, Boolean.FALSE); - Entity entityMeta = MetadataHelper.getEntity(entityName); - - for (DisplayType dt : DisplayType.values()) { - if (dt == DisplayType.ID) continue; - - String fieldLabel = dt.getDisplayName(); - String fieldName = dt.name().toUpperCase(); - if (BlockList.isBlock(fieldName)) fieldName += "1"; - - if (dt == DisplayType.REFERENCE || dt == DisplayType.N2NREFERENCE) { - new Field2Schema(user) - .createField(entityMeta, fieldLabel, fieldName, dt, null, entityName, null); - } else if (dt == DisplayType.CLASSIFICATION) { - JSON extra = JSON.parseObject("{classification:'018-0000000000000001'}"); - new Field2Schema(user) - .createField(entityMeta, fieldLabel, fieldName, dt, null, entityName, extra); - } else if (dt == DisplayType.STATE) { - JSON extra = JSON.parseObject("{stateClass:'com.rebuild.core.support.state.HowtoState'}"); - new Field2Schema(user) - .createField(entityMeta, fieldLabel, fieldName, dt, null, entityName, extra); - } else { - new Field2Schema(user) - .createField(entityMeta, fieldLabel, fieldName, dt, null, null, null); - } - } - - return entityName; - } -} diff --git a/src/main/java/com/rebuild/core/support/setup/Installer.java b/src/main/java/com/rebuild/core/support/setup/Installer.java index 8a2a6e3b28..2e0c1ac2fe 100644 --- a/src/main/java/com/rebuild/core/support/setup/Installer.java +++ b/src/main/java/com/rebuild/core/support/setup/Installer.java @@ -87,7 +87,7 @@ public class Installer implements InstallState { private String EXISTS_SN; - private Installer() { } + private Installer() {} /** * @param installProps diff --git a/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java b/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java new file mode 100644 index 0000000000..4d546ff714 --- /dev/null +++ b/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java @@ -0,0 +1,111 @@ +/*! +Copyright (c) REBUILD and/or its owners. All rights reserved. + +rebuild is dual-licensed under commercial and open source licenses (GPLv3). +See LICENSE and COMMERCIAL in the project root for license information. +*/ + +package com.rebuild.core.support.setup; + +import cn.devezhao.bizz.security.member.NoMemberFoundException; +import cn.devezhao.persist4j.Entity; +import cn.devezhao.persist4j.Record; +import cn.devezhao.persist4j.engine.ID; +import com.alibaba.fastjson.JSON; +import com.rebuild.core.Application; +import com.rebuild.core.metadata.EntityHelper; +import com.rebuild.core.metadata.MetadataHelper; +import com.rebuild.core.metadata.easymeta.DisplayType; +import com.rebuild.core.metadata.impl.Entity2Schema; +import com.rebuild.core.metadata.impl.Field2Schema; +import com.rebuild.core.privileges.UserService; +import com.rebuild.utils.BlockList; +import lombok.extern.slf4j.Slf4j; + +/** + * RB示例实体 TestAllFields + * + * @author devezhao + * @since 2024/12/29 + */ +@Slf4j +public class SimpleEntity { + + public static final String NAME = "TestAllFields"; + + /** + * @param dropExists + * @param includeBuiltin + * @param addPrivileges + * @return + */ + public boolean create(boolean dropExists, boolean includeBuiltin, boolean addPrivileges) { + if (MetadataHelper.containsEntity(NAME)) { + if (dropExists) { + log.warn("Dropping exists : {}", NAME); + new Entity2Schema(UserService.SYSTEM_USER).dropEntity(MetadataHelper.getEntity(NAME), true); + } else { + return false; + } + } + + Entity2Schema entity2Schema = new Entity2Schema(UserService.SYSTEM_USER); + entity2Schema.createEntity( + NAME.toUpperCase(), "RB示例实体", "演示实体/字段的基本用法。更多详情参阅 https://getrebuild.com/docs/admin/entity/", null, true, true); + + final Entity entity = MetadataHelper.getEntity(NAME); + Field2Schema field2Schema = new Field2Schema(UserService.SYSTEM_USER); + + for (DisplayType dt : DisplayType.values()) { + if (dt == DisplayType.ID || dt == DisplayType.SERIES) continue; + if (!includeBuiltin) { + if (dt == DisplayType.STATE || dt == DisplayType.ANYREFERENCE) continue; + } + + String fieldName = dt.name().toUpperCase(); + if (BlockList.isBlock(fieldName)) fieldName += "1"; + + if (dt == DisplayType.REFERENCE || dt == DisplayType.N2NREFERENCE) { + field2Schema.createField(entity, fieldName, dt, null, NAME, null); + } else if (dt == DisplayType.CLASSIFICATION) { + JSON extConfig = JSON.parseObject("{classification:'018-0000000000000001'}"); + field2Schema.createField(entity, fieldName, dt, null, NAME, extConfig); + } else if (dt == DisplayType.STATE) { + JSON extConfig = JSON.parseObject("{stateClass:'com.rebuild.core.support.state.HowtoState'}"); + field2Schema.createField(entity, fieldName, dt, null, NAME, extConfig); + } else { + field2Schema.createField(entity, fieldName, dt, null, null, null); + } + } + + if (addPrivileges) { + // RB示例角色 + addPrivileges2SimpleRole(ID.valueOf("003-9000000000000001"), entity.getEntityCode()); + } + + return true; + } + + private boolean addPrivileges2SimpleRole(ID roleId, int entityCode) { + try { + Application.getUserStore().getRole(roleId); + } catch (NoMemberFoundException ex) { + return false; + } + + Object e = Application.getQueryFactory().createQueryNoFilter( + "select privilegesId from RolePrivileges where roleId = ? and entity = ?") + .setParameter(1, roleId) + .setParameter(2, entityCode) + .unique(); + if (e != null) return false; + + Record p = EntityHelper.forNew(EntityHelper.RolePrivileges, UserService.SYSTEM_USER); + p.setID("roleId", roleId); + p.setInt("entity", entityCode); + p.setString("definition", "{'A':4,'R':4,'C':4,'S':4,'D':4,'U':4}"); + Application.getCommonsService().create(p, false); + Application.getUserStore().refreshRole(roleId); + return true; + } +} diff --git a/src/main/java/com/rebuild/web/admin/AdminCli3.java b/src/main/java/com/rebuild/web/admin/AdminCli4.java similarity index 87% rename from src/main/java/com/rebuild/web/admin/AdminCli3.java rename to src/main/java/com/rebuild/web/admin/AdminCli4.java index 7e281ea5fc..6bb976928e 100644 --- a/src/main/java/com/rebuild/web/admin/AdminCli3.java +++ b/src/main/java/com/rebuild/web/admin/AdminCli4.java @@ -9,8 +9,6 @@ import com.rebuild.core.Application; import com.rebuild.core.metadata.MetadataHelper; -import com.rebuild.core.metadata.impl.TsetEntity; -import com.rebuild.core.rbstore.RbSystemImporter; import com.rebuild.core.service.approval.ApprovalFields2Schema; import com.rebuild.core.support.ConfigurationItem; import com.rebuild.core.support.License; @@ -18,7 +16,7 @@ import com.rebuild.core.support.setup.DatabaseBackup; import com.rebuild.core.support.setup.DatafileBackup; import com.rebuild.core.support.setup.Installer; -import com.rebuild.core.support.task.TaskExecutors; +import com.rebuild.core.support.setup.SimpleEntity; import com.rebuild.utils.AES; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; @@ -34,7 +32,7 @@ * @since 2020/3/16 */ @Slf4j -public class AdminCli3 { +public class AdminCli4 { private static final String C_HELP = "help"; private static final String C_CACHE = "cache"; @@ -43,7 +41,6 @@ public class AdminCli3 { private static final String C_AES = "aes"; private static final String C_CLEAN_APPROVAL = "clean-approval"; private static final String C_ADD_TESTENTITY = "add-testentity"; - private static final String C_RBSPKG = "rbspkg"; private static final String SUCCESS = "OK"; @@ -52,7 +49,7 @@ public class AdminCli3 { /** * @param args */ - protected AdminCli3(String args) { + protected AdminCli4(String args) { List list = new ArrayList<>(); Matcher m = Pattern.compile("([^\"]\\S*|\".+?\")\\s*").matcher(args); while (m.find()) { @@ -82,8 +79,7 @@ public String exec() { " \nbackup [database|datafile]" + " \naes [decrypt] VALUE" + " \nclean-approval ENTITY" + - " \nadd-testentity [NAME]" + - " \nrbspkg URL"; + " \nadd-testentity"; break; } case C_CACHE: { @@ -110,10 +106,6 @@ public String exec() { result = this.execAddTestentity(); break; } - case C_RBSPKG: { - result = this.execRbspkg(); - break; - } default: { // NOOP } @@ -274,27 +266,7 @@ private String execCleanApproval() { * @return */ private String execAddTestentity() { - String name = commands.length > 1 ? commands[1] : "TestAllFields999"; - String entityName = new TsetEntity().create(name); - - if (entityName.startsWith("EXISTS:")) return "WRAN: " + entityName; - else return "OK: " + entityName; - } - - /** - * @return - */ - private String execRbspkg() { - if (commands.length < 2) return "WRAN: Bad arguments"; - - String fileUrl = commands[1]; - RbSystemImporter importer = new RbSystemImporter(fileUrl); - try { - TaskExecutors.run(importer); - return "OK"; - } catch (Exception ex) { - log.error("RBSPKG", ex); - return "ERROR: " + ex.getLocalizedMessage(); - } + boolean o = new SimpleEntity().create(true, true, true); + return o ? "OK" : "WRAN: Cannot create:" + SimpleEntity.NAME; } } diff --git a/src/main/java/com/rebuild/web/admin/AdminVerfiyController.java b/src/main/java/com/rebuild/web/admin/AdminVerfiyController.java index 380f7bab6e..eca00bdedb 100644 --- a/src/main/java/com/rebuild/web/admin/AdminVerfiyController.java +++ b/src/main/java/com/rebuild/web/admin/AdminVerfiyController.java @@ -103,7 +103,7 @@ public RespBody adminCliExec(HttpServletRequest request) { String command = ServletUtils.getRequestString(request); if (StringUtils.isBlank(command)) return RespBody.error(); - String result = new AdminCli3(command).exec(); - return RespBody.ok(result); + String res = new AdminCli4(command).exec(); + return RespBody.ok(res); } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 1cc81c3310..c5aa685fac 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -1,5 +1,5 @@ # !!! `db.*` ONLY FOR DEV MODE !!! -db.url: jdbc:mysql://127.0.0.1:4653/rebuild40?characterEncoding=UTF8&useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B08:00 +db.url: jdbc:mysql://127.0.0.1:3306/rebuild40?characterEncoding=UTF8&useUnicode=true&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B08:00 db.user: rebuild db.passwd: rebuild # Use built-in ehcache if redis not defined or unavailable diff --git a/src/main/resources/web/admin/setup/rbsystem.html b/src/main/resources/web/admin/setup/rbsystem.html index 1778d3ab54..c94b6d3fdb 100644 --- a/src/main/resources/web/admin/setup/rbsystem.html +++ b/src/main/resources/web/admin/setup/rbsystem.html @@ -30,14 +30,15 @@ font-weight: normal; margin-top: 10px; } - .rb-welcome li > a { + .rb-welcome li > .item { display: block; border: 1px solid #eee; padding: 15px 20px; margin-bottom: 10px; border-radius: 2px; + cursor: pointer; } - .rb-welcome li > a:hover { + .rb-welcome li > .item:hover { border: 1px solid #4285f4; background-color: #e6eff8; } @@ -69,6 +70,6 @@

[[${bundle.L('请稍后')}]]

- + diff --git a/src/main/resources/web/assets/js/admin/rbsystem-install.js b/src/main/resources/web/assets/js/admin/setup-rbsystem.js similarity index 77% rename from src/main/resources/web/assets/js/admin/rbsystem-install.js rename to src/main/resources/web/assets/js/admin/setup-rbsystem.js index 0e159b0346..b9467bc3c2 100644 --- a/src/main/resources/web/assets/js/admin/rbsystem-install.js +++ b/src/main/resources/web/assets/js/admin/setup-rbsystem.js @@ -24,10 +24,24 @@ class Setup extends React.Component { {this.props.data.map((item) => { return (
  • - this.install(item)}> +
  • ) })} @@ -71,7 +85,7 @@ class Setup extends React.Component { install(item) { const warningTip = (
    -
    {WrapHtml($L('安装系统模版将清空您现有系统的所有数据,包括系统配置、业务实体、数据等。安装前强烈建议您做好系统备份。'))}
    +
    {WrapHtml($L('安装系统模版将清空您现有系统的所有数据,包括系统配置、业务实体、数据以及附件等。安装前强烈建议您做好系统备份。'))}
    ) @@ -79,7 +93,7 @@ class Setup extends React.Component { RbAlert.create(warningTip, { icon: ' mdi mdi-database-refresh-outline', type: 'danger', - confirmText: $L('开始安装'), + confirmText: $L('清空并安装'), countdown: 10, onConfirm: function () { this.hide() diff --git a/src/test/java/com/rebuild/TestSupport.java b/src/test/java/com/rebuild/TestSupport.java index cab5c94ed3..cb6a391ad6 100644 --- a/src/test/java/com/rebuild/TestSupport.java +++ b/src/test/java/com/rebuild/TestSupport.java @@ -17,16 +17,14 @@ import com.rebuild.core.UserContextHolder; import com.rebuild.core.metadata.EntityHelper; import com.rebuild.core.metadata.MetadataHelper; -import com.rebuild.core.metadata.easymeta.DisplayType; import com.rebuild.core.metadata.impl.DynamicMetadataContextHolder; import com.rebuild.core.metadata.impl.Entity2Schema; -import com.rebuild.core.metadata.impl.Field2Schema; import com.rebuild.core.privileges.UserService; import com.rebuild.core.rbstore.MetaschemaImporter; +import com.rebuild.core.support.setup.SimpleEntity; import com.rebuild.core.support.task.HeavyTask; import com.rebuild.core.support.task.TaskExecutors; import com.rebuild.utils.AppUtils; -import com.rebuild.utils.BlockList; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.math.RandomUtils; import org.junit.jupiter.api.AfterAll; @@ -83,7 +81,7 @@ public void setDownPerMethod() { // -- 测试实体 // 全部字段类型 - protected static final String TestAllFields = "TestAllFields"; + protected static final String TestAllFields = SimpleEntity.NAME; // 业务实体 protected static final String Account = "Account999"; @@ -114,54 +112,17 @@ public void setDownPerMethod() { protected static boolean addTestEntities(boolean dropExists) throws Exception { boolean changed = false; if (dropExists) { - if (MetadataHelper.containsEntity(TestAllFields)) { - _log.warn("Dropping test entity : " + TestAllFields); - new Entity2Schema(UserService.ADMIN_USER).dropEntity(MetadataHelper.getEntity(TestAllFields), true); - } - if (MetadataHelper.containsEntity(SalesOrder)) { _log.warn("Dropping test entity : " + SalesOrder); new Entity2Schema(UserService.ADMIN_USER).dropEntity(MetadataHelper.getEntity(SalesOrder), true); } - if (MetadataHelper.containsEntity(Account)) { _log.warn("Dropping test entity : " + Account); new Entity2Schema(UserService.ADMIN_USER).dropEntity(MetadataHelper.getEntity(Account), true); } } - if (!MetadataHelper.containsEntity(TestAllFields)) { - Entity2Schema entity2Schema = new Entity2Schema(UserService.ADMIN_USER); - String entityName = entity2Schema.createEntity( - null, TestAllFields.toUpperCase(), null, null, Boolean.TRUE, Boolean.FALSE); - Entity testEntity = MetadataHelper.getEntity(entityName); - - for (DisplayType dt : DisplayType.values()) { - if (dt == DisplayType.ID) { - continue; - } - - String fieldName = dt.name().toUpperCase(); - if (BlockList.isBlock(fieldName)) fieldName += "1"; - - if (dt == DisplayType.REFERENCE || dt == DisplayType.N2NREFERENCE) { - new Field2Schema(UserService.ADMIN_USER) - .createField(testEntity, fieldName, dt, null, entityName, null); - } else if (dt == DisplayType.CLASSIFICATION) { - JSON extra = JSON.parseObject("{classification:'018-0000000000000001'}"); - new Field2Schema(UserService.ADMIN_USER) - .createField(testEntity, fieldName, dt, null, entityName, extra); - } else if (dt == DisplayType.STATE) { - JSON extra = JSON.parseObject("{stateClass:'com.rebuild.core.support.state.HowtoState'}"); - new Field2Schema(UserService.ADMIN_USER) - .createField(testEntity, fieldName, dt, null, entityName, extra); - } else { - new Field2Schema(UserService.ADMIN_USER) - .createField(testEntity, fieldName, dt, null, null, null); - } - } - changed = true; - } + new SimpleEntity().create(true, true, true); if (!MetadataHelper.containsEntity(Account)) { String metaschema = FileUtils.readFileToString( @@ -170,7 +131,6 @@ protected static boolean addTestEntities(boolean dropExists) throws Exception { TaskExecutors.run((HeavyTask) importer.setUser(UserService.ADMIN_USER)); changed = true; } - if (!MetadataHelper.containsEntity(SalesOrder)) { String metaschema = FileUtils.readFileToString( ResourceUtils.getFile("classpath:schema-SalesOrder999.json"), AppUtils.UTF8); @@ -194,17 +154,6 @@ protected static ID addRecordOfTestAllFields(ID user) { } Entity testEntity = MetadataHelper.getEntity(TestAllFields); - - // 自动添加权限 - if (!Application.getPrivilegesManager().allowCreate(user, testEntity.getEntityCode())) { - Record p = EntityHelper.forNew(EntityHelper.RolePrivileges, user); - p.setID("roleId", SIMPLE_ROLE); - p.setInt("entity", testEntity.getEntityCode()); - p.setString("definition", "{'A':1,'R':1,'C':4,'S':1,'D':1,'U':1}"); - Application.getCommonsService().create(p, Boolean.FALSE); - Application.getUserStore().refreshRole(SIMPLE_ROLE); - } - Record record = EntityHelper.forNew(testEntity.getEntityCode(), user); record.setString("TestAllFieldsName", "TestAllFieldsName-" + RandomUtils.nextLong()); record.setString("text", "TEXT-" + RandomUtils.nextLong()); From fd709254a68f11b33bdd7b6c860fdd1e530e23a1 Mon Sep 17 00:00:00 2001 From: RB Date: Sun, 29 Dec 2024 13:05:00 +0800 Subject: [PATCH 06/15] Update RbSystemController.java --- .../rebuild/web/admin/setup/RbSystemController.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java b/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java index cbba95935b..413c7ae8a5 100644 --- a/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java +++ b/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java @@ -12,6 +12,7 @@ import com.rebuild.core.rbstore.RbSystemImporter; import com.rebuild.core.support.setup.InstallState; import com.rebuild.core.support.task.TaskExecutors; +import com.rebuild.utils.RbAssert; import com.rebuild.web.BaseController; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -31,12 +32,19 @@ public class RbSystemController extends BaseController implements InstallState { @GetMapping({"rbsystems", "appstore"}) - public ModelAndView index() throws IOException { + public ModelAndView index(HttpServletRequest request) throws IOException { + try { + RbAssert.isSuperAdmin(getRequestUser(request)); + } catch (Exception error404) { + throw new RebuildException("NOT ALLOWED"); + } return createModelAndView("/admin/setup/rbsystem"); } @PostMapping("install-rbsystem") public RespBody install(HttpServletRequest request) throws IOException { + RbAssert.isSuperAdmin(getRequestUser(request)); + String file = getParameterNotNull(request, "file"); RbSystemImporter importer = new RbSystemImporter("rbsystems/" + file); try { From e8214b06fa521e973e89210b8c1f7d55ad07e352 Mon Sep 17 00:00:00 2001 From: RB Date: Sun, 29 Dec 2024 13:25:45 +0800 Subject: [PATCH 07/15] be --- .../com/rebuild/web/admin/rbstore/RBStoreController.java | 6 ++---- .../java/com/rebuild/web/admin/setup/InstallController.java | 4 ++-- .../com/rebuild/web/admin/setup/RbSystemController.java | 5 +++-- src/main/resources/web/assets/js/admin/setup-rbsystem.js | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rebuild/web/admin/rbstore/RBStoreController.java b/src/main/java/com/rebuild/web/admin/rbstore/RBStoreController.java index ac46fa902b..481210f096 100644 --- a/src/main/java/com/rebuild/web/admin/rbstore/RBStoreController.java +++ b/src/main/java/com/rebuild/web/admin/rbstore/RBStoreController.java @@ -29,12 +29,10 @@ @RestController public class RBStoreController extends BaseController { - @GetMapping("/admin/rbstore/load-index") + @GetMapping({"/admin/rbstore/load-index", "/setup/load-index"}) public JSONAware loadDataIndex(HttpServletRequest request) { String type = getParameterNotNull(request, "type"); - if (CommonsUtils.isExternalUrl(type)) { - return RespBody.error(); - } + if (CommonsUtils.isExternalUrl(type)) return RespBody.error(); JSON index = null; try { diff --git a/src/main/java/com/rebuild/web/admin/setup/InstallController.java b/src/main/java/com/rebuild/web/admin/setup/InstallController.java index 4612de781d..e03a7dfcdb 100644 --- a/src/main/java/com/rebuild/web/admin/setup/InstallController.java +++ b/src/main/java/com/rebuild/web/admin/setup/InstallController.java @@ -13,7 +13,7 @@ import com.alibaba.fastjson.JSONObject; import com.rebuild.api.RespBody; import com.rebuild.core.Application; -import com.rebuild.core.RebuildException; +import com.rebuild.core.DefinedException; import com.rebuild.core.support.License; import com.rebuild.core.support.i18n.Language; import com.rebuild.core.support.setup.InstallState; @@ -53,7 +53,7 @@ public class InstallController extends BaseController implements InstallState { @Override public boolean checkInstalled() { if (InstallState.super.checkInstalled() && Application.isReady()) { - throw new RebuildException("NOT ALLOWED"); + throw new DefinedException("NOT ALLOWED"); } return false; } diff --git a/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java b/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java index 413c7ae8a5..221399ad2b 100644 --- a/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java +++ b/src/main/java/com/rebuild/web/admin/setup/RbSystemController.java @@ -8,6 +8,7 @@ package com.rebuild.web.admin.setup; import com.rebuild.api.RespBody; +import com.rebuild.core.DefinedException; import com.rebuild.core.RebuildException; import com.rebuild.core.rbstore.RbSystemImporter; import com.rebuild.core.support.setup.InstallState; @@ -35,8 +36,8 @@ public class RbSystemController extends BaseController implements InstallState { public ModelAndView index(HttpServletRequest request) throws IOException { try { RbAssert.isSuperAdmin(getRequestUser(request)); - } catch (Exception error404) { - throw new RebuildException("NOT ALLOWED"); + } catch (Exception error403) { + throw new DefinedException("NOT ALLOWED"); } return createModelAndView("/admin/setup/rbsystem"); } diff --git a/src/main/resources/web/assets/js/admin/setup-rbsystem.js b/src/main/resources/web/assets/js/admin/setup-rbsystem.js index b9467bc3c2..4617c5b3d8 100644 --- a/src/main/resources/web/assets/js/admin/setup-rbsystem.js +++ b/src/main/resources/web/assets/js/admin/setup-rbsystem.js @@ -107,7 +107,7 @@ class Setup extends React.Component { } $(document).ready(() => { - $.get('/admin/rbstore/load-index?type=rbsystems', (res) => { + $.get('/setup/load-index?type=rbsystems', (res) => { if ((res.data || []).length > 0) { renderRbcomp(, $('.card-body')) } else { From ee7f81a7524cdf092e42958b5906bea58db81f23 Mon Sep 17 00:00:00 2001 From: RB Date: Sun, 29 Dec 2024 20:46:49 +0800 Subject: [PATCH 08/15] be --- .../core/support/setup/SimpleEntity.java | 25 +++++++++++++------ .../java/com/rebuild/utils/BlockList.java | 1 - src/main/resources/blocklist.json | 3 ++- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java b/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java index 4d546ff714..ffaaa4433e 100644 --- a/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java +++ b/src/main/java/com/rebuild/core/support/setup/SimpleEntity.java @@ -16,6 +16,7 @@ import com.rebuild.core.metadata.EntityHelper; import com.rebuild.core.metadata.MetadataHelper; import com.rebuild.core.metadata.easymeta.DisplayType; +import com.rebuild.core.metadata.impl.DynamicMetadataContextHolder; import com.rebuild.core.metadata.impl.Entity2Schema; import com.rebuild.core.metadata.impl.Field2Schema; import com.rebuild.core.privileges.UserService; @@ -40,6 +41,15 @@ public class SimpleEntity { * @return */ public boolean create(boolean dropExists, boolean includeBuiltin, boolean addPrivileges) { + try { + DynamicMetadataContextHolder.setSkipLanguageRefresh(); + return this.createInternal(dropExists, includeBuiltin, addPrivileges); + } finally { + DynamicMetadataContextHolder.setSkipLanguageRefresh(); + } + } + + private boolean createInternal(boolean dropExists, boolean includeBuiltin, boolean addPrivileges) { if (MetadataHelper.containsEntity(NAME)) { if (dropExists) { log.warn("Dropping exists : {}", NAME); @@ -51,30 +61,31 @@ public boolean create(boolean dropExists, boolean includeBuiltin, boolean addPri Entity2Schema entity2Schema = new Entity2Schema(UserService.SYSTEM_USER); entity2Schema.createEntity( - NAME.toUpperCase(), "RB示例实体", "演示实体/字段的基本用法。更多详情参阅 https://getrebuild.com/docs/admin/entity/", null, true, true); + NAME, "RB示例实体", "演示实体/字段的基本用法。更多详情参阅 https://getrebuild.com/docs/admin/entity/", null, true, false); final Entity entity = MetadataHelper.getEntity(NAME); Field2Schema field2Schema = new Field2Schema(UserService.SYSTEM_USER); for (DisplayType dt : DisplayType.values()) { - if (dt == DisplayType.ID || dt == DisplayType.SERIES) continue; + if (dt == DisplayType.ID) continue; if (!includeBuiltin) { if (dt == DisplayType.STATE || dt == DisplayType.ANYREFERENCE) continue; } - String fieldName = dt.name().toUpperCase(); + String fieldName = dt.name(); if (BlockList.isBlock(fieldName)) fieldName += "1"; + String fieldLabel = dt.getDisplayName(); if (dt == DisplayType.REFERENCE || dt == DisplayType.N2NREFERENCE) { - field2Schema.createField(entity, fieldName, dt, null, NAME, null); + field2Schema.createField(entity, fieldLabel, fieldName, dt, null, NAME, null); } else if (dt == DisplayType.CLASSIFICATION) { JSON extConfig = JSON.parseObject("{classification:'018-0000000000000001'}"); - field2Schema.createField(entity, fieldName, dt, null, NAME, extConfig); + field2Schema.createField(entity, fieldLabel, fieldName, dt, null, NAME, extConfig); } else if (dt == DisplayType.STATE) { JSON extConfig = JSON.parseObject("{stateClass:'com.rebuild.core.support.state.HowtoState'}"); - field2Schema.createField(entity, fieldName, dt, null, NAME, extConfig); + field2Schema.createField(entity, fieldLabel, fieldName, dt, null, NAME, extConfig); } else { - field2Schema.createField(entity, fieldName, dt, null, null, null); + field2Schema.createField(entity, fieldLabel, fieldName, dt, null, null, null); } } diff --git a/src/main/java/com/rebuild/utils/BlockList.java b/src/main/java/com/rebuild/utils/BlockList.java index 85a622b4a7..904362a6cb 100644 --- a/src/main/java/com/rebuild/utils/BlockList.java +++ b/src/main/java/com/rebuild/utils/BlockList.java @@ -33,7 +33,6 @@ public static boolean isBlock(String text) { String s = CommonsUtils.getStringOfRes("blocklist.json"); BLOCKED = JSON.parseArray(s == null ? JSONUtils.EMPTY_ARRAY_STR : s); } - return BLOCKED.contains(text.toLowerCase()) || isSqlKeyword(text); } diff --git a/src/main/resources/blocklist.json b/src/main/resources/blocklist.json index d69c084d58..12f209d3ca 100644 --- a/src/main/resources/blocklist.json +++ b/src/main/resources/blocklist.json @@ -534,5 +534,6 @@ "current", "main", "detail", - "forceReload" + "forceReload", + "url" ] \ No newline at end of file From 9b772983bdcb2242b7c8a291547322a8f1e57573 Mon Sep 17 00:00:00 2001 From: RB Date: Sun, 29 Dec 2024 21:27:35 +0800 Subject: [PATCH 09/15] deepseek --- .../java/com/rebuild/utils/DeepSeekChat.java | 69 +++++++++++++++++++ src/test/resources/prompt.md | 9 +++ 2 files changed, 78 insertions(+) create mode 100644 src/test/java/com/rebuild/utils/DeepSeekChat.java create mode 100644 src/test/resources/prompt.md diff --git a/src/test/java/com/rebuild/utils/DeepSeekChat.java b/src/test/java/com/rebuild/utils/DeepSeekChat.java new file mode 100644 index 0000000000..4c9a99e6c9 --- /dev/null +++ b/src/test/java/com/rebuild/utils/DeepSeekChat.java @@ -0,0 +1,69 @@ +package com.rebuild.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Scanner; + +public class DeepSeekChat { + + public static void main(String[] args) throws Exception { + JSONArray messages = new JSONArray(); + String prompt = CommonsUtils.getStringOfRes("prompt.md"); + messages.add(buildMessage(prompt, "system")); + print(messages, false); + + JSONObject res = completions(messages); + JSONObject c = res.getJSONArray("choices").getJSONObject(0); + messages.add(c.get("message")); + + Scanner scanner = new Scanner(System.in); + while (true) { + print(messages, true); + + String user = scanner.next(); + if ("QUIT".equalsIgnoreCase(user)) break; + + messages.add(buildMessage(user, null)); + res = completions(messages); + c = res.getJSONArray("choices").getJSONObject(0); + messages.add(c.get("message")); + } + + System.out.println("bye"); + scanner.close(); + System.exit(0); + } + + static JSONObject completions(JSONArray messages) throws IOException { + Map headers = new HashMap<>(); + headers.put("Content-Type", "application/json"); + headers.put("Accept", "application/json"); + headers.put("Authorization", "Bearer sk-ef4fa5d9972745d4be4e32258a4c822d"); + + JSONObject body = new JSONObject(); + body.put("model", "deepseek-chat"); + body.put("stream", false); + body.put("max_tokens", 2048); + body.put("temperature", 0.2); + body.put("messages", messages); + + String res = OkHttpUtils.post("https://api.deepseek.com/chat/completions", body, headers); + return (JSONObject) JSON.parse(res); + } + + static JSONObject buildMessage(String content, String role) { + if (role == null) role = "user"; + return JSONUtils.toJSONObject(new String[]{"role", "content"}, new Object[]{role, content}); + } + + static void print(JSONArray messages, boolean ask) { + JSONObject m = messages.getJSONObject(messages.size() - 1); + System.out.println("@" + m.getString("role").toUpperCase() + ":\n" + m.getString("content") + "\n----"); + if (ask) System.out.println("请输入:"); + } +} diff --git a/src/test/resources/prompt.md b/src/test/resources/prompt.md new file mode 100644 index 0000000000..4018fc8872 --- /dev/null +++ b/src/test/resources/prompt.md @@ -0,0 +1,9 @@ +你是 REBUILD 企业管理系统的文档助手,请根据文档解答用户提出的问题,并把文档的具体地址附加到回答尾。文档地址是 https://getrebuild.com/docs/ 你需要学习一下。 + +需要注意,文档分为两个部分: + +1. https://getrebuild.com/docs/admin/ 管理员手册 +2. https://getrebuild.com/docs/manual/ 用户手册 + +用户提出的问题大都是管理员手册中的问题,请更多的参考管理员手册中的内容。同时,管理员所使用的功能都集中再“管理中心”中。 + From 82ce68ff14ff8e6d4d189f94d8b1c059cce6955b Mon Sep 17 00:00:00 2001 From: RB Date: Mon, 30 Dec 2024 22:54:17 +0800 Subject: [PATCH 10/15] list:advListAsideShows --- @rbv | 2 +- Dockerfile | 2 +- .../web/assets/css/entity-advanced.css | 33 ++++- .../web/assets/js/general/list-fields.js | 6 +- .../web/assets/js/metadata/entity-advanced.js | 122 ++++++++++++++++-- .../web/assets/js/metadata/list-stats.js | 6 +- .../web/assets/js/metadata/view-addons.js | 8 +- .../resources/web/assets/js/rb-components.js | 1 + 8 files changed, 158 insertions(+), 22 deletions(-) diff --git a/@rbv b/@rbv index 590565da37..738ee7e81d 160000 --- a/@rbv +++ b/@rbv @@ -1 +1 @@ -Subproject commit 590565da373b31594e941a4bd67537c398659488 +Subproject commit 738ee7e81da0a7121e94612a8fff8b60a7bc88b6 diff --git a/Dockerfile b/Dockerfile index ea89fee2b2..b1ef765821 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM amazoncorretto:11-alpine +#docker pull amazoncorretto:11-alpine RUN apk add ttf-dejavu EXPOSE 18080 COPY ./target/rebuild.jar /app/rebuild/rebuild-boot.jar - #COPY ./.deploy/SourceHanSansK-Regular.ttf /app/rebuild/.rebuild/ WORKDIR /app/rebuild/ diff --git a/src/main/resources/web/assets/css/entity-advanced.css b/src/main/resources/web/assets/css/entity-advanced.css index c194708f18..e5b81e65c7 100644 --- a/src/main/resources/web/assets/css/entity-advanced.css +++ b/src/main/resources/web/assets/css/entity-advanced.css @@ -152,6 +152,37 @@ See LICENSE and COMMERCIAL in the project root for license information. border-radius: 99px; } -.aside-show .aside-item + .aside-item { +.aside-show .aside-item + .aside-item, +.topside + .topside { margin-top: 10px; } + +.aside-show .aside-item > span, +.topside-item > span { + display: inline-block; + margin-left: 10px; + transform: translateY(5px); +} + +.aside-show .aside-item > span + a { + font-size: 1.23rem; + color: #a1a1a1; + margin-left: 6px; + transform: translateY(6px); + display: none; +} + +.aside-show .aside-item > span + a:hover { + color: rgb(128, 128, 128); +} + +.aside-show .aside-item:hover > span + a { + display: inline-block; +} + +.aside-show .aside-item > span.star::after { + content: '*'; + margin-left: 4px; + font-weight: bold; + color: #fbbc05; +} diff --git a/src/main/resources/web/assets/js/general/list-fields.js b/src/main/resources/web/assets/js/general/list-fields.js index dc2f7d5d4c..87a765d1ab 100644 --- a/src/main/resources/web/assets/js/general/list-fields.js +++ b/src/main/resources/web/assets/js/general/list-fields.js @@ -41,7 +41,7 @@ $(document).ready(() => { _configSorts[fkey] = this.sort }) - refreshConfigStar() + _refreshConfigStar() // 覆盖自有配置 if (res.data) { @@ -129,7 +129,7 @@ $(document).ready(() => { }) }) -const refreshConfigStar = function () { +const _refreshConfigStar = function () { $('.dd-list.J_config .dd-item').each(function () { const fkey = $(this).data('key') if (_configLabels[fkey] || _configWidths[fkey] || _configSorts[fkey]) { @@ -166,7 +166,7 @@ render_item_after = function ($item) { _configSorts = {} _configSorts[fkey] = s.sort } - refreshConfigStar() + _refreshConfigStar() }} />, function () { diff --git a/src/main/resources/web/assets/js/metadata/entity-advanced.js b/src/main/resources/web/assets/js/metadata/entity-advanced.js index fcce23c7bc..1e0ff299c2 100644 --- a/src/main/resources/web/assets/js/metadata/entity-advanced.js +++ b/src/main/resources/web/assets/js/metadata/entity-advanced.js @@ -7,6 +7,7 @@ See LICENSE and COMMERCIAL in the project root for license information. /* eslint-disable react/no-string-refs */ const wpc = window.__PageConfig +const _advListAsideShows = (wpc.extConfig || {}).advListAsideShows || {} $(document).ready(() => { _listmodeAction() @@ -120,7 +121,10 @@ class DlgMode1Option extends RbFormHandler {