From 8426dd2d1812a327dc16965f2488b4e20bb70cc6 Mon Sep 17 00:00:00 2001 From: o2sword <171715986@qq.com> Date: Mon, 22 Nov 2021 16:08:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=BA=94=E7=94=A8=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E9=87=8D=E5=A4=8D=E7=9A=84=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/x/cms/core/entity/AppInfo.java | 24 ++++--------------- .../java/com/x/portal/core/entity/Portal.java | 13 ++++++---- .../core/entity/element/Application.java | 10 ++++++-- .../java/com/x/query/core/entity/Query.java | 14 +++++++---- 4 files changed, 32 insertions(+), 29 deletions(-) diff --git a/o2server/x_cms_core_entity/src/main/java/com/x/cms/core/entity/AppInfo.java b/o2server/x_cms_core_entity/src/main/java/com/x/cms/core/entity/AppInfo.java index 9872689650..285db5b360 100644 --- a/o2server/x_cms_core_entity/src/main/java/com/x/cms/core/entity/AppInfo.java +++ b/o2server/x_cms_core_entity/src/main/java/com/x/cms/core/entity/AppInfo.java @@ -36,10 +36,12 @@ public class AppInfo extends SliceJpaObject { private static final long serialVersionUID = 3856138316794473794L; private static final String TABLE = PersistenceProperties.AppInfo.table; + @Override public String getId() { return id; } + @Override public void setId(String id) { this.id = id; } @@ -50,32 +52,16 @@ public class AppInfo extends SliceJpaObject { @Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME) private String id = createId(); + @Override public void onPersist() throws Exception { } - /* - * ========================================================================= - * ========= 以上为 JpaObject 默认字段 - * ========================================================================= - * ========= - */ - - /* - * ========================================================================= - * ========= 以下为具体不同的业务及数据表字段要求 - * ========================================================================= - * ========= - */ - - /* 更新运行方法 */ - // public static String[] FLA GS = new String[] { "id", "appAlias", "appName" }; public static final String appName_FIELDNAME = "appName"; @Flag @FieldDescribe("栏目名称") @Column(length = JpaObject.length_96B, name = ColumnNamePrefix + appName_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + appName_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + appName_FIELDNAME, unique = true) @CheckPersist(citationNotExists = { - /* 验证不可重名 */ - @CitationNotExist(fields = "appName", type = AppInfo.class) }, allowEmpty = true) + @CitationNotExist(fields = "appName", type = AppInfo.class) }, allowEmpty = false) private String appName; public static final String appAlias_FIELDNAME = "appAlias"; diff --git a/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Portal.java b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Portal.java index 1d2fc48419..136e817f65 100644 --- a/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Portal.java +++ b/o2server/x_portal_core_entity/src/main/java/com/x/portal/core/entity/Portal.java @@ -31,6 +31,10 @@ import com.x.base.core.entity.annotation.ContainerEntity; import com.x.base.core.entity.annotation.Flag; import com.x.base.core.project.annotation.FieldDescribe; +/** + * 门户平台应用 + * @author sword + */ @Entity @ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) @Table(name = PersistenceProperties.Portal.table, uniqueConstraints = { @@ -43,10 +47,12 @@ public class Portal extends SliceJpaObject { private static final long serialVersionUID = -7520516033901189347L; private static final String TABLE = PersistenceProperties.Portal.table; + @Override public String getId() { return id; } + @Override public void setId(String id) { this.id = id; } @@ -58,6 +64,7 @@ public class Portal extends SliceJpaObject { /* 以上为 JpaObject 默认字段 */ + @Override public void onPersist() throws Exception { this.portalCategory = StringUtils.trimToEmpty(this.portalCategory); this.firstPage = StringUtils.trimToEmpty(this.firstPage); @@ -70,9 +77,8 @@ public class Portal extends SliceJpaObject { @Flag @FieldDescribe("名称.") @Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME) - @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME, unique = true) @CheckPersist(allowEmpty = false, simplyString = true, citationNotExists = - /* 检查不重名 */ @CitationNotExist(type = Portal.class, fields = { JpaObject.id_FIELDNAME, "name", "alias" })) private String name; @@ -82,7 +88,6 @@ public class Portal extends SliceJpaObject { @Column(length = length_255B, name = ColumnNamePrefix + alias_FIELDNAME) @Index(name = TABLE + IndexNameMiddle + alias_FIELDNAME) @CheckPersist(allowEmpty = true, simplyString = true, citationNotExists = - /* 检查不重名 */ @CitationNotExist(type = Portal.class, fields = { "id", "name", "alias" })) private String alias; @@ -302,4 +307,4 @@ public class Portal extends SliceJpaObject { this.mobileClient = mobileClient; } -} \ No newline at end of file +} diff --git a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java index 6c43803958..dfa3c58792 100644 --- a/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java +++ b/o2server/x_processplatform_core_entity/src/main/java/com/x/processplatform/core/entity/element/Application.java @@ -32,6 +32,10 @@ import com.x.base.core.entity.annotation.Flag; import com.x.base.core.project.annotation.FieldDescribe; import com.x.processplatform.core.entity.PersistenceProperties; +/** + * 流程平台应用 + * @author sword + */ @Entity @ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.element, reference = ContainerEntity.Reference.strong) @Table(name = PersistenceProperties.Element.Application.table, uniqueConstraints = { @@ -44,10 +48,12 @@ public class Application extends SliceJpaObject { private static final long serialVersionUID = -7520516033901189347L; private static final String TABLE = PersistenceProperties.Element.Application.table; + @Override public String getId() { return id; } + @Override public void setId(String id) { this.id = id; } @@ -59,6 +65,7 @@ public class Application extends SliceJpaObject { /* 以上为 JpaObject 默认字段 */ + @Override public void onPersist() throws Exception { this.applicationCategory = StringUtils.trimToEmpty(this.applicationCategory); } @@ -72,8 +79,8 @@ public class Application extends SliceJpaObject { @Flag @FieldDescribe("名称.") @Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME, unique = true) @CheckPersist(allowEmpty = false, simplyString = true, citationNotExists = - /* 检查不重名 */ @CitationNotExist(type = Application.class, fields = { "id", "name", "alias" })) private String name; @@ -82,7 +89,6 @@ public class Application extends SliceJpaObject { @FieldDescribe("应用别名,如果有必须唯一.") @Column(length = length_255B, name = ColumnNamePrefix + alias_FIELDNAME) @CheckPersist(allowEmpty = true, simplyString = true, citationNotExists = - /* 检查不重名 */ @CitationNotExist(type = Application.class, fields = { "id", "name", "alias" })) private String alias; diff --git a/o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/Query.java b/o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/Query.java index b207717d8e..0ecd21f5bb 100644 --- a/o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/Query.java +++ b/o2server/x_query_core_entity/src/main/java/com/x/query/core/entity/Query.java @@ -32,6 +32,10 @@ import com.x.base.core.entity.annotation.ContainerEntity; import com.x.base.core.entity.annotation.Flag; import com.x.base.core.project.annotation.FieldDescribe; +/** + * 数据中心应用 + * @author sword + */ @Entity @ContainerEntity(dumpSize = 10, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong) @Table(name = PersistenceProperties.Query.table, uniqueConstraints = { @@ -44,10 +48,12 @@ public class Query extends SliceJpaObject { private static final long serialVersionUID = -7520516033901189347L; private static final String TABLE = PersistenceProperties.Query.table; + @Override public String getId() { return id; } + @Override public void setId(String id) { this.id = id; } @@ -66,6 +72,7 @@ public class Query extends SliceJpaObject { /* 以上为 JpaObject 默认字段 */ + @Override public void onPersist() throws Exception { this.name = StringUtils.trimToEmpty(this.name); this.alias = StringUtils.trimToEmpty(this.alias); @@ -81,9 +88,9 @@ public class Query extends SliceJpaObject { @Flag @FieldDescribe("名称.") @Column(length = length_255B, name = ColumnNamePrefix + name_FIELDNAME) + @Index(name = TABLE + IndexNameMiddle + name_FIELDNAME, unique = true) @CheckPersist(allowEmpty = false, simplyString = true, citationNotExists = - /* 检查不重名 */ - @CitationNotExist(type = Query.class, fields = { "id", "name", "alias" })) + @CitationNotExist(type = Query.class, fields = { "name", "alias" })) private String name; public static final String alias_FIELDNAME = "alias"; @@ -91,8 +98,7 @@ public class Query extends SliceJpaObject { @FieldDescribe("应用别名,如果有必须唯一.") @Column(length = length_255B, name = ColumnNamePrefix + alias_FIELDNAME) @CheckPersist(allowEmpty = true, simplyString = true, citationNotExists = - /* 检查不重名 */ - @CitationNotExist(type = Query.class, fields = { "id", "name", "alias" })) + @CitationNotExist(type = Query.class, fields = { "name", "alias" })) private String alias; public static final String description_FIELDNAME = "description"; -- GitLab