diff --git a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/dynamic/DynamicEntity.java b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/dynamic/DynamicEntity.java index fc41d4c..c75399c 100644 --- a/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/dynamic/DynamicEntity.java +++ b/modules/i3plus-pojo-base/src/main/java/cn/estsh/i3plus/pojo/base/dynamic/DynamicEntity.java @@ -108,9 +108,10 @@ public class DynamicEntity extends BaseBean implements Serializable { */ public void setDynProperty(String propName,Object val){ String setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1); +// String setMethodName = "set" + propName.toUpperCase(); try { val = getValue(propName,val); - LOGGER.error("设置动态对象属性值 attr name:{} -> value:{} ",setMethodName,val); +// LOGGER.error("设置动态对象属性值 attr name:{} -> value:{} ",setMethodName,val); Method setMethod = this.getClass().getDeclaredMethod(setMethodName, new Class[]{val.getClass()}); setMethod.invoke(this, val); } catch (NoSuchMethodException e) { 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 0c6b49f..550edcf 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 @@ -1,6 +1,7 @@ package cn.estsh.i3plus.pojo.base.enumutil; import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.StringUtils; /** * @Description : 模块表单枚举类 @@ -1161,14 +1162,14 @@ public class BlockFormEnumUtil { */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum PROPERTY_TYPE { - STRING(10, "String", "字符串", "java.lang.String", String.class,PROPERTY_CONTROL_TYPE.TEXT), - CHAR(11, "Character", "单字符", "java.lang.Character", Character.class,PROPERTY_CONTROL_TYPE.TEXT), - INTEGER(20, "Integer", "短整型", "java.lang.Integer", Integer.class,PROPERTY_CONTROL_TYPE.NUMBER), - LONG(21, "Long", "长整型", "java.lang.Long", Long.class,PROPERTY_CONTROL_TYPE.NUMBER), - DOUBLE(30, "Double", "大浮点型", "java.lang.Double", Double.class,PROPERTY_CONTROL_TYPE.NUMBER), - FLOAT(31, "Float", "小浮点型", "java.lang.Float", Float.class,PROPERTY_CONTROL_TYPE.NUMBER), - BOOLEAN(40, "Boolean", "布尔值", "java.lang.Boolean", Boolean.class,PROPERTY_CONTROL_TYPE.RADIO), - BYTE(50, "Byte", "字节", "java.lang.Byte", Byte.class,PROPERTY_CONTROL_TYPE.TEXT); + STRING(10, "String", "字符串", "java.lang.String", String.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.LIKE), + CHAR(11, "Character", "单字符", "java.lang.Character", Character.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.EQUAL), + INTEGER(20, "Integer", "短整型", "java.lang.Integer", Integer.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL), + LONG(21, "Long", "长整型", "java.lang.Long", Long.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL), + DOUBLE(30, "Double", "大浮点型", "java.lang.Double", Double.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL), + FLOAT(31, "Float", "小浮点型", "java.lang.Float", Float.class,PROPERTY_CONTROL_TYPE.NUMBER,SQL_WHERE.EQUAL), + BOOLEAN(40, "Boolean", "布尔值", "java.lang.Boolean", Boolean.class,PROPERTY_CONTROL_TYPE.RADIO,SQL_WHERE.EQUAL), + BYTE(50, "Byte", "字节", "java.lang.Byte", Byte.class,PROPERTY_CONTROL_TYPE.TEXT,SQL_WHERE.EQUAL); // DATE(60, "Date", "日期", "java.lang.String", String.class,PROPERTY_CONTROL_TYPE.DATE_TIME); /** @@ -1196,13 +1197,19 @@ public class BlockFormEnumUtil { */ private PROPERTY_CONTROL_TYPE controlType; - private PROPERTY_TYPE(int value, String code, String description,String classPath,Class clzFullName,PROPERTY_CONTROL_TYPE controlType) { + /** + * 默认查询关系 + */ + private SQL_WHERE defaultWhere; + + private PROPERTY_TYPE(int value, String code, String description,String classPath,Class clzFullName,PROPERTY_CONTROL_TYPE controlType,SQL_WHERE defaultWhere) { this.value = value; this.code = code; this.description = description; this.classPath = classPath; this.clzFullName = clzFullName; this.controlType = controlType; + this.defaultWhere = defaultWhere; } public int getValue() { @@ -1229,6 +1236,10 @@ public class BlockFormEnumUtil { return controlType; } + public SQL_WHERE getDefaultWhere() { + return defaultWhere; + } + public static String valueOfCode(int val) { String tmp = null; for (int i = 0; i < values().length; i++) { @@ -1239,16 +1250,17 @@ public class BlockFormEnumUtil { return tmp; } - public static Class valueOfClzFullName(int val) { - Class tmp = null; + public static PROPERTY_TYPE valueOfClzFullName(int val) { + PROPERTY_TYPE tmp = null; for (int i = 0; i < values().length; i++) { if (values()[i].value == val) { - tmp = values()[i].clzFullName; + tmp = values()[i]; } } return tmp; } + public static PROPERTY_CONTROL_TYPE valueOfControlType(int val) { PROPERTY_CONTROL_TYPE tmp = null; for (int i = 0; i < values().length; i++) { @@ -2122,23 +2134,25 @@ public class BlockFormEnumUtil { */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) public enum DATA_SOURCE_TYPE { - SOURCE_MARIA_DB(100, "MariaDB", "MariaDB 10.1","com.mysql.jdbc.Driver",3306), - SOURCE_SQL_SERVER(200, "SQL Server", "SQL Server 2017","com.microsoft.sqlserver.jdbc.SQLServerDriver",1433), - SOURCE_ORACLE(300, "Oracle", "Oralce 12C","oracle.jdbc.driver.OracleDriver",1521), - SOURCE_POSTGRE_SQL(400, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432); + SOURCE_MARIA_DB(100, "MariaDB", "MariaDB 10.1","com.mysql.jdbc.Driver",3306,null), + SOURCE_SQL_SERVER(200, "SQL Server", "SQL Server 2017","com.microsoft.sqlserver.jdbc.SQLServerDriver",1433,"dbo"), + SOURCE_ORACLE(300, "Oracle", "Oralce 12C","oracle.jdbc.driver.OracleDriver",1521,null), + SOURCE_POSTGRE_SQL(400, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432,"public"); private int value; private String code; private String description; private String driverClassName; private int defaultPort; + private String defaultSchemaPattern; - private DATA_SOURCE_TYPE (int value, String code, String description,String driverClassName,int port) { + private DATA_SOURCE_TYPE (int value, String code, String description,String driverClassName,int port,String defaultSchemaPattern) { this.value = value; this.code = code; this.description = description; this.driverClassName = driverClassName; this.defaultPort = port; + this.defaultSchemaPattern = defaultSchemaPattern; } public int getValue() { @@ -2161,6 +2175,10 @@ public class BlockFormEnumUtil { return defaultPort; } + public String getDefaultSchemaPattern() { + return defaultSchemaPattern; + } + public static String valueOfCode(int val) { String tmp = null; for (int i = 0; i < values().length; i++) { @@ -2224,6 +2242,21 @@ public class BlockFormEnumUtil { return null; } + public static DATA_SOURCE_TYPE getDataSourceURL(String databaseProductName){ + if(StringUtils.isNotBlank(databaseProductName)){ + if(databaseProductName.indexOf(":mysql:") != -1){ + return SOURCE_MARIA_DB; + }else if(databaseProductName.indexOf(":oracle:") != -1){ + return SOURCE_ORACLE; + }else if(databaseProductName.indexOf(":postgresql:") != -1){ + return SOURCE_POSTGRE_SQL; + }else if(databaseProductName.indexOf(":sqlserver:") != -1){ + return SOURCE_SQL_SERVER; + } + } + return null; + } + private String getJDBCUrlMySQL(String database,String host,Integer port){ return "jdbc:mysql://"+host+":"+port+"/"+database+"?autoReconnect=true&useSSL=false&characterEncoding=utf-8"; } @@ -2327,7 +2360,7 @@ public class BlockFormEnumUtil { * 条件运算符 */ @JsonFormat(shape = JsonFormat.Shape.OBJECT) - public enum CONDITIONAL_OPERATOR { + public enum SQL_WHERE { EQUAL(1, "=", "等于"), NOT_EQUAL(2, "<>", "不等于"), MORE(3, ">", "大于"), @@ -2343,7 +2376,7 @@ public class BlockFormEnumUtil { private String code; private String description; - private CONDITIONAL_OPERATOR(int value, String code, String description) { + private SQL_WHERE(int value, String code, String description) { this.value = value; this.code = code; this.description = description; @@ -2391,7 +2424,7 @@ public class BlockFormEnumUtil { return tmp; } - public static CONDITIONAL_OPERATOR valueOf(int val) { + public static SQL_WHERE valueOf(int val) { String tmp = null; for (int i = 0; i < values().length; i++) { if (values()[i].value == val) { diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObject.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObject.java index 3efddd4..c631967 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObject.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfDataObject.java @@ -78,6 +78,16 @@ public class BfDataObject extends BaseBean { private List propertyList; @Transient + @ApiParam(value = "数据对象主键属性") + @AnnoOutputColumn(hidden = true) + private List primaryPropertyList; + + @Transient + @ApiParam(value = "数据对象主键属性") + @AnnoOutputColumn(hidden = true) + private List primaryNameList; + + @Transient @ApiParam(value = "元素对象虚拟属性") @AnnoOutputColumn(hidden = true) List virtualList; 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 4cc4f2b..45b9c64 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 @@ -58,6 +58,10 @@ public class BfDataObjectProperty extends BaseBean { @ApiParam(value ="默认查询条件") private Integer objectColumnDefaultWhere; + @Column(name="IS_PRIMARY_KEY") + @ApiParam(value ="是否主键") + private Integer isPrimaryKey; + // 字段长度 @ApiParam(value = "字段长度") @Column(name="OBJECT_COLUMN_PRECISION") diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/CloudFormModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/CloudFormModel.java index 3ce913c..57198b7 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/CloudFormModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/CloudFormModel.java @@ -37,19 +37,17 @@ public class CloudFormModel { private List> insertList; // 修改条件 - private List updateConditionList; +// private List updateConditionList; + // 修改数据 + private List> updateList; // 查询数据 private List selectList; - // 查询单条数据 - private Long select; - // 删除数据 - private List deleteConditionList; + private List> deleteList; - // 删除数据ID - private Long delete; + private Map delete; public String orderByParam; diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/SqlColumnModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/SqlColumnModel.java index 7c628f7..0cd99b7 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/SqlColumnModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/form/SqlColumnModel.java @@ -52,6 +52,9 @@ public class SqlColumnModel { // 字段Java 类型 @ApiParam(value = "枚举:BlockFormEnumUtil.PROPERTY_TYPE") private Integer columnClassType; + // 属性是否主键 + @ApiParam(value = "枚举: CommonEnumUtil.TRUE_OR_FALSE") + private Integer columnPrimaryKey; @ApiParam(value = "属性值") private Object value;