From 1b8347db894173090b1db46e3bc079b6d08860bf Mon Sep 17 00:00:00 2001 From: "castle.zang" Date: Mon, 5 Dec 2022 13:34:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8E=9F=E7=94=9Fsql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/base/enumutil/BlockFormEnumUtil.java | 177 +++++++++++++++++++++ .../cn/estsh/i3plus/pojo/form/bean/BfButton.java | 8 + .../pojo/form/bean/BfDataObjectProperty.java | 3 + .../cn/estsh/i3plus/pojo/form/bean/BfElement.java | 83 ++++++---- 4 files changed, 240 insertions(+), 31 deletions(-) diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java index e1d463d..1c6f611 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/enumutil/BlockFormEnumUtil.java @@ -12,6 +12,182 @@ import java.util.Objects; * @Modify: **/ public class BlockFormEnumUtil { + /** + * common普通操作,不执行脚本 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum FORM_SCRIPT_TYPE { + SAVE(1, "save", "保存"), + UPDATE(2, "update", "更新"), + DELETE(3, "delete", "删除"), + QUERY(4, "query", "查询"), + EXPORT(5, "export", "导出"), + IMPORT(6, "import", "导入"), + COMMON(7,"common","普通操作"); + + private int value; + private String type; + private String description; + + FORM_SCRIPT_TYPE(int value, String type, String description) { + this.value = value; + this.type = type; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getCode() { + return type; + } + + public String getDescription() { + return description; + } + + public static String valueOfCode(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].type; + } + } + return tmp; + } + + public static int codeOfValue(String code) { + int tmp = 1; + for (int i = 0; i < values().length; i++) { + if (values()[i].type.toLowerCase().equals(code.toLowerCase())) { + tmp = values()[i].value; + } + } + return tmp; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + + public static FORM_SCRIPT_TYPE valueOf(int val) { + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + return values()[i]; + } + } + return null; + } + + public static String codeOfDescription(String code) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].type.equals(code)) { + tmp = values()[i].description; + } + } + return tmp; + } + } + + /** + * 选择执行脚本的位置 + */ + @JsonFormat(shape = JsonFormat.Shape.OBJECT) + public enum FORM_SCRIPT_FUN_TYPE { + BEFORE_SAVE(1, "beforeSave", "保存前执行"), + AFTER_SAVE(2, "afterSave", "保存后执行"), + BEFORE_UPDATE(3, "beforeUpdate", "更新前执行"), + AFTER_UPDATE(4, "afterUpdate", "更新后执行"), + BEFORE_DELETE(5, "beforeDelete", "删除前执行"), + AFTER_DELETE(6, "afterDelete", "删除后执行"), + BEFORE_QUERY(7, "beforeQuery", "查询前执行"), + AFTER_QUERY(8, "afterQuery", "查询后执行"), + BEFORE_EXPORT(9, "beforeExport", "导出前执行"), + AFTER_EXPORT(10, "afterExport", "导出后执行"), + BEFORE_IMPORT(11, "beforeImport", "导入前执行"), + AFTER_IMPORT(12, "afterImport", "导入后执行"); + + + private int value; + private String funName; + private String description; + + FORM_SCRIPT_FUN_TYPE(int value, String funName, String description) { + this.value = value; + this.funName = funName; + this.description = description; + } + + public int getValue() { + return value; + } + + public String getCode() { + return funName; + } + + public String getDescription() { + return description; + } + + public static String valueOfCode(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].funName; + } + } + return tmp; + } + + public static int codeOfValue(String code) { + int tmp = 1; + for (int i = 0; i < values().length; i++) { + if (values()[i].funName.toLowerCase().equals(code.toLowerCase())) { + tmp = values()[i].value; + } + } + return tmp; + } + + public static String valueOfDescription(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + tmp = values()[i].description; + } + } + return tmp; + } + + public static FORM_SCRIPT_FUN_TYPE valueOf(int val) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].value == val) { + return values()[i]; + } + } + return null; + } + + public static String codeOfDescription(String code) { + String tmp = null; + for (int i = 0; i < values().length; i++) { + if (values()[i].funName.equals(code)) { + tmp = values()[i].description; + } + } + return tmp; + } + } /** * 原数据类型 @@ -1916,6 +2092,7 @@ public class BlockFormEnumUtil { */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum BUTTON_TRIGGER_EFFECT { + SCRIPT(60,"SCRIPT","执行脚本"), DIALOG(10, "DIALOG", "弹出窗口"), NEW_WINDOW(20, "NEW_WINDOW", "新开窗口"), SQL(30, "SQL", "执行SQL"), diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfButton.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfButton.java index 11a0bcf..b98f62f 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfButton.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfButton.java @@ -74,4 +74,12 @@ public class BfButton extends BaseBean { @Column(name = "BUTTON_DESCRIPTION") @ApiParam(value = "按钮描述") private String buttonDescription; + + @Column(name = "FUN_NAME") + @ApiParam(value = "groovy脚本时的方法名") + private String funName; + + @Column(name = "SCRIPT_NO") + @ApiParam(value = "脚本No") + private String scriptNo; } diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObjectProperty.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObjectProperty.java index e919715..85ed9ec 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObjectProperty.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObjectProperty.java @@ -125,6 +125,9 @@ public class BfDataObjectProperty extends BaseBean { @ApiParam(value ="属性描述") private String propertyDescription; + @Column(name = "REF_TABLE_NAME") + @ApiParam(value ="字段来源的表名--可空,如果自定义对象不可空") + private String refTableName; @Transient @ApiParam(value ="默认查询条件") private Integer objectColumnCustomWhere; diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java index 20b7111..ca2cb6f 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java @@ -54,27 +54,27 @@ public class BfElement extends BaseBean { @JsonSerialize(using = ToStringSerializer.class) private Long elementPropertyPrimaryKey; - @Column(name="ELEMENT_PROPERTY_PRIMARY_KEY_NAME_RDD") - @ApiParam(value ="元素主键Key名称") + @Column(name = "ELEMENT_PROPERTY_PRIMARY_KEY_NAME_RDD") + @ApiParam(value = "元素主键Key名称") private String elementPropertyPrimaryKeyNameRdd; - @Column(name="ELEMENT_TYPE") - @ApiParam(value ="元素类型") + @Column(name = "ELEMENT_TYPE") + @ApiParam(value = "元素类型") private Integer elementType; - @Column(name="ELEMENT_NAME") - @ApiParam(value ="元素名称") + @Column(name = "ELEMENT_NAME") + @ApiParam(value = "元素名称") private String elementName; - @Column(name="ELEMENT_CODE") - @ApiParam(value ="元素编码") + @Column(name = "ELEMENT_CODE") + @ApiParam(value = "元素编码") private String elementCode; @Column(name = "IS_OBJECT_ADD") @ApiParam(value = "是否新增") private Integer isObjectAdd; - public boolean isObjectAdd(){ + public boolean isObjectAdd() { return isObjectAdd != null && isObjectAdd == BlockFormEnumUtil.ELEMENT_ADD_STATUS.ON.getValue(); } @@ -82,7 +82,7 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否编辑") private Integer isObjectEdit; - public boolean isObjectEdit(){ + public boolean isObjectEdit() { return isObjectEdit != null && isObjectEdit == BlockFormEnumUtil.ELEMENT_EDIT_STATUS.ON.getValue(); } @@ -90,7 +90,7 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否删除") private Integer isObjectDel; - public boolean isObjectDel(){ + public boolean isObjectDel() { return isObjectDel != null && isObjectDel == BlockFormEnumUtil.ELEMENT_DEL_STATUS.ON.getValue(); } @@ -98,11 +98,11 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否弱删除") private Integer isObjectDelWeak; - public boolean isObjectDelWeak(){ + public boolean isObjectDelWeak() { return isObjectDelWeak != null && isObjectDelWeak == BlockFormEnumUtil.ELEMENT_DELETE_WEAK_STATUS.ON.getValue(); } - public Integer getIsObjectDelWeakVal(){ + public Integer getIsObjectDelWeakVal() { return isObjectDelWeak == null ? BlockFormEnumUtil.ELEMENT_DELETE_WEAK_STATUS.OFF.getValue() : isObjectDelWeak.intValue(); } @@ -114,11 +114,11 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否有效") private Integer isObjectValid; - public Integer getIsObjectValidVal(){ + public Integer getIsObjectValidVal() { return isObjectValid == null ? BlockFormEnumUtil.ELEMENT_VALID_STATUS.OFF.getValue() : isObjectValid.intValue(); } - public boolean isObjectValid(){ + public boolean isObjectValid() { return isObjectValid != null && isObjectValid == BlockFormEnumUtil.ELEMENT_VALID_STATUS.ON.getValue(); } @@ -130,13 +130,14 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否组织隔离") private Integer isOrganizeIsolation; - public Integer getIsOrganizeIsolationVal(){ + public Integer getIsOrganizeIsolationVal() { return isOrganizeIsolation == null ? BlockFormEnumUtil.ELEMENT_ORGANIZE_ISOLATION_STATUS.OFF.getValue() : isOrganizeIsolation.intValue(); } - public boolean isOrganizeIsolation(){ + public boolean isOrganizeIsolation() { return isOrganizeIsolation != null && isOrganizeIsolation == BlockFormEnumUtil.ELEMENT_ORGANIZE_ISOLATION_STATUS.ON.getValue(); } + @Column(name = "ELEMENT_ORGANIZE_ISOLATION_ATTR_ID") @ApiParam(value = "组织隔离属性id") private Long elementOrganizeIsolationAttrId; @@ -158,33 +159,53 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否导入") private Integer isObjectImport; - @Column(name="ELEMENT_SORT_ATTR_ID") - @ApiParam(value ="默认排序属性") + @Column(name = "ELEMENT_SORT_ATTR_ID") + @ApiParam(value = "默认排序属性") @JsonSerialize(using = ToStringSerializer.class) private Long elementSortAttrId; - @Column(name="ELEMENT_SORT_ATTR_CODE_RDD") - @ApiParam(value ="默认排序属性名称") + @Column(name = "ELEMENT_SORT_ATTR_CODE_RDD") + @ApiParam(value = "默认排序属性名称") private String elementSortAttrCodeRdd; - @Column(name="ELEMENT_SORT_ATTR_TYPE") - @ApiParam(value ="默认排序规则") + @Column(name = "ELEMENT_SORT_ATTR_TYPE") + @ApiParam(value = "默认排序规则") private Integer elementSortAttrType; -// @Lob - @Column(name="ELEMENT_CSS_STYLE") - @ApiParam(value ="元素样式") + // @Lob + @Column(name = "ELEMENT_CSS_STYLE") + @ApiParam(value = "元素样式") private String elementCssStyle; -// @Lob - @Column(name="ELEMENT_FORMATTER") - @ApiParam(value ="元素格式化") + // @Lob + @Column(name = "ELEMENT_FORMATTER") + @ApiParam(value = "元素格式化") private String elementFormatter; - @Column(name="ELEMENT_DESCRIPTION") - @ApiParam(value ="元素描述") + @Column(name = "ELEMENT_DESCRIPTION") + @ApiParam(value = "元素描述") private String elementDescription; + /** + * 自定义元素 + * 1: true,只能查询 + * 2: false,普通元素,支持所有操作 + */ + @Column(name = "CUSTOM_ELEMENT") + @ApiParam(value = "自定义元素") + private Integer customElement; + + /** + * BlockFormEnumUtil.FORM_SCRIPT_FUN_TYPE 取值,用逗号隔开 + */ + @Column(name = "SCRIPT_EXECUTE_POSITION") + @ApiParam(value = "执行脚本的位置,取值为枚举") + private String scriptExecutePosition; + + @Column(name = "SCRIPT_NO") + @ApiParam(value = "脚本No") + private String scriptNo; + @Transient @ApiParam(value = "数据对象") private BfDataObject dataObject;