元素增删改查 DAO层接口完成

yun-zuoyi
wei.peng 6 years ago
parent 11fd6979ed
commit 5b0d4f8d37

@ -1,8 +1,11 @@
package cn.estsh.i3plus.pojo.base.dynamic;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.google.common.base.CaseFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -239,8 +242,18 @@ public class DynamicEntity extends BaseBean implements Serializable {
return result;
}
public void setDynProperty(Map<String,Object> params) {
if (params != null && params.size() > 0){
params.forEach((k,v)->{{
setDynProperty(k,v);
}});
}
}
/**
*
* //TODO wei.peng 设置为空时会无效
* @param propName
* @param val
* @throws InvocationTargetException
@ -248,19 +261,21 @@ public class DynamicEntity extends BaseBean implements Serializable {
* @throws NoSuchMethodException
*/
public void setDynProperty(String propName,Object val){
//初始化set方法
String setMethodName = "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
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);
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);
}
}
}

@ -334,6 +334,86 @@ public class BlockFormEnumUtil {
return tmp;
}
}
/**
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ELEMENT_SHOW_STATUS {
ON(1, "ON", "开启"),
OFF(2, "OFF", "关闭");
private int value;
private String code;
private String description;
private ELEMENT_SHOW_STATUS(int value, String code, String description) {
this.value = value;
this.code = code;
this.description = description;
}
public int getValue() {
return value;
}
public String getCode() {
return code;
}
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].code;
}
}
return tmp;
}
public static int codeOfValue(String code) {
int tmp = 1;
for (int i = 0; i < values().length; i++) {
if (values()[i].code.equals(code)) {
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 ELEMENT_SHOW_STATUS 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].code.equals(code)) {
tmp = values()[i].description;
}
}
return tmp;
}
}
/**
*

@ -31,6 +31,9 @@ public class ElementModel{
@ApiParam(value = "元素基础虚拟属性信息")
private List<BfElementPropertyVirtual> virtualList;
@ApiParam(value = "动态对象Class")
private Class dynClass;
@ApiParam(value = "数据对象信息")
private BfDataObject dataObject;

@ -52,6 +52,10 @@ public class SqlColumnModel {
@ApiParam(value = "枚举:BlockFormEnumUtil.PROPERTY_TYPE")
private Integer columnClassType;
@ApiParam(value = "属性值")
private Object value;
@ApiParam(value = "属性默认值")
private Object defaultValue;
}

@ -0,0 +1,37 @@
package cn.estsh.i3plus.pojo.model.form;
import cn.estsh.i3plus.pojo.base.dynamic.DynamicEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import java.util.List;
/**
* @Description :
* @Reference :
* @Author : Adair Peng
* @CreateDate : 2019-04-03 17:30
* @Modify:
**/
@Data
public class SqlScriptModel {
@ApiParam(value = "对象元素ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long elementId;
@ApiParam(value = "元素内容")
private String elementContent ;
@ApiParam(value = "动态对象Class")
private Class dynClass;
@ApiParam(value = "动态对象")
private DynamicEntity dynObj;
@ApiParam(value = "封装数据", example = "-1")
private List<SqlColumnModel> params;
}

@ -10,7 +10,7 @@ import lombok.Data;
import java.util.List;
/**
* @Description ://TODO 提交注意修改 临时使用 带改动
* @Description ://
* @Reference :
* @Author : Adair Peng
* @CreateDate : 2019-01-25 18:19

Loading…
Cancel
Save