动态查询Cloud 服务基础功能已完成 1.0

yun-zuoyi
wei.peng 6 years ago
parent f349690cbb
commit 13af329513

@ -108,9 +108,10 @@ public class DynamicEntity extends BaseBean implements Serializable {
*/ */
public void setDynProperty(String propName,Object val){ public void setDynProperty(String propName,Object val){
String setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1); String setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1);
// String setMethodName = "set" + propName.toUpperCase();
try { try {
val = getValue(propName,val); 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()}); Method setMethod = this.getClass().getDeclaredMethod(setMethodName, new Class[]{val.getClass()});
setMethod.invoke(this, val); setMethod.invoke(this, val);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {

@ -1,6 +1,7 @@
package cn.estsh.i3plus.pojo.base.enumutil; package cn.estsh.i3plus.pojo.base.enumutil;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.StringUtils;
/** /**
* @Description : * @Description :
@ -1161,14 +1162,14 @@ public class BlockFormEnumUtil {
*/ */
@JsonFormat(shape = JsonFormat.Shape.OBJECT) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PROPERTY_TYPE { public enum PROPERTY_TYPE {
STRING(10, "String", "字符串", "java.lang.String", String.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), 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), 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), 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), 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), 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), 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); 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); // 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_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.value = value;
this.code = code; this.code = code;
this.description = description; this.description = description;
this.classPath = classPath; this.classPath = classPath;
this.clzFullName = clzFullName; this.clzFullName = clzFullName;
this.controlType = controlType; this.controlType = controlType;
this.defaultWhere = defaultWhere;
} }
public int getValue() { public int getValue() {
@ -1229,6 +1236,10 @@ public class BlockFormEnumUtil {
return controlType; return controlType;
} }
public SQL_WHERE getDefaultWhere() {
return defaultWhere;
}
public static String valueOfCode(int val) { public static String valueOfCode(int val) {
String tmp = null; String tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
@ -1239,16 +1250,17 @@ public class BlockFormEnumUtil {
return tmp; return tmp;
} }
public static Class valueOfClzFullName(int val) { public static PROPERTY_TYPE valueOfClzFullName(int val) {
Class tmp = null; PROPERTY_TYPE tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) { if (values()[i].value == val) {
tmp = values()[i].clzFullName; tmp = values()[i];
} }
} }
return tmp; return tmp;
} }
public static PROPERTY_CONTROL_TYPE valueOfControlType(int val) { public static PROPERTY_CONTROL_TYPE valueOfControlType(int val) {
PROPERTY_CONTROL_TYPE tmp = null; PROPERTY_CONTROL_TYPE tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
@ -2122,23 +2134,25 @@ public class BlockFormEnumUtil {
*/ */
@JsonFormat(shape = JsonFormat.Shape.OBJECT) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum DATA_SOURCE_TYPE { public enum DATA_SOURCE_TYPE {
SOURCE_MARIA_DB(100, "MariaDB", "MariaDB 10.1","com.mysql.jdbc.Driver",3306), 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), 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), SOURCE_ORACLE(300, "Oracle", "Oralce 12C","oracle.jdbc.driver.OracleDriver",1521,null),
SOURCE_POSTGRE_SQL(400, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432); SOURCE_POSTGRE_SQL(400, "PostgreSql", "PostgreSql 10.5","org.postgresql.Driver",5432,"public");
private int value; private int value;
private String code; private String code;
private String description; private String description;
private String driverClassName; private String driverClassName;
private int defaultPort; 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.value = value;
this.code = code; this.code = code;
this.description = description; this.description = description;
this.driverClassName = driverClassName; this.driverClassName = driverClassName;
this.defaultPort = port; this.defaultPort = port;
this.defaultSchemaPattern = defaultSchemaPattern;
} }
public int getValue() { public int getValue() {
@ -2161,6 +2175,10 @@ public class BlockFormEnumUtil {
return defaultPort; return defaultPort;
} }
public String getDefaultSchemaPattern() {
return defaultSchemaPattern;
}
public static String valueOfCode(int val) { public static String valueOfCode(int val) {
String tmp = null; String tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
@ -2224,6 +2242,21 @@ public class BlockFormEnumUtil {
return null; 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){ private String getJDBCUrlMySQL(String database,String host,Integer port){
return "jdbc:mysql://"+host+":"+port+"/"+database+"?autoReconnect=true&useSSL=false&characterEncoding=utf-8"; 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) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum CONDITIONAL_OPERATOR { public enum SQL_WHERE {
EQUAL(1, "=", "等于"), EQUAL(1, "=", "等于"),
NOT_EQUAL(2, "<>", "不等于"), NOT_EQUAL(2, "<>", "不等于"),
MORE(3, ">", "大于"), MORE(3, ">", "大于"),
@ -2343,7 +2376,7 @@ public class BlockFormEnumUtil {
private String code; private String code;
private String description; 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.value = value;
this.code = code; this.code = code;
this.description = description; this.description = description;
@ -2391,7 +2424,7 @@ public class BlockFormEnumUtil {
return tmp; return tmp;
} }
public static CONDITIONAL_OPERATOR valueOf(int val) { public static SQL_WHERE valueOf(int val) {
String tmp = null; String tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) { if (values()[i].value == val) {

@ -78,6 +78,16 @@ public class BfDataObject extends BaseBean {
private List<BfDataObjectProperty> propertyList; private List<BfDataObjectProperty> propertyList;
@Transient @Transient
@ApiParam(value = "数据对象主键属性")
@AnnoOutputColumn(hidden = true)
private List<BfDataObjectProperty> primaryPropertyList;
@Transient
@ApiParam(value = "数据对象主键属性")
@AnnoOutputColumn(hidden = true)
private List<String> primaryNameList;
@Transient
@ApiParam(value = "元素对象虚拟属性") @ApiParam(value = "元素对象虚拟属性")
@AnnoOutputColumn(hidden = true) @AnnoOutputColumn(hidden = true)
List<BfElementPropertyVirtual> virtualList; List<BfElementPropertyVirtual> virtualList;

@ -58,6 +58,10 @@ public class BfDataObjectProperty extends BaseBean {
@ApiParam(value ="默认查询条件") @ApiParam(value ="默认查询条件")
private Integer objectColumnDefaultWhere; private Integer objectColumnDefaultWhere;
@Column(name="IS_PRIMARY_KEY")
@ApiParam(value ="是否主键")
private Integer isPrimaryKey;
// 字段长度 // 字段长度
@ApiParam(value = "字段长度") @ApiParam(value = "字段长度")
@Column(name="OBJECT_COLUMN_PRECISION") @Column(name="OBJECT_COLUMN_PRECISION")

@ -37,19 +37,17 @@ public class CloudFormModel {
private List<Map<String,Object>> insertList; private List<Map<String,Object>> insertList;
// 修改条件 // 修改条件
private List<BfDataObjectProperty> updateConditionList; // private List<BfDataObjectProperty> updateConditionList;
// 修改数据
private List<Map<String,Object>> updateList;
// 查询数据 // 查询数据
private List<BfDataObjectProperty> selectList; private List<BfDataObjectProperty> selectList;
// 查询单条数据
private Long select;
// 删除数据 // 删除数据
private List<BfDataObjectProperty> deleteConditionList; private List<Map<String,Object>> deleteList;
// 删除数据ID private Map<String,Object> delete;
private Long delete;
public String orderByParam; public String orderByParam;

@ -52,6 +52,9 @@ public class SqlColumnModel {
// 字段Java 类型 // 字段Java 类型
@ApiParam(value = "枚举:BlockFormEnumUtil.PROPERTY_TYPE") @ApiParam(value = "枚举:BlockFormEnumUtil.PROPERTY_TYPE")
private Integer columnClassType; private Integer columnClassType;
// 属性是否主键
@ApiParam(value = "枚举: CommonEnumUtil.TRUE_OR_FALSE")
private Integer columnPrimaryKey;
@ApiParam(value = "属性值") @ApiParam(value = "属性值")
private Object value; private Object value;

Loading…
Cancel
Save