65 lines
1.1 KiB
Java
65 lines
1.1 KiB
Java
package com.pictc.datalog;
|
|
|
|
|
|
import com.xjrsoft.module.datalog.vo.OperationType;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import lombok.experimental.Accessors;
|
|
|
|
/**
|
|
* @author 张福财
|
|
* @date 2025年10月30日 上午9:27:17
|
|
* @Description: 数据操作上下文
|
|
*/
|
|
@Getter
|
|
@Setter
|
|
@Accessors(chain = true)
|
|
public class DataOperationContent<T> {
|
|
|
|
private LogTableInfo tabInfo;
|
|
|
|
private OperationType type;
|
|
|
|
private T obj;
|
|
|
|
private T oldObj;
|
|
|
|
private Throwable error;
|
|
|
|
private DataOperationContent(LogTableInfo tabInfo,OperationType type, T obj, T oldObj) {
|
|
super();
|
|
this.tabInfo = tabInfo;
|
|
this.type = type;
|
|
this.obj = obj;
|
|
this.oldObj = oldObj;
|
|
}
|
|
|
|
public static <T>DataOperationContent<T> of(LogTableInfo tabInfo,OperationType type, T obj, T oldObj) {
|
|
return new DataOperationContent<T>(tabInfo, type, obj,oldObj);
|
|
}
|
|
|
|
|
|
public boolean isError() {
|
|
return error!=null;
|
|
}
|
|
|
|
|
|
public boolean success() {
|
|
return error==null;
|
|
}
|
|
|
|
public String getTableName() {
|
|
return tabInfo.getTableName();
|
|
}
|
|
|
|
|
|
public long getIdValue() {
|
|
return tabInfo.getIdValue(obj);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|