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

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

@ -85,13 +85,6 @@ public class DynamicBean {
if(null != 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);
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 IllegalAccessException
@ -134,18 +71,15 @@ public class DynamicEntity extends BaseBean implements Serializable {
*/
public void initDynamic() {
Field[] fields = this.getClass().getDeclaredFields();
Method setMethod = null;
String setMethodName,propName;
Object fieldVal = null;
for(Field f : fields) {
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中
setMethodName = "set" + propName.substring(0,1).toUpperCase() + propName.substring(1);
f.setAccessible(true);
try {
fieldVal = f.get(this);
@ -163,9 +97,9 @@ public class DynamicEntity extends BaseBean implements Serializable {
} else if (f.getType() == Double.class) {
fieldVal = 0.0d;
} else if (f.getType() == String.class) {
fieldVal = "1";
fieldVal = "";
}else if (f.getType() == Character.class) {
fieldVal = "1";
fieldVal = "";
}else if (f.getType() == Boolean.class) {
fieldVal = true;
}else if (f.getType() == Byte.class) {
@ -173,7 +107,7 @@ public class DynamicEntity extends BaseBean implements Serializable {
}else if (f.getType() == Date.class) {
fieldVal = new Date();
}else {
fieldVal = "1";
fieldVal = "";
}
}
@ -261,21 +195,19 @@ public class DynamicEntity extends BaseBean implements Serializable {
* @throws NoSuchMethodException
*/
public void setDynProperty(String propName,Object val){
if(StringUtils.isNotBlank(propName) && val != null){
//初始化set方法
String setMethodName = "set" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, propName);
//获取方法
Method setMethod = null;
try {
setMethod = this.getClass().getDeclaredMethod(setMethodName, new Class[]{val.getClass()});
setMethod.invoke(this, val);
} catch (NoSuchMethodException e) {
LOGGER.error("没有方法:{}",setMethodName,e);
} catch (IllegalAccessException e) {
LOGGER.error("入参出错:{}:{}",val,val.getClass(),e);
} catch (InvocationTargetException e) {
LOGGER.error("方法返回出错:{}",setMethodName,e);
}
//初始化set方法
String setMethodName = "set" + CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, propName);
//获取方法
Method setMethod = null;
try {
setMethod = this.getClass().getDeclaredMethod(setMethodName, new Class[]{val.getClass()});
setMethod.invoke(this, val);
} catch (NoSuchMethodException e) {
LOGGER.error("没有方法:{}",setMethodName,e);
} catch (IllegalAccessException e) {
LOGGER.error("入参出错:{}:{}",val,val.getClass(),e);
} catch (InvocationTargetException e) {
LOGGER.error("方法返回出错:{}",setMethodName,e);
}
}

@ -967,20 +967,22 @@ public class BlockFormEnumUtil {
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum PROPERTY_VIRTUAL_OPERATE_TYPE {
STRING_SPLICE(10, "SPLICE", "字符串拼接"),
NUM_ADD(20, "ADD", "加法计算"),
NUM_LESS(30, "MIN", "减法计算"),
NUM_MAKE(40, "MUL", "乘法计算"),
NUM_DIVISION(50, "DIVISION", "除法计算");
STRING_SPLICE(10, "SPLICE", "字符串拼接",String.class),
NUM_ADD(20, "ADD", "加法计算",Double.class),
NUM_LESS(30, "MIN", "减法计算",Double.class),
NUM_MAKE(40, "MUL", "乘法计算",Double.class),
NUM_DIVISION(50, "DIVISION", "除法计算",Double.class);
private int value;
private String code;
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.code = code;
this.description = description;
this.clzFullName = clzFullName;
}
public int getValue() {
@ -995,6 +997,14 @@ public class BlockFormEnumUtil {
return description;
}
public Class getClzFullName() {
return clzFullName;
}
public void setClzFullName(Class clzFullName) {
this.clzFullName = clzFullName;
}
public static String valueOfCode(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
@ -1044,6 +1054,8 @@ public class BlockFormEnumUtil {
}
return tmp;
}
}
/**
@ -1063,8 +1075,8 @@ public class BlockFormEnumUtil {
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),
DATE(60, "Date", "日期", "java.lang.String", String.class,PROPERTY_CONTROL_TYPE.DATE_TIME);
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);
/**
*

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

@ -38,6 +38,14 @@ public class BfElementPropertyVirtual extends BaseBean {
@JsonSerialize(using = ToStringSerializer.class)
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")
@ApiParam(value = "虚拟元素类型")
private Integer propertyVirtualType;

Loading…
Cancel
Save