自定义表单 数据操作接口 DAO 层完成

yun-zuoyi
wei.peng 6 years ago
parent 74e89fa54e
commit 1adc8e4baf

@ -85,13 +85,6 @@ public class DynamicBean {
if(null != superclass) { if(null != superclass) {
generator.setSuperclass(superclass); generator.setSuperclass(superclass);
} }
/*Set keySet = propertyMap.keySet();
for (Iterator i = keySet.iterator(); i.hasNext(); ) {
String key = (String) i.next();
generator.addProperty(key, (Class) propertyMap.get(key));
}*/
BeanGenerator.addProperties(generator, propertyMap); BeanGenerator.addProperties(generator, propertyMap);
return generator.create(); return generator.create();
} }

@ -64,69 +64,6 @@ public class DynamicEntity extends BaseBean implements Serializable {
} }
/** /**
*
*
* @return
*//*
public DynamicEntity get(String method, String uri, Object[] args, Object result, String operator, String appName) {
setMethod(method);
setUri(uri);
setArgs(args);
setResult(result);
setOperator(operator);
setAppName(appName);
return this;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Object[] getArgs() {
return args;
}
public void setArgs(Object[] args) {
this.args = args;
}
public Object getResult() {
return result;
}
public void setResult(Object result) {
this.result = result;
}
public String getOperator() {
return operator;
}
public void setOperator(String operator) {
this.operator = operator;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}*/
/**
* 便 * 便
* @throws InvocationTargetException * @throws InvocationTargetException
* @throws IllegalAccessException * @throws IllegalAccessException
@ -134,18 +71,15 @@ public class DynamicEntity extends BaseBean implements Serializable {
*/ */
public void initDynamic() { public void initDynamic() {
Field[] fields = this.getClass().getDeclaredFields(); Field[] fields = this.getClass().getDeclaredFields();
Method setMethod = null; Method setMethod = null;
String setMethodName,propName; String setMethodName,propName;
Object fieldVal = null; Object fieldVal = null;
for(Field f : fields) { for(Field f : fields) {
propName = f.getName().replace("$cglib_prop_", ""); propName = f.getName().replace("$cglib_prop_", "");
if(!"LOGGER".equals(propName) && !"propertyList".equals(propName)) { if(!"LOGGER".equals(propName) && !"propertyList".equals(propName) && !"dynProperty".equals(propName)) {
this.getPropertyList().add(propName); //添加到属性list中 this.getPropertyList().add(propName); //添加到属性list中
setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1); setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1);
f.setAccessible(true); f.setAccessible(true);
try { try {
fieldVal = f.get(this); fieldVal = f.get(this);
@ -163,9 +97,9 @@ public class DynamicEntity extends BaseBean implements Serializable {
} else if (f.getType() == Double.class) { } else if (f.getType() == Double.class) {
fieldVal = 0.0d; fieldVal = 0.0d;
} else if (f.getType() == String.class) { } else if (f.getType() == String.class) {
fieldVal = "1"; fieldVal = "";
}else if (f.getType() == Character.class) { }else if (f.getType() == Character.class) {
fieldVal = "1"; fieldVal = "";
}else if (f.getType() == Boolean.class) { }else if (f.getType() == Boolean.class) {
fieldVal = true; fieldVal = true;
}else if (f.getType() == Byte.class) { }else if (f.getType() == Byte.class) {
@ -173,7 +107,7 @@ public class DynamicEntity extends BaseBean implements Serializable {
}else if (f.getType() == Date.class) { }else if (f.getType() == Date.class) {
fieldVal = new Date(); fieldVal = new Date();
}else { }else {
fieldVal = "1"; fieldVal = "";
} }
} }
@ -261,7 +195,6 @@ public class DynamicEntity extends BaseBean implements Serializable {
* @throws NoSuchMethodException * @throws NoSuchMethodException
*/ */
public void setDynProperty(String propName,Object val){ public void setDynProperty(String propName,Object val){
if(StringUtils.isNotBlank(propName) && val != null){
//初始化set方法 //初始化set方法
String setMethodName = "set" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, propName); String setMethodName = "set" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, propName);
//获取方法 //获取方法
@ -277,7 +210,6 @@ public class DynamicEntity extends BaseBean implements Serializable {
LOGGER.error("方法返回出错:{}",setMethodName,e); LOGGER.error("方法返回出错:{}",setMethodName,e);
} }
} }
}
/** /**
* *

@ -967,20 +967,22 @@ public class BlockFormEnumUtil {
*/ */
@JsonFormat(shape = JsonFormat.Shape.OBJECT) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PROPERTY_VIRTUAL_OPERATE_TYPE { public enum PROPERTY_VIRTUAL_OPERATE_TYPE {
STRING_SPLICE(10, "SPLICE", "字符串拼接"), STRING_SPLICE(10, "SPLICE", "字符串拼接",String.class),
NUM_ADD(20, "ADD", "加法计算"), NUM_ADD(20, "ADD", "加法计算",Double.class),
NUM_LESS(30, "MIN", "减法计算"), NUM_LESS(30, "MIN", "减法计算",Double.class),
NUM_MAKE(40, "MUL", "乘法计算"), NUM_MAKE(40, "MUL", "乘法计算",Double.class),
NUM_DIVISION(50, "DIVISION", "除法计算"); NUM_DIVISION(50, "DIVISION", "除法计算",Double.class);
private int value; private int value;
private String code; private String code;
private String description; private String description;
private Class clzFullName;
private PROPERTY_VIRTUAL_OPERATE_TYPE(int value, String code, String description) { private PROPERTY_VIRTUAL_OPERATE_TYPE(int value, String code, String description,Class clzFullName) {
this.value = value; this.value = value;
this.code = code; this.code = code;
this.description = description; this.description = description;
this.clzFullName = clzFullName;
} }
public int getValue() { public int getValue() {
@ -995,6 +997,14 @@ public class BlockFormEnumUtil {
return description; return description;
} }
public Class getClzFullName() {
return clzFullName;
}
public void setClzFullName(Class clzFullName) {
this.clzFullName = clzFullName;
}
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++) {
@ -1044,6 +1054,8 @@ public class BlockFormEnumUtil {
} }
return tmp; return tmp;
} }
} }
/** /**
@ -1063,8 +1075,8 @@ public class BlockFormEnumUtil {
DOUBLE(30, "Double", "大浮点型", "java.lang.Double", Double.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), FLOAT(31, "Float", "小浮点型", "java.lang.Float", Float.class,PROPERTY_CONTROL_TYPE.NUMBER),
BOOLEAN(40, "Boolean", "布尔值", "java.lang.Boolean", Boolean.class,PROPERTY_CONTROL_TYPE.RADIO), BOOLEAN(40, "Boolean", "布尔值", "java.lang.Boolean", Boolean.class,PROPERTY_CONTROL_TYPE.RADIO),
BYTE(50, "Byte", "字节", "java.lang.Byte", Byte.class,PROPERTY_CONTROL_TYPE.TEXT), BYTE(50, "Byte", "字节", "java.lang.Byte", Byte.class,PROPERTY_CONTROL_TYPE.TEXT);
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);
/** /**
* *

@ -56,9 +56,13 @@ public class BfElementProperty extends BaseBean {
private String propertyTypeNameRdd; private String propertyTypeNameRdd;
@Column(name="PROPERTY_NAME") @Column(name="PROPERTY_NAME")
@ApiParam(value ="元素提示") @ApiParam(value ="元素名称")
private String propertyName; private String propertyName;
@Column(name="PROPERTY_CODE_RDD")
@ApiParam(value ="类属性名称")
private String propertyCodeRdd;
@Column(name="PROPERTY_DEFAULT_VALUE") @Column(name="PROPERTY_DEFAULT_VALUE")
@ApiParam(value ="元素默认值") @ApiParam(value ="元素默认值")
private String propertyDefaultValue; private String propertyDefaultValue;
@ -77,7 +81,11 @@ public class BfElementProperty extends BaseBean {
@Column(name = "PROPERTY_INPUT_TXT") @Column(name = "PROPERTY_INPUT_TXT")
@ApiParam(value = "输入提示") @ApiParam(value = "输入提示")
private Integer propertyInputTxt; private String propertyInputTxt;
@Column(name="PROPERTY_LABEL_TXT")
@ApiParam(value ="元素提示")
private String propertyLabelTxt;
@Column(name = "PROPERTY_LENGTH") @Column(name = "PROPERTY_LENGTH")
@ApiParam(value = "属性长度") @ApiParam(value = "属性长度")

@ -38,6 +38,14 @@ public class BfElementPropertyVirtual extends BaseBean {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long elementId; private Long elementId;
@Column(name="PROPERTY_NAME")
@ApiParam(value ="元素名称")
private String propertyName;
@Column(name="PROPERTY_TYPE")
@ApiParam(value ="属性类型")
private Integer propertyType;
@Column(name = "PROPERTY_VIRTUAL_OPERATE_TYPE") @Column(name = "PROPERTY_VIRTUAL_OPERATE_TYPE")
@ApiParam(value = "虚拟元素类型") @ApiParam(value = "虚拟元素类型")
private Integer propertyVirtualType; private Integer propertyVirtualType;

Loading…
Cancel
Save