初始化elog框架
commit
f95310163a
@ -0,0 +1,15 @@
|
||||
package com.api.salary.elog;
|
||||
|
||||
import javax.ws.rs.Path;
|
||||
|
||||
/**
|
||||
* 日志列表公共接口暴漏
|
||||
* <p>Copyright: Copyright (c) 2023</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Path("/bs/hrmsalary/elog")
|
||||
public class LoggerTableController extends com.engine.salary.elog.web.LoggerTableController{
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD})
|
||||
public @interface Elog {
|
||||
|
||||
String module();
|
||||
|
||||
String function();
|
||||
|
||||
String operateType();
|
||||
|
||||
String operateTypeName();
|
||||
|
||||
String sql() default "";
|
||||
|
||||
boolean isLocal() default true;
|
||||
|
||||
String infoMethod() default "";
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface ElogDetailField {
|
||||
|
||||
String fieldType() default "varchar";
|
||||
String length() default "50";
|
||||
String fieldName();
|
||||
String desc() default "自定义字段";
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface ElogDetailTable {
|
||||
|
||||
String module();
|
||||
|
||||
String function() default "common";
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import com.engine.salary.elog.entity.dto.DataTypeEnum;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
public @interface ElogField {
|
||||
|
||||
DataTypeEnum dataType() default DataTypeEnum.VARCHAR;
|
||||
|
||||
int length() default 50;
|
||||
|
||||
String comment() default "自定义字段";
|
||||
|
||||
String defaultValue() default "";
|
||||
|
||||
boolean isNull() default true;
|
||||
|
||||
boolean isKey() default false;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.PARAMETER})
|
||||
public @interface ElogPrimaryKey {
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
|
||||
public @interface ElogTable {
|
||||
|
||||
String module();
|
||||
|
||||
String function() default "common";
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD, ElementType.TYPE})
|
||||
@Inherited
|
||||
public @interface ElogTransform {
|
||||
|
||||
String tablename() default "";
|
||||
|
||||
String name();
|
||||
|
||||
int labelId() default -1;
|
||||
|
||||
String type() default "";
|
||||
|
||||
String valuesKVPairs() default "";
|
||||
|
||||
boolean ignore() default false;
|
||||
|
||||
boolean analyticSubclass() default false;
|
||||
|
||||
boolean analyticList() default false;
|
||||
|
||||
Class<?> analyticListClass() default void.class;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface HandleElog {
|
||||
|
||||
String modulename() default "";
|
||||
|
||||
String functionname() default "";
|
||||
|
||||
String service() default "";
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @ClassName: LoggerTarget
|
||||
* @Description 日志构造器-自定义注解
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/10 14:18
|
||||
*/
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface LoggerTarget {
|
||||
// @AliasFor("module")
|
||||
String value() default "";
|
||||
|
||||
// @AliasFor("value")
|
||||
String module() default "";
|
||||
|
||||
String function() default "common";
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.engine.salary.elog.annotation;
|
||||
|
||||
public class OperateType {
|
||||
public static final String view = "view";
|
||||
public static final String viewSpan = "查看";
|
||||
|
||||
public static final String add = "add";
|
||||
public static final String addSpan = "新增";
|
||||
|
||||
public static final String update = "update";
|
||||
public static final String updateSpan = "更新";
|
||||
|
||||
public static final String delete = "delete";
|
||||
public static final String deleteSpan = "删除";
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.engine.salary.elog.async;
|
||||
|
||||
import com.engine.salary.elog.config.ELogTableChecker;
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.elog.service.impl.LocalElogService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* @ClassName: LoggerMessageListener
|
||||
* @Description 本地日志存储消息队列监听类
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/10 14:18
|
||||
*/
|
||||
public class LoggerMessageListener {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
LocalElogService localElogService = new LocalElogService();
|
||||
|
||||
public <T> String receiveold(LoggerContext messageBean) {
|
||||
|
||||
new ELogTableChecker().check(messageBean);
|
||||
localElogService.insertLocalElog(messageBean);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.engine.salary.elog.config;
|
||||
|
||||
import com.engine.salary.mapper.elog.ElogTableCheckerMapper;
|
||||
import com.engine.salary.elog.util.db.MapperProxyFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ELogCache {
|
||||
|
||||
private Map<String, Long> tableCache = new HashMap<>();
|
||||
|
||||
private ElogTableCheckerMapper getTableCheckerMapper() {
|
||||
return MapperProxyFactory.getProxy(ElogTableCheckerMapper.class);
|
||||
}
|
||||
|
||||
public Long getVersion(String mainTable) {
|
||||
Long version = tableCache.get(mainTable);
|
||||
if (version == null) {
|
||||
version = getTableCheckerMapper().getVersion(mainTable);
|
||||
tableCache.put(mainTable, version);
|
||||
}
|
||||
return version;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package com.engine.salary.elog.config;
|
||||
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.mapper.elog.ElogTableCheckerMapper;
|
||||
import com.engine.salary.elog.util.db.IdGenerator;
|
||||
import com.engine.salary.elog.util.db.MapperProxyFactory;
|
||||
|
||||
|
||||
public class ELogTableChecker {
|
||||
private static final long version = 0;
|
||||
private ELogCache eLogCache = new ELogCache();
|
||||
|
||||
private ElogTableCheckerMapper getTableCheckerMapper() {
|
||||
return MapperProxyFactory.getProxy(ElogTableCheckerMapper.class);
|
||||
}
|
||||
|
||||
public <T> void check(LoggerContext<T> loggerContext) {
|
||||
String module = loggerContext.getModuleName();
|
||||
String function = loggerContext.getFunctionName();
|
||||
String mainTable = String.format("%s_%slogs", module, function);
|
||||
Long v = eLogCache.getVersion(mainTable);
|
||||
boolean noTable = v == null;
|
||||
if (noTable) {
|
||||
this.initTable(mainTable);
|
||||
v = version;
|
||||
} else {
|
||||
this.checkVersion(mainTable, v);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void checkVersion(String mainTable, Long v) {
|
||||
if (v == version) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initTable(String mainTable) {
|
||||
getTableCheckerMapper().recordVersion(IdGenerator.generate(), mainTable, version);
|
||||
getTableCheckerMapper().createMainTable(mainTable);
|
||||
getTableCheckerMapper().createDetailTable(mainTable + "_detail");
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: CancelContext
|
||||
* @Description 撤销实体类
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/10 14:18
|
||||
*/
|
||||
@ApiModel("撤销实体类")
|
||||
public class CancelContext<T> {
|
||||
|
||||
@ApiModelProperty("撤销参数")
|
||||
private T cancleParams;
|
||||
|
||||
public T getCancleParams() {
|
||||
return cancleParams;
|
||||
}
|
||||
|
||||
public void setCancleParams(T cancleParams) {
|
||||
this.cancleParams = cancleParams;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
public enum DataTypeEnum {
|
||||
VARCHAR,
|
||||
BIGINT,
|
||||
INT,
|
||||
DATETIME,
|
||||
TEXT,
|
||||
LONGTEXT,
|
||||
DOUBLE,
|
||||
DECIMAL,
|
||||
TINYINT,
|
||||
FLOAT;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Date: 2022/5/2 21:51
|
||||
* @Author: deli.xu
|
||||
* @Description: 日志中心bean
|
||||
**/
|
||||
public class ElogBean implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = 5357552376749564256L;
|
||||
private String module;
|
||||
private String function;
|
||||
private String current;
|
||||
private String pageSize;
|
||||
private String dataset;
|
||||
private String searchMap;
|
||||
private List<ShowColumsDto> showColumns = new ArrayList<>();
|
||||
private List<FilterConditionDto> filterConditionDtos = new ArrayList<>();
|
||||
private String downloadSize;
|
||||
private String transMethod;
|
||||
private Map authParamsJson;
|
||||
|
||||
public String getModule() {
|
||||
return module;
|
||||
}
|
||||
|
||||
public void setModule(String module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public String getFunction() {
|
||||
return function;
|
||||
}
|
||||
|
||||
public void setFunction(String function) {
|
||||
this.function = function;
|
||||
}
|
||||
|
||||
public String getCurrent() {
|
||||
return current;
|
||||
}
|
||||
|
||||
public void setCurrent(String current) {
|
||||
this.current = current;
|
||||
}
|
||||
|
||||
public String getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(String pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
public String getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
public void setDataset(String dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
public String getSearchMap() {
|
||||
return searchMap;
|
||||
}
|
||||
|
||||
public void setSearchMap(String searchMap) {
|
||||
this.searchMap = searchMap;
|
||||
}
|
||||
|
||||
public List<ShowColumsDto> getShowColumns() {
|
||||
return showColumns;
|
||||
}
|
||||
|
||||
public void setShowColumns(List<ShowColumsDto> showColumns) {
|
||||
this.showColumns = showColumns;
|
||||
}
|
||||
|
||||
public List<FilterConditionDto> getFilterConditionDtos() {
|
||||
return filterConditionDtos;
|
||||
}
|
||||
|
||||
public void setFilterConditionDtos(List<FilterConditionDto> filterConditionDtos) {
|
||||
this.filterConditionDtos = filterConditionDtos;
|
||||
}
|
||||
|
||||
public String getDownloadSize() {
|
||||
return downloadSize;
|
||||
}
|
||||
|
||||
public void setDownloadSize(String downloadSize) {
|
||||
this.downloadSize = downloadSize;
|
||||
}
|
||||
|
||||
public String getTransMethod() {
|
||||
return transMethod;
|
||||
}
|
||||
|
||||
public void setTransMethod(String transMethod) {
|
||||
this.transMethod = transMethod;
|
||||
}
|
||||
|
||||
public Map getAuthParamsJson() {
|
||||
return authParamsJson;
|
||||
}
|
||||
|
||||
public void setAuthParamsJson(Map authParamsJson) {
|
||||
this.authParamsJson = authParamsJson;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @date: 2021/5/25 17:23
|
||||
* @author: deli.xu
|
||||
* @description:
|
||||
*/
|
||||
public class FilterConditionDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3399942468474767859L;
|
||||
|
||||
/**
|
||||
* 列名
|
||||
*/
|
||||
private String columIndex;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 过滤类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 模糊搜索
|
||||
*/
|
||||
private Like like;
|
||||
|
||||
/**
|
||||
* 关联条件
|
||||
*/
|
||||
private String connectCondition;
|
||||
|
||||
/**
|
||||
* sql条件
|
||||
*/
|
||||
private String sql;
|
||||
|
||||
|
||||
public String getColumIndex() {
|
||||
return columIndex;
|
||||
}
|
||||
|
||||
public void setColumIndex(String columIndex) {
|
||||
this.columIndex = columIndex;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Like getLike() {
|
||||
return like;
|
||||
}
|
||||
|
||||
public void setLike(Like like) {
|
||||
this.like = like;
|
||||
}
|
||||
|
||||
public String getConnectCondition() {
|
||||
return connectCondition;
|
||||
}
|
||||
|
||||
public void setConnectCondition(String connectCondition) {
|
||||
this.connectCondition = connectCondition;
|
||||
}
|
||||
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public void setSql(String sql) {
|
||||
this.sql = sql;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @date: 2021/6/1 17:50
|
||||
* @author: deli.xu
|
||||
* @description:
|
||||
*/
|
||||
public class Like implements Serializable {
|
||||
private static final long serialVersionUID = -3399942468474767851L;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
|
||||
|
||||
public String getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
public void setPrefix(String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @date: 2022/5/14 13:52
|
||||
* @author: deli.xu
|
||||
* @description:
|
||||
*/
|
||||
|
||||
public class ReadInfoEntity implements Serializable {
|
||||
private static final long serialVersionUID = -8890667941835568289L;
|
||||
private Long employeeId;
|
||||
private Date date;
|
||||
|
||||
public Long getEmployeeId() {
|
||||
return this.employeeId;
|
||||
}
|
||||
|
||||
public void setEmployeeId(Long employeeId) {
|
||||
this.employeeId = employeeId;
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public void setDate(Date date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public ReadInfoEntity() {
|
||||
}
|
||||
|
||||
public ReadInfoEntity(Long employeeId, Date date) {
|
||||
this.employeeId = employeeId;
|
||||
this.date = date;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: RedoContext
|
||||
* @Description 重做实体类
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/10 14:18
|
||||
*/
|
||||
@ApiModel("重做实体类")
|
||||
public class RedoContext<T> {
|
||||
@ApiModelProperty("重做参数")
|
||||
private T redoParams;
|
||||
|
||||
public T getRedoParams() {
|
||||
return redoParams;
|
||||
}
|
||||
|
||||
public void setRedoParams(T redoParams) {
|
||||
this.redoParams = redoParams;
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @date: 2021/5/11 18:46
|
||||
* @author: deli.xu
|
||||
* @description: 显示列对象
|
||||
*/
|
||||
public class ShowColumsDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4650449925605408753L;
|
||||
|
||||
/**
|
||||
* 列名
|
||||
*/
|
||||
private String columName;
|
||||
/**
|
||||
* 列别名
|
||||
*/
|
||||
private String aliasColumName;
|
||||
|
||||
/**
|
||||
* 列名index
|
||||
*/
|
||||
private String columIndex;
|
||||
|
||||
/**
|
||||
* 是否隐藏 默认显示
|
||||
*/
|
||||
private boolean isHide = false;
|
||||
|
||||
/**
|
||||
* 宽度
|
||||
*/
|
||||
private String width;
|
||||
|
||||
/**
|
||||
* 是否转多语言
|
||||
*/
|
||||
private boolean isTransfLanguage = false;
|
||||
|
||||
/**
|
||||
* 是否换行
|
||||
* @param width
|
||||
*/
|
||||
private boolean newLine = false;
|
||||
|
||||
public void setWidth(String width){
|
||||
this.width =width;
|
||||
}
|
||||
|
||||
public String getWidth(){
|
||||
return width;
|
||||
}
|
||||
public String getColumName() {
|
||||
return columName;
|
||||
}
|
||||
|
||||
public void setColumName(String columName) {
|
||||
this.columName = columName;
|
||||
}
|
||||
|
||||
public String getAliasColumName() {
|
||||
return aliasColumName;
|
||||
}
|
||||
|
||||
public void setAliasColumName(String aliasColumName) {
|
||||
this.aliasColumName = aliasColumName;
|
||||
}
|
||||
|
||||
public boolean isHide() {
|
||||
return isHide;
|
||||
}
|
||||
|
||||
public void setHide(boolean hide) {
|
||||
isHide = hide;
|
||||
}
|
||||
|
||||
public String getColumIndex() {
|
||||
return columIndex;
|
||||
}
|
||||
|
||||
public void setColumIndex(String columIndex) {
|
||||
this.columIndex = columIndex;
|
||||
}
|
||||
|
||||
public boolean isTransfLanguage() {
|
||||
return isTransfLanguage;
|
||||
}
|
||||
|
||||
public boolean isNewLine() {
|
||||
return newLine;
|
||||
}
|
||||
|
||||
public void setNewLine(boolean newLine) {
|
||||
this.newLine = newLine;
|
||||
}
|
||||
|
||||
public void setTransfLanguage(boolean transfLanguage) {
|
||||
|
||||
isTransfLanguage = transfLanguage;
|
||||
}
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package com.engine.salary.elog.entity.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* @ClassName: TableColumnBean
|
||||
* @Description 表字段类
|
||||
* @Author tanghj
|
||||
* @Date 2021/3/12 11:44
|
||||
*/
|
||||
@ApiModel("表字段类")
|
||||
public class TableColumnBean {
|
||||
|
||||
@ApiModelProperty("列名")
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* varchar(20)
|
||||
*/
|
||||
@ApiModelProperty("数据类型")
|
||||
private String columnType;
|
||||
|
||||
@ApiModelProperty("字段类型-字符串")
|
||||
private String dataTypeStr;
|
||||
|
||||
@ApiModelProperty("字段类型")
|
||||
private DataTypeEnum dataType;
|
||||
|
||||
@ApiModelProperty("长度")
|
||||
private long fieldLength;
|
||||
|
||||
@ApiModelProperty("是否为空")
|
||||
private boolean isNullable;
|
||||
|
||||
@ApiModelProperty("是否为空-字符串")
|
||||
private String isNullableStr;
|
||||
|
||||
@ApiModelProperty("默认值")
|
||||
private Object columnDefault;
|
||||
|
||||
@ApiModelProperty("备注")
|
||||
private String columnComment;
|
||||
|
||||
public String getColumnName() {
|
||||
return columnName;
|
||||
}
|
||||
|
||||
public void setColumnName(String columnName) {
|
||||
this.columnName = columnName;
|
||||
}
|
||||
|
||||
public String getColumnType() {
|
||||
return columnType;
|
||||
}
|
||||
|
||||
public void setColumnType(String columnType) {
|
||||
this.columnType = columnType;
|
||||
}
|
||||
|
||||
public DataTypeEnum getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(DataTypeEnum dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public long getFieldLength() {
|
||||
return fieldLength;
|
||||
}
|
||||
|
||||
public void setFieldLength(long fieldLength) {
|
||||
this.fieldLength = fieldLength;
|
||||
}
|
||||
|
||||
public boolean isNullable() {
|
||||
return isNullable;
|
||||
}
|
||||
|
||||
public void setNullable(boolean nullable) {
|
||||
isNullable = nullable;
|
||||
}
|
||||
|
||||
public Object getColumnDefault() {
|
||||
return columnDefault;
|
||||
}
|
||||
|
||||
public void setColumnDefault(Object columnDefault) {
|
||||
this.columnDefault = columnDefault;
|
||||
}
|
||||
|
||||
public String getColumnComment() {
|
||||
return columnComment;
|
||||
}
|
||||
|
||||
public void setColumnComment(String columnComment) {
|
||||
this.columnComment = columnComment;
|
||||
}
|
||||
|
||||
public String getDataTypeStr() {
|
||||
return dataTypeStr;
|
||||
}
|
||||
|
||||
public void setDataTypeStr(String dataTypeStr) {
|
||||
this.dataTypeStr = dataTypeStr;
|
||||
}
|
||||
|
||||
public String getIsNullableStr() {
|
||||
return isNullableStr;
|
||||
}
|
||||
|
||||
public void setIsNullableStr(String isNullableStr) {
|
||||
this.isNullableStr = isNullableStr;
|
||||
}
|
||||
|
||||
public boolean equals(TableColumnBean tableColumnBean) {
|
||||
|
||||
return this.toSql().equals(tableColumnBean.toSql());
|
||||
}
|
||||
|
||||
public String toSql() {
|
||||
|
||||
StringBuilder sb = new StringBuilder(this.columnName.toLowerCase()).append(" ");
|
||||
|
||||
if (this.dataType == null) {
|
||||
return "类型为空";
|
||||
}
|
||||
switch (this.dataType) {
|
||||
case BIGINT:
|
||||
case INT:
|
||||
case TEXT:
|
||||
case LONGTEXT:
|
||||
case DATETIME:
|
||||
case FLOAT:
|
||||
case TINYINT:
|
||||
case DOUBLE:
|
||||
sb.append(this.dataType.name().toLowerCase()).append(" ");
|
||||
break;
|
||||
case VARCHAR:
|
||||
sb.append(this.dataType.name().toLowerCase()).append("(").append(this.fieldLength).append(") ");
|
||||
break;
|
||||
case DECIMAL:
|
||||
long length = (this.fieldLength < 0 || this.fieldLength > 38) ? 0 : this.fieldLength;
|
||||
sb.append(this.dataType.name().toLowerCase()).append("(").append(38 - length).append(",").append(length).append(") ");
|
||||
break;
|
||||
default:
|
||||
sb.append("varchar").append("(").append(10).append(") ");
|
||||
}
|
||||
|
||||
sb.append("comment ").append("'").append(this.columnComment).append("' ");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.engine.salary.elog.enums;
|
||||
|
||||
/**
|
||||
* @date: 2022/3/30 20:32
|
||||
* @author: deli.xu
|
||||
* @description: 日志常量
|
||||
*/
|
||||
public class ElogConsts {
|
||||
|
||||
public static final String ORACLE = "oracle";
|
||||
public static final String SQLSERVER = "sqlserver";
|
||||
public static final String MYSQL = "mysql";
|
||||
public static final String POSTGRESQL = "postgresql";
|
||||
|
||||
public static final String BASE_TABLE = "BASE_ELOG_TABLE";
|
||||
|
||||
public static final String TABLE_SPACER = "_";
|
||||
public static final String TABLE_SUFFIX = "logs";
|
||||
public static final String DETAIL_TABLE_SUFFIX = "_detail";
|
||||
|
||||
public static final String ES = "ES";
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package com.engine.salary.elog.enums;
|
||||
|
||||
/**
|
||||
* @ClassName: FromTerminalType
|
||||
* @Description TODO
|
||||
* @Author tanghj
|
||||
* @Date 2021/6/8 11:35
|
||||
*/
|
||||
public enum FromTerminalType {
|
||||
PC("pc","来自 pc web"),
|
||||
ANDROID("android","来自 安卓"),
|
||||
IOS("ios","来自 iphone"),
|
||||
IPHONE("iphone","来自 iphone"),
|
||||
PC_CLIENT("pc_client","来自 windows客户端"),
|
||||
MAC_CLIENT("mac_client","来自 mac客户端"),
|
||||
H5("H5","来自 手机H5"),
|
||||
MOBILEWEB("mobileWeb","来自 手机H5"),
|
||||
MICO_MSG("mico_msg","来自 微信"),
|
||||
WECHAT("wechat","来自 企业微信"),
|
||||
APP_H5("app_h5","来自 app_h5"),
|
||||
BROWSER("browser", "来自 网页"),
|
||||
MOBILE("mobile","来自 移动端");
|
||||
|
||||
private String code;
|
||||
private String face;
|
||||
|
||||
FromTerminalType(String code, String face) {
|
||||
this.code = code;
|
||||
this.face = face;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getFace() {
|
||||
return face;
|
||||
}
|
||||
|
||||
public static FromTerminalType fromString(String name) {
|
||||
try {
|
||||
FromTerminalType type = FromTerminalType.valueOf(name);
|
||||
return type;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package com.engine.salary.elog.enums;
|
||||
|
||||
/**
|
||||
* @date: 2022/5/13 21:13
|
||||
* @author: deli.xu
|
||||
* @description: 链接类型 用之前老eteams-base-bean
|
||||
*/
|
||||
|
||||
/**
|
||||
* 链接类型
|
||||
*
|
||||
* @author gk
|
||||
*/
|
||||
public enum LinkType {
|
||||
|
||||
// 主线
|
||||
mainline("项目"),
|
||||
|
||||
blog("工作日报"),
|
||||
|
||||
workreport("计划报告"),
|
||||
|
||||
clue("线索"),
|
||||
|
||||
crmcontact("联系人-用于全局搜索"),
|
||||
|
||||
marketactivity("活动"),
|
||||
|
||||
crmSummary("报表"),
|
||||
|
||||
statisticalReport("统计报表"),
|
||||
|
||||
attend("出勤"),
|
||||
|
||||
singalForm("表单应用"),
|
||||
|
||||
biaoge("表格"),
|
||||
|
||||
// 标签
|
||||
tag("标签"),
|
||||
|
||||
// 表单标签
|
||||
formtag("表单标签"),
|
||||
|
||||
// 附件
|
||||
attachment("附件"),
|
||||
|
||||
// 用户
|
||||
user("用户"),
|
||||
|
||||
// 任务
|
||||
task("任务"),
|
||||
|
||||
// 子任务
|
||||
subtask("子任务"),
|
||||
|
||||
// 文档
|
||||
document("文档"),
|
||||
|
||||
// 文件夹
|
||||
folder("文件夹"),
|
||||
|
||||
// 客户
|
||||
customer("客户"),
|
||||
|
||||
// 联系人
|
||||
contact("联系人"),
|
||||
|
||||
// 销售商机
|
||||
saleChance("销售商机"),
|
||||
|
||||
// 产品
|
||||
production("产品"),
|
||||
|
||||
// 合同
|
||||
contract("合同"),
|
||||
|
||||
// 竞争对手
|
||||
competitor("竞争对手"),
|
||||
|
||||
// 公告
|
||||
placard("公告"),
|
||||
|
||||
// 审批
|
||||
workflow("审批"),
|
||||
|
||||
// 部门
|
||||
department("部门"),
|
||||
|
||||
// 岗位
|
||||
position("岗位"),
|
||||
|
||||
// 日程
|
||||
calendar("日程"),
|
||||
|
||||
// 群组
|
||||
group("群组"),
|
||||
|
||||
// 合同
|
||||
hrcontract("人事合同"),
|
||||
|
||||
//人事管理
|
||||
hr("人事"),
|
||||
|
||||
//KPI
|
||||
kpi("绩效考核"),kpiFlow("绩效考核流程"),
|
||||
|
||||
// 全部
|
||||
all("所有人"),
|
||||
|
||||
formdatareport("数据上报"),
|
||||
|
||||
form("表单"),
|
||||
|
||||
userSetting("不可见成员"),
|
||||
|
||||
sms("短信"),
|
||||
|
||||
wechatEnterprise("企业微信"),
|
||||
|
||||
wechatService("微信服务号"),
|
||||
|
||||
salarybill("工资单"),
|
||||
|
||||
staffPosition("员工位置")/*定制化模块*/,
|
||||
|
||||
app("应用")/*自定义应用*/,
|
||||
|
||||
email("邮件"),
|
||||
|
||||
workTrends("工作动态"),
|
||||
|
||||
tenantLogo("个性化定制"),
|
||||
|
||||
module("模块"),
|
||||
|
||||
orderform("订单"),
|
||||
|
||||
price("价格"),
|
||||
|
||||
capital("资金"),
|
||||
|
||||
quote("报价"),
|
||||
|
||||
room("会议室管理"),
|
||||
|
||||
//模板任务
|
||||
mtTask("模板任务"),
|
||||
|
||||
watchMe("关注我的"),
|
||||
// crm
|
||||
crm("CRM"),
|
||||
|
||||
// 空
|
||||
blank(""),
|
||||
|
||||
role("角色"),
|
||||
|
||||
externalUser("外部联系人"),
|
||||
|
||||
subcompany("分部");
|
||||
|
||||
private String displayName;
|
||||
|
||||
LinkType(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.engine.salary.elog.enums;
|
||||
|
||||
public class OperateAuditType {
|
||||
//自动
|
||||
public static final String AUTO = "AUTO";
|
||||
//信息
|
||||
public static final String INFO = "INFO";
|
||||
//错误
|
||||
public static final String ERROR = "ERROR";
|
||||
//警告
|
||||
public static final String WARNING = "WARNING";
|
||||
//重大事件
|
||||
public static final String EVENT = "EVENT";
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.engine.salary.elog.service;
|
||||
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.elog.entity.dto.LoggerDetailContext;
|
||||
|
||||
public interface ILocalElogService {
|
||||
|
||||
<T> int insertLocalElog(LoggerContext<T> context);
|
||||
|
||||
<T> int insertElogDetail(LoggerDetailContext<T> loggerDetailContext, String mainId, String detailTableName);
|
||||
|
||||
// <T> void rollBackElog(LoggerContext<T> context);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.engine.salary.elog.service;
|
||||
|
||||
import com.cloudstore.eccom.pc.table.WeaTable;
|
||||
import com.engine.salary.elog.entity.param.ELogGetLogParam;
|
||||
import com.engine.salary.elog.entity.param.GetDetailChangesParam;
|
||||
import com.engine.salary.elog.util.page.PageInfo;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ILoggerTableService {
|
||||
PageInfo queryLogs(String data);
|
||||
|
||||
WeaTable queryLogsPapi(String data, HttpServletRequest request);
|
||||
|
||||
List getDetailChanges(GetDetailChangesParam param);
|
||||
|
||||
List getDetailChangesPapi(String module, String function, String mainid, String transMethod, HttpServletRequest request);
|
||||
|
||||
List queryLogList(ELogGetLogParam param);
|
||||
|
||||
List queryCardLogList(String data);
|
||||
|
||||
Map countLog(String module, String function);
|
||||
|
||||
List queryDetailLogList(String module, String function, String current, String pageSize, String condition, String mainId);
|
||||
|
||||
Map countDestailLog(String module, String function, String mainId);
|
||||
|
||||
WeaTable queryElogTraceInfo(String traceId, String module, String function, Integer currentPage, Integer pageSize,String traceTransMethod);
|
||||
|
||||
List queryLogInfoByCustom(String module, String function, String field, String value, boolean isDetail);
|
||||
|
||||
List queryLogInfoByCustom(String module, String function, String field, String value);
|
||||
|
||||
// BatchDocumentMessage downloadLog(String data);
|
||||
|
||||
WeaTable getDetailChangePages(String module, String function, String mainid, String detailTransMethod, String current, String pageSize);
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,75 @@
|
||||
package com.engine.salary.elog.threadlocal;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Date: 2022/5/18 20:26
|
||||
* @Author: deli.xu
|
||||
* @Description:
|
||||
**/
|
||||
public class ElogThreadLocal {
|
||||
|
||||
private static final ThreadLocal<List<LoggerContext>> loggerContextList = new ThreadLocal<>();
|
||||
private static final ThreadLocal<JSONObject> requestBody = new ThreadLocal<>();
|
||||
|
||||
public static LoggerContext currentLoggerContext() {
|
||||
List<LoggerContext> list = loggerContextList.get();
|
||||
|
||||
if(list == null || list.size() == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return list.get(list.size() -1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addLoggerContext(LoggerContext loggerContext) {
|
||||
if(loggerContext == null)
|
||||
return;
|
||||
List<LoggerContext> list = loggerContextList.get();
|
||||
if(list == null) {
|
||||
list = new ArrayList<>();
|
||||
loggerContextList.set(list);
|
||||
}
|
||||
|
||||
list.add(loggerContext);
|
||||
|
||||
}
|
||||
|
||||
public static List<LoggerContext> getLoggerContextList() {
|
||||
return loggerContextList.get();
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
loggerContextList.set(null);
|
||||
}
|
||||
|
||||
public static void removeLast() {
|
||||
List<LoggerContext> list = loggerContextList.get();
|
||||
|
||||
if(list != null) {
|
||||
int size = list.size();
|
||||
if(size > 0)
|
||||
list.remove(size - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public static void remove() {
|
||||
loggerContextList.remove();
|
||||
}
|
||||
|
||||
public static JSONObject getRequestBody() {
|
||||
return requestBody.get();
|
||||
}
|
||||
|
||||
public static void setRequestBody(JSONObject json) {
|
||||
requestBody.set(json);
|
||||
}
|
||||
|
||||
public static void removeRequestBody() {
|
||||
requestBody.remove();
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.engine.salary.elog.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.engine.salary.elog.entity.dto.ElogBean;
|
||||
import com.engine.salary.elog.entity.dto.FilterConditionDto;
|
||||
import com.engine.salary.elog.entity.dto.ShowColumsDto;
|
||||
import com.engine.salary.elog.enums.ElogConsts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Date: 2022/5/18 19:19
|
||||
* @Author: deli.xu
|
||||
* @Description: elog服务工具类
|
||||
**/
|
||||
public class ElogServiceUtils {
|
||||
|
||||
public static String getTableName(String module, String function) {
|
||||
return getTableName(module, function, false);
|
||||
}
|
||||
|
||||
public static String getTableName(String module, String function, boolean isDetail) {
|
||||
String tablename = module + ElogConsts.TABLE_SPACER + function + ElogConsts.TABLE_SUFFIX + (isDetail ? ElogConsts.DETAIL_TABLE_SUFFIX : "");
|
||||
sqlCheck(tablename);
|
||||
return tablename;
|
||||
}
|
||||
|
||||
public static void sqlCheck(String value) {
|
||||
if (value != null) {
|
||||
if (!value.matches("^[A-Za-z][a-zA-Z0-9_\\.,]{0,31}$")) {
|
||||
throw new RuntimeException("sqlCheck failed ! value :" + value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ElogBean getElogBean(String data) {
|
||||
JSONObject datas = JSONObject.parseObject(data);
|
||||
ElogBean elogBean = new ElogBean();
|
||||
String module = datas.getString("module");
|
||||
String function = datas.getString("function");
|
||||
String pageNum = datas.getString("current");
|
||||
String pageSize = datas.getString("pageSize");
|
||||
String searchMap = datas.getString("searchMap");
|
||||
String transMethod = datas.getString("transMethod");
|
||||
String authParams = datas.getString("authParams");
|
||||
String showColums = datas.getString("showColums");
|
||||
String filterConditions = datas.getString("filterConditions");
|
||||
String downloadSize = datas.getString("downloadSize");
|
||||
List<ShowColumsDto> showColumsDtos = JSONArray.parseArray(showColums, ShowColumsDto.class);
|
||||
List<FilterConditionDto> filterConditionDtos = JSONArray.parseArray(filterConditions, FilterConditionDto.class);
|
||||
Map authParamsJson = JSONObject.parseObject(authParams);
|
||||
elogBean.setModule(module);
|
||||
elogBean.setFunction(function);
|
||||
elogBean.setCurrent(pageNum);
|
||||
elogBean.setPageSize(pageSize);
|
||||
elogBean.setSearchMap(searchMap);
|
||||
elogBean.setTransMethod(transMethod);
|
||||
elogBean.setDownloadSize(downloadSize);
|
||||
elogBean.setShowColumns(showColumsDtos);
|
||||
elogBean.setFilterConditionDtos(filterConditionDtos);
|
||||
elogBean.setAuthParamsJson(authParamsJson);
|
||||
return elogBean;
|
||||
}
|
||||
|
||||
public static int getIntValue(String v) {
|
||||
return getIntValue(v, -1);
|
||||
}
|
||||
|
||||
public static int getIntValue(String v, int def) {
|
||||
try {
|
||||
return Integer.parseInt(v);
|
||||
} catch (Exception var3) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public static long getLongValue(String v) {
|
||||
return getLongValue(v, -1l);
|
||||
}
|
||||
|
||||
public static long getLongValue(String v, long def) {
|
||||
try {
|
||||
return Long.parseLong(v);
|
||||
} catch (Exception var3) {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,94 @@
|
||||
package com.engine.salary.elog.util;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: FieldNameMap
|
||||
* @Description TODO
|
||||
* @Author tanghj
|
||||
* @Date 2021/3/31 14:27
|
||||
*/
|
||||
public class FieldNameMap {
|
||||
|
||||
private static Map<String, String> mainFieldNameMap = new HashMap<>();
|
||||
|
||||
private static Map<String, String> detailFieldNameMap = new HashMap<>();
|
||||
|
||||
private static Map<String, Map<String, String>> mainCusFieldNameMap = new HashMap<>();
|
||||
|
||||
private static Map<String, Map<String, String>> detailCusFieldNameMap = new HashMap<>();
|
||||
|
||||
|
||||
public static void setMainFieldName(Map<String, String> fieldNameMap) {
|
||||
mainFieldNameMap.putAll(fieldNameMap);
|
||||
}
|
||||
|
||||
public static void setDetailFieldName(Map<String, String> fieldNameMap) {
|
||||
detailFieldNameMap.putAll(fieldNameMap);
|
||||
}
|
||||
|
||||
public static void setMainCusFieldName(String module, String function, Map<String, String> fieldNameMap) {
|
||||
mainCusFieldNameMap.put(getKey(module, function), fieldNameMap);
|
||||
}
|
||||
|
||||
public static void setDetailCusFieldName(String module, String function, Map<String, String> fieldNameMap) {
|
||||
detailCusFieldNameMap.put(getKey(module, function), fieldNameMap);
|
||||
}
|
||||
|
||||
|
||||
public static String getMainFieldNameMap(String module, String function, String key) {
|
||||
|
||||
String str = key.toLowerCase();
|
||||
if(mainFieldNameMap.containsKey(str)) {
|
||||
return StringUtils.isNotEmpty(mainFieldNameMap.get(str)) ? mainFieldNameMap.get(str) : key;
|
||||
} else {
|
||||
return getMainCusFieldNameMap(module, function,key);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDetailFieldNameMap(String module, String function, String key) {
|
||||
key = key.toLowerCase();
|
||||
if(detailFieldNameMap.containsKey(key)) {
|
||||
return StringUtils.isNotEmpty(detailFieldNameMap.get(key)) ? detailFieldNameMap.get(key) : key;
|
||||
} else {
|
||||
return getDetailCusFieldNameMap(module, function, key);
|
||||
}
|
||||
}
|
||||
|
||||
public static String getMainCusFieldNameMap(String module, String function, String key) {
|
||||
|
||||
if(mainCusFieldNameMap.containsKey(getKey(module, function))) {
|
||||
if(mainCusFieldNameMap.get(getKey(module, function)).containsKey(key)) {
|
||||
return StringUtils.isNotEmpty(mainCusFieldNameMap.get(getKey(module, function)).get(key)) ?
|
||||
mainCusFieldNameMap.get(getKey(module, function)).get(key) :
|
||||
key;
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getDetailCusFieldNameMap(String module, String function, String key) {
|
||||
|
||||
if(detailCusFieldNameMap.containsKey(getKey(module, function))) {
|
||||
if(detailCusFieldNameMap.get(getKey(module, function)).containsKey(key)) {
|
||||
return StringUtils.isNotEmpty(detailCusFieldNameMap.get(getKey(module, function)).get(key)) ?
|
||||
detailCusFieldNameMap.get(getKey(module, function)).get(key) :
|
||||
key;
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
} else {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getKey(String module, String function) {
|
||||
return module + "@" + function;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.engine.salary.elog.util;
|
||||
|
||||
/**
|
||||
* @ClassName: LoggerTemplateBuilder
|
||||
* @Description 日志基本类构造器
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/10 14:18
|
||||
*/
|
||||
public class LoggerTemplateBuilder {
|
||||
|
||||
public static LoggerTemplate build(String module){
|
||||
return build(module, "common");
|
||||
}
|
||||
public static LoggerTemplate build(String module, String function){
|
||||
LoggerTemplate loggerTemplate = new LoggerTemplate();
|
||||
loggerTemplate.setFunction(function);
|
||||
loggerTemplate.setModule(module);
|
||||
|
||||
return loggerTemplate;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.engine.salary.elog.util;
|
||||
|
||||
/**
|
||||
* 多语言工具类
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class SalaryI18nUtil {
|
||||
|
||||
/**
|
||||
* 获取多语言信息
|
||||
*
|
||||
* @param labelId 多语言对应的labelId
|
||||
* @param defaultLabel 默认中文
|
||||
* @return
|
||||
*/
|
||||
public static String getI18nLabel(int labelId, String defaultLabel) {
|
||||
return defaultLabel;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 获取多语言信息
|
||||
// *
|
||||
// * @param tenantKey 租户key
|
||||
// * @param employeeId 人员id
|
||||
// * @param labelId 多语言对应的labelId
|
||||
// * @param defaultLabel 默认中文
|
||||
// * @return
|
||||
// */
|
||||
// public static String getI18nLabel(String tenantKey, Long employeeId, int labelId, String defaultLabel) {
|
||||
// int languageId = I18nLanguageUtil.getLangId(employeeId);
|
||||
// return SalaryI18nUtil.getI18nLabel(labelId, languageId, tenantKey, defaultLabel);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取多语言信息
|
||||
// *
|
||||
// * @param simpleEmployee 租户信息
|
||||
// * @param labelId 多语言对应的labelId
|
||||
// * @param defaultLabel 默认中文
|
||||
// * @return
|
||||
// */
|
||||
// public static String getI18nLabel(DataCollectionEmployee simpleEmployee, int labelId, String defaultLabel) {
|
||||
// int languageId = I18nLanguageUtil.getLangId(simpleEmployee.getEmployeeId());
|
||||
// return SalaryI18nUtil.getI18nLabel(labelId, languageId, simpleEmployee.getTenantKey(), defaultLabel);
|
||||
// }
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.engine.salary.elog.util.db;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
public class IdGenerator {
|
||||
private static AtomicLong next = new AtomicLong(1L);
|
||||
public static final int ID_LENGTH_36 = 36;
|
||||
|
||||
public IdGenerator() {
|
||||
}
|
||||
|
||||
public static long generate() {
|
||||
return System.currentTimeMillis() + next.getAndIncrement();
|
||||
}
|
||||
|
||||
public static String generateId() {
|
||||
return System.currentTimeMillis() + String.valueOf(next.getAndIncrement());
|
||||
}
|
||||
|
||||
public static String generateStrId() {
|
||||
return System.currentTimeMillis() + generateStrId(36);
|
||||
}
|
||||
|
||||
public static String generateStrId(int idLength) {
|
||||
if (idLength >= 1 && idLength <= 36) {
|
||||
char[] srcChars = new char[]{'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'g', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
char[] chars = new char[idLength];
|
||||
|
||||
for(int i = 0; i < idLength; ++i) {
|
||||
if (i != 8 && i != 13 && i != 18 && i != 23) {
|
||||
if (i == 0) {
|
||||
chars[i] = srcChars[(int)(Math.random() * 26.0D) % 26];
|
||||
} else {
|
||||
chars[i] = srcChars[(int)(Math.random() * 36.0D) % 36];
|
||||
}
|
||||
} else {
|
||||
chars[i] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
return new String(chars);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.engine.salary.elog.util.db;
|
||||
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import weaver.conn.mybatis.MyBatisFactory;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/**
|
||||
* mapper代理工厂
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
public class MapperProxyFactory implements InvocationHandler {
|
||||
private Class clazz;
|
||||
private boolean enableTransactions = false;
|
||||
private SqlSession session;
|
||||
|
||||
public MapperProxyFactory(Class clazz) {
|
||||
this.clazz = clazz;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Exception {
|
||||
this.session = MyBatisFactory.sqlSessionFactory.openSession();
|
||||
try {
|
||||
Object target = session.getMapper(clazz);
|
||||
return method.invoke(target, args);
|
||||
} finally {
|
||||
if (!enableTransactions) {
|
||||
session.commit();
|
||||
session.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Object getProxy() {
|
||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
||||
Class<?>[] interfaces = new Class<?>[1];
|
||||
interfaces[0] = this.clazz;
|
||||
return Proxy.newProxyInstance(loader, interfaces, this);
|
||||
}
|
||||
|
||||
public Object getProxy(boolean enableTransactions) {
|
||||
this.enableTransactions = enableTransactions;
|
||||
return this.getProxy();
|
||||
}
|
||||
|
||||
public void commit() {
|
||||
if (this.session != null) {
|
||||
this.session.commit();
|
||||
this.session.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void rollback() {
|
||||
if (this.session != null) {
|
||||
this.session.rollback();
|
||||
this.session.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> T getProxy(Class<T> clazz) {
|
||||
MapperProxyFactory handle = new MapperProxyFactory(clazz);
|
||||
return (T) handle.getProxy();
|
||||
}
|
||||
|
||||
public static <T> T getProxy(Class<T> clazz, boolean enableTransactions) {
|
||||
MapperProxyFactory handle = new MapperProxyFactory(clazz);
|
||||
return (T) handle.getProxy(enableTransactions);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.engine.salary.elog.util.page;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Column {
|
||||
String title;
|
||||
String dataIndex;
|
||||
String key;
|
||||
boolean display;
|
||||
|
||||
public Column(String title, String dataIndex, String key) {
|
||||
this.title = title;
|
||||
this.dataIndex = dataIndex;
|
||||
this.key = key;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.engine.salary.elog.util.page;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DataSource {
|
||||
String key;
|
||||
String title;
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.engine.salary.elog.util.page;
|
||||
|
||||
import com.engine.salary.elog.util.page.Column;
|
||||
import com.engine.salary.elog.util.page.DataSource;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class PageInfo<T> extends com.github.pagehelper.PageInfo<T> {
|
||||
Class<T> clazz;
|
||||
|
||||
public void setColumns(List<Column> columns) {
|
||||
this.columns.addAll(columns);
|
||||
}
|
||||
|
||||
List<Column> columns = new ArrayList<>();
|
||||
List<DataSource> dataSource = new ArrayList<>();
|
||||
|
||||
public PageInfo() {
|
||||
}
|
||||
|
||||
public PageInfo(Class<T> clazz) {
|
||||
this.clazz = clazz;
|
||||
this.columns = buildColumns();
|
||||
}
|
||||
|
||||
public PageInfo(List<T> list) {
|
||||
super(list);
|
||||
}
|
||||
|
||||
public PageInfo(List<T> list, Class<T> clazz) {
|
||||
super(list);
|
||||
this.clazz = clazz;
|
||||
this.columns = buildColumns();
|
||||
}
|
||||
|
||||
|
||||
public List<Column> buildColumns() {
|
||||
if(clazz==null){
|
||||
return this.columns;
|
||||
}
|
||||
Field[] fields = clazz.getDeclaredFields();
|
||||
for (Field f : fields) {
|
||||
boolean isanno = f.isAnnotationPresent(TableTitle.class);
|
||||
if (isanno) {
|
||||
TableTitle annotation = f.getAnnotation(TableTitle.class);
|
||||
String title = annotation.title();
|
||||
String dataIndex = annotation.dataIndex();
|
||||
String key = annotation.key();
|
||||
boolean display = annotation.display();
|
||||
Column column = Column.builder().title(title).dataIndex(dataIndex).key(key).display(display).build();
|
||||
columns.add(column);
|
||||
}
|
||||
}
|
||||
return columns;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.engine.salary.elog.util.page;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.FIELD})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface TableTitle {
|
||||
String title();
|
||||
String dataIndex();
|
||||
String key();
|
||||
boolean display() default true;
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.engine.salary.mapper.elog;
|
||||
|
||||
import com.engine.salary.elog.entity.dto.TableColumnBean;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ElogTableCheckerMapper {
|
||||
Long getVersion(@Param("mainTable") String mainTable);
|
||||
|
||||
void recordVersion(@Param("id") long id, @Param("mainTable") String mainTable, @Param("version") long version);
|
||||
|
||||
void createMainTable(@Param("mainTable") String mainTable);
|
||||
|
||||
void createDetailTable(@Param("detailTable") String detailTable);
|
||||
|
||||
List<TableColumnBean> getTableStructure(@Param("tableName") String tableName);
|
||||
|
||||
void createElogTable(@Param("createElogSql") String createElogSql);
|
||||
|
||||
Map getTableIndex(@Param("tableName") String tableName, @Param("columnName") String columnName);
|
||||
|
||||
Map getDataBase();
|
||||
|
||||
void createTableIndex(@Param("tableName") String tableName, @Param("columnName") String columnName, @Param("id") long id);
|
||||
|
||||
List<String> getAllExistTables(@Param("tableNames") Set<String> tables);
|
||||
}
|
@ -0,0 +1,451 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.engine.salary.mapper.elog.ElogTableCheckerMapper">
|
||||
<insert id="recordVersion">
|
||||
insert into hrsa_elog_version (id, maintable, version) values (#{id},#{mainTable},#{version})
|
||||
</insert>
|
||||
<select id="getVersion" resultType="java.lang.Long">
|
||||
select version from hrsa_elog_version where maintable = #{mainTable}
|
||||
</select>
|
||||
<update id="createMainTable">
|
||||
create table ${mainTable}
|
||||
(
|
||||
id bigint comment 'ID',
|
||||
create_time datetime default current_timestamp ,
|
||||
update_time datetime default current_timestamp ,
|
||||
creator bigint,
|
||||
delete_type int,
|
||||
tenant_key varchar(10),
|
||||
uuid char(36),
|
||||
log_date datetime default current_timestamp ,
|
||||
log_operator varchar(50),
|
||||
operatorName varchar(50),
|
||||
targetId varchar(50),
|
||||
targetName text,
|
||||
modulename varchar(100),
|
||||
functionname varchar(100),
|
||||
interfaceName varchar(100),
|
||||
requesturl varchar(200),
|
||||
requesturi varchar(200),
|
||||
operateType varchar(50),
|
||||
operatetypename varchar(100),
|
||||
operatedesc varchar(1000),
|
||||
params longtext,
|
||||
belongmainid varchar(36),
|
||||
clientIp varchar(50),
|
||||
groupid varchar(50),
|
||||
device varchar(200),
|
||||
groupNameLabel varchar(500),
|
||||
redoService varchar(200),
|
||||
redoContext longtext,
|
||||
cancelService varchar(200),
|
||||
cancelContext longtext,
|
||||
totalruntime bigint,
|
||||
mainruntime bigint,
|
||||
log_result varchar(100),
|
||||
fromterminal varchar(100),
|
||||
resultdesc text,
|
||||
old_content varchar(1000),
|
||||
link_type varchar(20),
|
||||
link_id bigint,
|
||||
old_link_id bigint,
|
||||
PRIMARY KEY (id)
|
||||
)
|
||||
</update>
|
||||
<update id="createMainTable" databaseId="oracle">
|
||||
|
||||
create table ${mainTable}
|
||||
(
|
||||
id number(*,0) not null primary key,
|
||||
create_time date default sysdate,
|
||||
update_time date default sysdate,
|
||||
creator number(*,0),
|
||||
delete_type number(*,0),
|
||||
tenant_key varchar2(10),
|
||||
uuid varchar2(36),
|
||||
log_date date default sysdate,
|
||||
log_operator varchar2(50),
|
||||
operatorName varchar2(50),
|
||||
targetId varchar2(50),
|
||||
targetName varchar2(4000),
|
||||
modulename varchar2(100),
|
||||
functionname varchar2(100),
|
||||
interfaceName varchar2(100),
|
||||
requesturl varchar2(200),
|
||||
requesturi varchar2(200),
|
||||
operateType varchar2(50),
|
||||
operatetypename varchar2(100),
|
||||
operatedesc varchar2(1000),
|
||||
params clob,
|
||||
belongmainid varchar2(36),
|
||||
clientIp varchar2(200),
|
||||
groupid varchar2(50),
|
||||
device varchar2(200),
|
||||
groupNameLabel varchar2(500),
|
||||
redoService varchar2(200),
|
||||
redoContext varchar2(4000),
|
||||
cancelService varchar2(200),
|
||||
cancelContext varchar2(4000),
|
||||
totalruntime number(*,0),
|
||||
mainruntime number(*,0),
|
||||
log_result varchar2(4000),
|
||||
fromterminal varchar2(100),
|
||||
resultdesc varchar2(4000),
|
||||
old_content varchar2(1000),
|
||||
link_type varchar2(20),
|
||||
link_id number(*,0),
|
||||
old_link_id number(*,0)
|
||||
)
|
||||
</update>
|
||||
<update id="createMainTable" databaseId="sqlserver">
|
||||
create table ${mainTable}
|
||||
(
|
||||
id bigint not null primary key,
|
||||
create_time datetime default getdate(),
|
||||
update_time datetime default getdate(),
|
||||
creator bigint default '-1',
|
||||
delete_type bigint default 0,
|
||||
tenant_key nvarchar(10),
|
||||
uuid nvarchar(36),
|
||||
log_date datetime default getdate(),
|
||||
device nvarchar(500),
|
||||
log_operator bigint default '-1',
|
||||
operatorname nvarchar(100),
|
||||
targetid bigint default '-1',
|
||||
targetname nvarchar(3000),
|
||||
modulename nvarchar(100),
|
||||
functionname nvarchar(100),
|
||||
interfacename nvarchar(100),
|
||||
requesturl nvarchar(200),
|
||||
requesturi nvarchar(200),
|
||||
operatetype nvarchar(50),
|
||||
operatetypename nvarchar(100),
|
||||
operatedesc nvarchar(3000),
|
||||
params nvarchar(max),
|
||||
belongmainid nvarchar(36),
|
||||
clientip nvarchar(200),
|
||||
groupid nvarchar(50),
|
||||
groupnamelabel nvarchar(1000),
|
||||
redoservice nvarchar(200),
|
||||
redocontext nvarchar(3000),
|
||||
cancelservice nvarchar(200),
|
||||
cancelcontext nvarchar(3000),
|
||||
totalruntime bigint default 0,
|
||||
mainruntime bigint default 0,
|
||||
log_result nvarchar(100),
|
||||
fromterminal nvarchar(100),
|
||||
resultdesc nvarchar(3000),
|
||||
old_content nvarchar(3000),
|
||||
link_type nvarchar(20),
|
||||
link_id bigint default 0,
|
||||
old_link_id bigint default 0
|
||||
)
|
||||
</update>
|
||||
<update id="createMainTable" databaseId="postgresql">
|
||||
create table ${mainTable}
|
||||
(
|
||||
id int8 not null primary key,
|
||||
create_time timestamp default current_timestamp,
|
||||
update_time timestamp default current_timestamp,
|
||||
creator int8,
|
||||
delete_type int,
|
||||
tenant_key varchar(10),
|
||||
uuid varchar(36),
|
||||
log_date timestamp default current_timestamp,
|
||||
log_operator varchar(50),
|
||||
operatorName varchar(50),
|
||||
targetId varchar(50),
|
||||
targetName text,
|
||||
modulename varchar(100),
|
||||
functionname varchar(100),
|
||||
interfaceName varchar(100),
|
||||
requesturl varchar(200),
|
||||
requesturi varchar(200),
|
||||
operateType varchar(50),
|
||||
operatetypename varchar(100),
|
||||
operatedesc varchar(1000),
|
||||
params text,
|
||||
belongmainid varchar(36),
|
||||
clientIp varchar(200),
|
||||
groupid varchar(50),
|
||||
device varchar(200),
|
||||
groupNameLabel varchar(500),
|
||||
redoService varchar(200),
|
||||
redoContext text,
|
||||
cancelService varchar(200),
|
||||
cancelContext text,
|
||||
totalruntime int4,
|
||||
mainruntime int4,
|
||||
log_result varchar(100),
|
||||
fromterminal varchar(100),
|
||||
resultdesc text,
|
||||
old_content varchar(1000),
|
||||
link_type varchar(20),
|
||||
link_id int4,
|
||||
old_link_id int4
|
||||
)
|
||||
</update>
|
||||
<update id="createDetailTable">
|
||||
create table ${detailTable}
|
||||
(
|
||||
id bigint not null primary key,
|
||||
create_time datetime default current_timestamp ,
|
||||
update_time datetime default current_timestamp ,
|
||||
creator bigint,
|
||||
delete_type int,
|
||||
tenant_key varchar(10),
|
||||
uuid varchar(36),
|
||||
mainid varchar(36),
|
||||
dataid varchar(50),
|
||||
belongdataid varchar(50),
|
||||
tableName varchar(200),
|
||||
tablenamelabelid varchar(50),
|
||||
tablenamedesc varchar(50),
|
||||
fieldName varchar(200),
|
||||
fieldnamelabelid varchar(200),
|
||||
newValue longtext,
|
||||
oldValue longtext,
|
||||
newrealvalue longtext,
|
||||
oldrealvalue longtext,
|
||||
fieldDesc varchar(200),
|
||||
showorder int default 0,
|
||||
isdetail int default 0
|
||||
)
|
||||
</update>
|
||||
<update id="createDetailTable" databaseId="postgresql">
|
||||
create table ${detailTable}
|
||||
(
|
||||
id int8 not null primary key,
|
||||
create_time timestamp default current_timestamp ,
|
||||
update_time timestamp default current_timestamp ,
|
||||
creator int8,
|
||||
delete_type int8,
|
||||
tenant_key varchar(10),
|
||||
uuid varchar(36),
|
||||
mainid varchar(36),
|
||||
dataid varchar(50),
|
||||
belongdataid varchar(50),
|
||||
tableName varchar(200),
|
||||
tablenamelabelid varchar(50),
|
||||
tablenamedesc varchar(50),
|
||||
fieldName varchar(200),
|
||||
fieldnamelabelid varchar(200),
|
||||
newValue text,
|
||||
oldValue text,
|
||||
newrealvalue text,
|
||||
oldrealvalue text,
|
||||
fieldDesc varchar(200),
|
||||
showorder int8 default 0,
|
||||
isdetail int8 default 0
|
||||
)
|
||||
</update>
|
||||
<update id="createDetailTable" databaseId="oracle">
|
||||
create table ${detailTable}
|
||||
(
|
||||
id number(*,0) not null primary key,
|
||||
create_time date default sysdate,
|
||||
update_time date default sysdate,
|
||||
creator number(*,0),
|
||||
delete_type number(*,0),
|
||||
tenant_key varchar2(10),
|
||||
uuid varchar2(36),
|
||||
mainid varchar2(36),
|
||||
dataid varchar2(50),
|
||||
belongdataid varchar2(50),
|
||||
tableName varchar2(200),
|
||||
tablenamelabelid varchar2(50),
|
||||
tablenamedesc varchar2(50),
|
||||
fieldName varchar2(200),
|
||||
fieldnamelabelid varchar2(200),
|
||||
newValue CLOB,
|
||||
oldValue CLOB,
|
||||
newrealvalue CLOB,
|
||||
oldrealvalue CLOB,
|
||||
fieldDesc varchar2(200),
|
||||
showorder number(*,0) default 0,
|
||||
isdetail number(*,0) default 0
|
||||
)
|
||||
</update>
|
||||
<update id="createDetailTable" databaseId="sqlserver">
|
||||
create table ${detailTable}
|
||||
(
|
||||
id bigint not null primary key,
|
||||
create_time datetime default getdate(),
|
||||
update_time datetime default getdate(),
|
||||
creator bigint,
|
||||
delete_type bigint,
|
||||
tenant_key nvarchar(10),
|
||||
uuid nvarchar(36),
|
||||
mainid nvarchar(36),
|
||||
dataid nvarchar(50),
|
||||
belongdataid nvarchar(50),
|
||||
tableName nvarchar(200),
|
||||
tablenamelabelid nvarchar(50),
|
||||
tablenamedesc nvarchar(50),
|
||||
fieldName nvarchar(200),
|
||||
fieldnamelabelid nvarchar(200),
|
||||
newValue nvarchar(max),
|
||||
oldValue nvarchar(max),
|
||||
newrealvalue nvarchar(max),
|
||||
oldrealvalue nvarchar(max),
|
||||
fieldDesc varchar(200),
|
||||
showorder bigint default 0,
|
||||
isdetail bigint default 0
|
||||
)
|
||||
</update>
|
||||
|
||||
|
||||
<!-- 获取表结构 -->
|
||||
<select id="getTableStructure" resultType="com.engine.salary.elog.entity.dto.TableColumnBean" >
|
||||
SELECT
|
||||
COLUMN_NAME columnName,
|
||||
DATA_TYPE dataTypeStr,
|
||||
COLUMN_TYPE columnType,
|
||||
CHARACTER_MAXIMUM_LENGTH fieldLength,
|
||||
IS_NULLABLE isNullableStr,
|
||||
COLUMN_DEFAULT columnDefault,
|
||||
COLUMN_COMMENT columnComment
|
||||
FROM
|
||||
INFORMATION_SCHEMA.COLUMNS
|
||||
where
|
||||
table_name = #{tableName}
|
||||
and TABLE_SCHEMA = (select database())
|
||||
</select>
|
||||
<select id="getTableStructure" resultType="com.engine.salary.elog.entity.dto.TableColumnBean" databaseId="postgresql">
|
||||
select *
|
||||
from pg_tables
|
||||
where tableowner = (select current_user)
|
||||
and tablename = #{tableName}
|
||||
</select>
|
||||
<select id="getTableStructure" resultType="com.engine.salary.elog.entity.dto.TableColumnBean" databaseId="oracle">
|
||||
SELECT
|
||||
COLUMN_NAME columnName
|
||||
FROM
|
||||
user_tab_columns
|
||||
where
|
||||
TABLE_NAME=UPPER(#{tableName})
|
||||
</select>
|
||||
<select id="getTableStructure" resultType="com.engine.salary.elog.entity.dto.TableColumnBean" databaseId="sqlserver">
|
||||
SELECT
|
||||
COLUMN_NAME columnName
|
||||
FROM
|
||||
INFORMATION_SCHEMA.COLUMNS
|
||||
where
|
||||
table_name = #{tableName}
|
||||
and TABLE_catalog = (select DB_NAME())
|
||||
</select>
|
||||
|
||||
<update id="createElogTable">
|
||||
${createElogSql}
|
||||
</update>
|
||||
|
||||
<!--查询表索引信息-->
|
||||
<select id="getTableIndex" resultType="java.util.Map">
|
||||
SELECT COLUMN_KEY
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = #{tableName}
|
||||
AND COLUMN_NAME = #{columnName}
|
||||
AND TABLE_SCHEMA = (SELECT DATABASE()) LIMIT 1
|
||||
</select>
|
||||
<select id="getTableIndex" resultType="java.util.Map" databaseId="postgresql">
|
||||
SELECT COLUMN_KEY
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_NAME = #{tableName}
|
||||
AND COLUMN_NAME = #{columnName}
|
||||
AND TABLE_SCHEMA = (SELECT current_database()) limit 1 offset 0
|
||||
</select>
|
||||
<select id="getTableIndex" resultType="java.util.Map" databaseId="oracle">
|
||||
SELECT *
|
||||
FROM user_ind_columns
|
||||
WHERE TABLE_NAME = UPPER(#{tableName})
|
||||
AND COLUMN_NAME = UPPER(#{columnName})
|
||||
|
||||
</select>
|
||||
<select id="getTableIndex" resultType="java.util.Map" databaseId="sqlserver">
|
||||
SELECT a.name,
|
||||
c.name,
|
||||
d.name
|
||||
FROM sysindexes a
|
||||
JOIN sysindexkeys b ON
|
||||
a.id = b.id
|
||||
AND a.indid = b.indid
|
||||
JOIN sysobjects c ON
|
||||
b.id = c.id
|
||||
JOIN syscolumns d ON
|
||||
b.id = d.id
|
||||
AND b.colid = d.colid
|
||||
WHERE a.indid NOT IN (0,
|
||||
255)
|
||||
AND c.name = #{tableName}
|
||||
and d.name = #{columnName}
|
||||
|
||||
</select>
|
||||
|
||||
<!--查询表索引信息-->
|
||||
<select id="getDataBase" resultType="java.util.Map">
|
||||
SELECT DATABASE() as databasename
|
||||
</select>
|
||||
<select id="getDataBase" resultType="java.util.Map" databaseId="postgresql">
|
||||
SELECT current_database() as databasename
|
||||
</select>
|
||||
<select id="getDataBase" resultType="java.util.Map" databaseId="oracle">
|
||||
SELECT user as databasename
|
||||
</select>
|
||||
<select id="getDataBase" resultType="java.util.Map" databaseId="sqlserver">
|
||||
SELECT db_name() as databasename
|
||||
</select>
|
||||
|
||||
<update id="createTableIndex">
|
||||
create index idx${id} on ${tableName} (${columnName})
|
||||
</update>
|
||||
|
||||
<update id="createTableIndex" databaseId="oracle">
|
||||
create index idx${id} on ${tableName} (${columnName})
|
||||
</update>
|
||||
|
||||
<update id="createTableIndex" databaseId="sqlserver">
|
||||
create index idx${id} on ${tableName} (${columnName})
|
||||
</update>
|
||||
|
||||
<select id="getAllExistTables" resultType="java.lang.String">
|
||||
SELECT TABLE_NAME
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_SCHEMA = (SELECT DATABASE())
|
||||
AND TABLE_NAME IN
|
||||
<foreach collection="tableNames" item="tableName" open="(" separator="," close=")">
|
||||
#{tableName}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getAllExistTables" resultType="java.lang.String" databaseId="oracle">
|
||||
SELECT
|
||||
TABLE_NAME
|
||||
FROM
|
||||
USER_TABLES
|
||||
WHERE TABLE_NAME IN
|
||||
<foreach collection="tableNames" item="tableName" open="(" separator="," close=")">
|
||||
UPPER(#{tableName})
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getAllExistTables" resultType="java.lang.String" databaseId="sqlserver">
|
||||
SELECT table_name
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_catalog = (select DB_NAME())
|
||||
AND table_name IN
|
||||
<foreach collection="tableNames" item="tableName" open="(" separator="," close=")">
|
||||
#{tableName}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getAllExistTables" resultType="java.lang.String" databaseId="postgresql">
|
||||
SELECT tablename
|
||||
FROM pg_tables
|
||||
WHERE tableowner = (select current_user)
|
||||
AND tablename IN
|
||||
<foreach collection="tableNames" item="tableName" open="(" separator="," close=")">
|
||||
#{tableName}
|
||||
</foreach>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,45 @@
|
||||
package com.engine.salary.mapper.elog;
|
||||
|
||||
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.elog.entity.dto.LoggerDetailContext;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: LocalElogAopDaoMapper
|
||||
* @Description 本地操作日志持久层
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/24 9:35
|
||||
*/
|
||||
public interface LocalElogAopDaoMapper {
|
||||
|
||||
int insertElogContext(@Param(value="logContent") LoggerContext loggerContext,
|
||||
@Param(value="cusColumns")String cusColumns ,
|
||||
@Param(value="cusValus")String cusValus,
|
||||
@Param(value="tableName")String tableName);
|
||||
|
||||
|
||||
|
||||
int insertElogDetail(@Param(value="detailContext") LoggerDetailContext loggerDetailContext,
|
||||
@Param(value="mainid")String mainid,
|
||||
@Param(value="cusColumns")String cusColumns ,
|
||||
@Param(value="cusValus")String cusValus,
|
||||
@Param(value="detailTableName")String tableName);
|
||||
|
||||
|
||||
Integer queryElogContextById(@Param(value="id")Long id,
|
||||
@Param(value="tableName")String tableName);
|
||||
|
||||
void batchInsertDetail(@Param("sql") String sql);
|
||||
|
||||
void insertElogDetailPrepared(@Param("tablename") String detailTableName, @Param("list") List<LoggerDetailContext> detailContexts, @Param("mainid") String mainid);
|
||||
|
||||
void insertElogDetailPreparedHasCustonInfo(@Param("tablename") String detailTableName, @Param("list") List<LoggerDetailContext> detailContexts, @Param("mainid") String mainid, @Param(value="cusColumns")String cusColumns);
|
||||
|
||||
void rollBackElogById(@Param("id") Long id,@Param("tableName") String tableName);
|
||||
|
||||
void rollBackDetailElogByUUID(@Param("mainid") String uuid,@Param("tableName") String detailTableName);
|
||||
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.engine.salary.mapper.elog.LocalElogAopDaoMapper">
|
||||
|
||||
<insert id="insertElogContext">
|
||||
insert into ${tableName} (id, uuid, log_date, tenant_key, modulename, functionName, operatetypename,
|
||||
log_operator, operatorname, targetid, targetname, interfacename, operatetype,
|
||||
operatedesc,
|
||||
params, clientIp, groupnamelabel, redoservice, redocontext, cancelservice,
|
||||
cancelcontext, device, groupid,
|
||||
belongMainId, requestUrl, requestUri, totalRunTime, mainRunTime, log_result,
|
||||
fromTerminal, resultDesc, old_content,
|
||||
link_type, link_id, old_link_id, create_time, update_time, delete_type, creator
|
||||
${cusColumns})
|
||||
values (#{logContent.id}, #{logContent.uuid}, #{logContent.date},
|
||||
#{logContent.tenant_key}, #{logContent.moduleName}, #{logContent.functionName},
|
||||
#{logContent.operateTypeName}, #{logContent.logOperator}, #{logContent.operatorName},
|
||||
#{logContent.logTargetid}
|
||||
, #{logContent.targetName}, #{logContent.interfaceName}, #{logContent.operateType},
|
||||
#{logContent.operatedesc},
|
||||
#{logContent.paramsStr}, #{logContent.clientIp}, #{logContent.groupNameLabel},
|
||||
#{logContent.redoService},
|
||||
#{logContent.redoContextStr}, #{logContent.cancelService}, #{logContent.cancelContextStr},
|
||||
#{logContent.device}, #{logContent.groupId},
|
||||
#{logContent.belongMainId}, #{logContent.requestUrl}, #{logContent.requestUri},
|
||||
#{logContent.totalRunTime}, #{logContent.mainRunTime}
|
||||
, #{logContent.result}, #{logContent.fromTerminal}, #{logContent.resultDesc},
|
||||
#{logContent.old_content}, #{logContent.link_type}
|
||||
, #{logContent.link_id}, #{logContent.old_link_id}, #{logContent.create_time},
|
||||
#{logContent.update_time}, #{logContent.delete_type}, #{logContent.logOperator}
|
||||
${cusValus})
|
||||
</insert>
|
||||
|
||||
<insert id="insertElogDetail">
|
||||
insert into ${detailTableName} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key, creator,
|
||||
newRealValue, oldRealValue, tableNameDesc,
|
||||
tableNameLabelId, fieldNameLabelId, create_time, update_time
|
||||
${cusColumns})
|
||||
values (#{detailContext.id}, #{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder},
|
||||
#{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail}, #{detailContext.tenant_key},
|
||||
#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}, #{detailContext.create_time}, #{detailContext.update_time}
|
||||
${cusValus})
|
||||
</insert>
|
||||
<insert id="batchInsertDetail">
|
||||
${sql}
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="queryElogContextById" resultType="java.lang.Integer">
|
||||
select 1
|
||||
from ${tableName}
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insertElogDetailPrepared">
|
||||
insert into ${tablename} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key,creator, newRealValue,
|
||||
oldRealValue,tableNameDesc,
|
||||
tableNameLabelId,fieldNameLabelId, create_time, update_time,delete_type)
|
||||
values
|
||||
<foreach collection="list" item="detailContext" separator=",">
|
||||
( #{detailContext.id},#{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder}, #{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail},
|
||||
#{detailContext.tenant_key},#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}
|
||||
, #{detailContext.create_time}, #{detailContext.update_time}, #{detailContext.delete_type})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertElogDetailPrepared" databaseId="sqlserver">
|
||||
<foreach collection="list" item="detailContext" separator=";">
|
||||
insert into ${tablename} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key,creator, newRealValue,
|
||||
oldRealValue,tableNameDesc,
|
||||
tableNameLabelId,fieldNameLabelId, create_time, update_time,delete_type)
|
||||
VALUES
|
||||
(
|
||||
#{detailContext.id},#{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder}, #{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail},
|
||||
#{detailContext.tenant_key},#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}
|
||||
, #{detailContext.create_time}, #{detailContext.update_time}, #{detailContext.delete_type}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertElogDetailPreparedHasCustonInfo">
|
||||
insert into ${tablename} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key,creator, newRealValue,
|
||||
oldRealValue,tableNameDesc,
|
||||
tableNameLabelId,fieldNameLabelId, create_time, update_time
|
||||
${cusColumns})
|
||||
values
|
||||
<foreach collection="list" item="detailContext" separator=",">
|
||||
( #{detailContext.id},#{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder}, #{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail},
|
||||
#{detailContext.tenant_key},#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}
|
||||
, #{detailContext.create_time}, #{detailContext.update_time}
|
||||
${detailContext.cusValus})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="rollBackElogById">
|
||||
update ${tableName}
|
||||
set delete_type = 3
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="rollBackDetailElogByUUID">
|
||||
update ${tableName}
|
||||
set delete_type = 3
|
||||
where mainid = #{mainid}
|
||||
</update>
|
||||
|
||||
<insert id="insertElogDetailPrepared" databaseId="oracle">
|
||||
insert into ${tablename} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key,creator, newRealValue,
|
||||
oldRealValue,tableNameDesc,
|
||||
tableNameLabelId,fieldNameLabelId, create_time, update_time,delete_type)
|
||||
<foreach collection="list" item="detailContext" separator=" union all ">
|
||||
SELECT #{detailContext.id},#{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder}, #{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail},
|
||||
#{detailContext.tenant_key},#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}
|
||||
, #{detailContext.create_time}, #{detailContext.update_time}, #{detailContext.delete_type}
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertElogDetailPreparedHasCustonInfo" databaseId="oracle">
|
||||
insert into ${tablename} (id, mainid, uuid, tablename, fieldname, newvalue, oldvalue,
|
||||
fielddesc, showorder, dataid, belongDataid, isDetail, tenant_key,creator, newRealValue,
|
||||
oldRealValue,tableNameDesc,
|
||||
tableNameLabelId,fieldNameLabelId, create_time, update_time
|
||||
${cusColumns})
|
||||
<foreach collection="list" item="detailContext" separator=" union all ">
|
||||
SELECT #{detailContext.id},#{mainid}, #{detailContext.uuid}, #{detailContext.tableName},
|
||||
#{detailContext.fieldName}, #{detailContext.newValue},
|
||||
#{detailContext.oldValue}, #{detailContext.fieldDesc}, #{detailContext.showorder}, #{detailContext.dataid},
|
||||
#{detailContext.belongDataid}, #{detailContext.isDetail},
|
||||
#{detailContext.tenant_key},#{detailContext.creator}, #{detailContext.newRealValue}
|
||||
, #{detailContext.oldRealValue}, #{detailContext.tableNameDesc}, #{detailContext.tableNameLabelId},
|
||||
#{detailContext.fieldNameLabelId}
|
||||
, #{detailContext.create_time}, #{detailContext.update_time}
|
||||
${detailContext.cusValus}
|
||||
FROM DUAL
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,219 @@
|
||||
package com.engine.salary.mapper.elog;
|
||||
|
||||
import com.engine.salary.elog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.elog.entity.dto.ReadInfoEntity;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: LocalElogDao
|
||||
* @Description 本地操作日志持久层
|
||||
* @Author tanghj
|
||||
* @Date 2021/2/24 9:35
|
||||
*/
|
||||
public interface LocalElogDaoMapper {
|
||||
|
||||
|
||||
List<Map<String, Object>> queryCardElogList(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql);
|
||||
|
||||
List<Map> queryElogList(@Param(value = "page") Page page,
|
||||
@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "columns") String columns);
|
||||
|
||||
List<Map> queryElogListPapi(@Param(value = "page") Page page,
|
||||
@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "columns") String columns);
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionTargetId = "#{permissionTargetId}",
|
||||
// permissionConfigSourceId = "#{permissionConfigSourceId}",
|
||||
// permissionExcept = "true")
|
||||
List<Map> queryElogList(@Param(value = "page") Page page, @Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey,
|
||||
@Param(value = "permissionTargetId") String permissionTargetId,
|
||||
@Param(value = "permissionConfigSourceId") String permissionConfigSourceId,
|
||||
@Param(value = "columns") String columns
|
||||
);
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionExcept = "true")
|
||||
List<Map> queryElogListPapi(@Param(value = "page") Page page, @Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey,
|
||||
@Param(value = "columns") String columns
|
||||
);
|
||||
|
||||
List<Map> queryAllChanges(@Param(value = "tableName") String tableName, @Param("mainid") String mainid);
|
||||
|
||||
Map<String, Object> elogCount(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql);
|
||||
|
||||
Map<String, Object> elogCountPapi(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql);
|
||||
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionTargetId = "#{permissionTargetId}",
|
||||
// permissionConfigSourceId = "#{permissionConfigSourceId}",
|
||||
// permissionExcept = "true")
|
||||
Map<String, Object> elogCountByMorePermission(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey,
|
||||
@Param(value = "permissionTargetId") String permissionTargetId,
|
||||
@Param(value = "permissionConfigSourceId") String permissionConfigSourceId);
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionTargetId = "#{permissionTargetId}",
|
||||
// permissionConfigSourceId = "#{permissionConfigSourceId}",
|
||||
// permissionCount = "count(*)",
|
||||
// permissionExcept = "true")
|
||||
Long elogCountOnlyNum(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey,
|
||||
@Param(value = "permissionTargetId") String permissionTargetId,
|
||||
@Param(value = "permissionConfigSourceId") String permissionConfigSourceId);
|
||||
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionExcept = "true")
|
||||
Map<String, Object> elogCount(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey);
|
||||
|
||||
// @WeaDataPermission(mainDataTable = "#{mainDataTable}",
|
||||
// permissionId = "#{permissionId}",
|
||||
// permissionType = "#{permissionType}",
|
||||
// mainDataTableAlias = "#{mainDataTableAlias}",
|
||||
// primaryKey = "#{primaryKey}",
|
||||
// permissionExcept = "true")
|
||||
Map<String, Object> elogCountPapi(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql,
|
||||
@Param(value = "mainDataTable") String mainDataTable,
|
||||
@Param(value = "permissionId") String permissionId,
|
||||
@Param(value = "permissionType") String permissionType,
|
||||
@Param(value = "mainDataTableAlias") String mainDataTableAlias,
|
||||
@Param(value = "primaryKey") String primaryKey);
|
||||
|
||||
|
||||
List<Map> queryDetailElogList(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param("limit") String limit,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql);
|
||||
|
||||
Map<String, Object> elogDetailCount(@Param(value = "logContent") LoggerContext loggerContext,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "conditionSql") String conditionSql);
|
||||
|
||||
// List<SimpleEmployee> queryOperators(@Param(value = "tableName") String tableName,
|
||||
// @Param(value = "targetId") String targetId,
|
||||
// @Param(value = "operateType") String operateType);
|
||||
|
||||
List<ReadInfoEntity> queryReadInfoOperators(@Param(value = "tableName") String tableName,
|
||||
@Param(value = "targetId") String targetId,
|
||||
@Param(value = "operateType") String operateType,
|
||||
@Param(value = "flag") Boolean flag);
|
||||
|
||||
List<ReadInfoEntity> queryReadInfoDateOperators(@Param(value = "tableName") String tableName,
|
||||
@Param(value = "targetId") String targetId,
|
||||
@Param(value = "operateType") String operateType,
|
||||
@Param(value = "flag") Boolean flag,
|
||||
@Param(value = "startDate") String startDate,
|
||||
@Param(value = "endDate") String endDate);
|
||||
|
||||
List<Map> queryAllMainData(@Param(value = "tableName") String tableName, @Param("uuid") String uuid);
|
||||
|
||||
List<Map> queryAllMainChanges(@Param(value = "tableName") String tableName, @Param("mainid") String mainid);
|
||||
|
||||
List<Map> queryAllDetailChanges(@Param(value = "tableName") String tableName, @Param("mainid") String mainid);
|
||||
|
||||
Integer queryElogContextById(@Param(value = "id") Long id,
|
||||
@Param(value = "tableName") String tableName);
|
||||
|
||||
List<Map> queryElogTraceInfo(@Param(value = "traceId") String traceId,
|
||||
@Param(value = "tableName") String tableName,
|
||||
@Param(value = "offset") Integer offset,
|
||||
@Param(value = "pageSize") Integer pageSize);
|
||||
|
||||
int queryElogTraceInfoCount(@Param(value = "traceId") String traceId,
|
||||
@Param(value = "tableName") String tableName);
|
||||
|
||||
List queryLogInfoByCustom(@Param(value = "tableName") String tableName,
|
||||
@Param(value = "sql") String sql);
|
||||
|
||||
List queryAllChangesData(@Param("tableName") String tableName, @Param("mainid") String mainid);
|
||||
|
||||
List<ReadInfoEntity> queryTenantKeyOperators(@Param(value = "tableName") String tableName,
|
||||
@Param(value = "tenantKey") String tenantKey,
|
||||
@Param(value = "targetId") String targetId,
|
||||
@Param(value = "operateType") String operateType,
|
||||
@Param(value = "flag") Boolean flag);
|
||||
|
||||
List<Map> queryAllChangesDataPages(@Param("tableName") String tableName,
|
||||
@Param("mainid") String mainid,
|
||||
@Param(value = "page") Page page);
|
||||
|
||||
Integer queryAllChangesPageCounts(@Param("tableName") String tableName, @Param("mainid") String mainid);
|
||||
}
|
@ -0,0 +1,412 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.engine.salary.mapper.elog.LocalElogDaoMapper">
|
||||
<select id="queryElogList" resultType="java.util.Map">
|
||||
select ${columns},DATE_FORMAT(log_date,"%Y-%m-%d %H:%i:%S") createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
and delete_type = 0
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogList" resultType="java.util.Map" databaseId="postgresql">
|
||||
select ${columns},to_char(log_date::timestamp,'YYYY-MM-DD HH24:MI:SS') createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogList" resultType="java.util.Map" databaseId="oracle">
|
||||
select d.*,to_char(d.log_date,'yyyy-mm-dd HH24:mi:ss') createdate from ${tableName} d
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by d.log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogList" resultType="java.util.Map" databaseId="sqlserver">
|
||||
select ${columns},convert(nvarchar(19),log_date,120) createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
|
||||
<select id="queryElogListPapi" resultType="java.util.Map">
|
||||
select ${columns},DATE_FORMAT(log_date,"%Y-%m-%d %H:%i:%S") createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
and delete_type = 0
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogListPapi" resultType="java.util.Map" databaseId="postgresql">
|
||||
select ${columns},to_char(log_date::timestamp,'YYYY-MM-DD HH24:MI:SS') createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogListPapi" resultType="java.util.Map" databaseId="oracle">
|
||||
select d.*,to_char(d.log_date,'yyyy-mm-dd HH24:mi:ss') createdate from ${tableName} d
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by d.log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryElogListPapi" resultType="java.util.Map" databaseId="sqlserver">
|
||||
select ${columns},convert(nvarchar(19),log_date,120) createdate from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
|
||||
<select id="queryCardElogList" resultType="java.util.Map">
|
||||
select ${columns}, DATE_FORMAT(log_date,"%Y-%m-%d %H:%i:%S") createdate,
|
||||
uuid from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryCardElogList" resultType="java.util.Map" databaseId="postgresql">
|
||||
select ${columns}, to_char(log_date::timestamp,'YYYY-MM-DD HH24:MI:SS') createdate,
|
||||
uuid from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryCardElogList" resultType="java.util.Map" databaseId="oracle">
|
||||
select ${columns}, to_char(log_date,'yyyy-mm-dd HH24:mi:ss') createdate,
|
||||
uuid from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryCardElogList" resultType="java.util.Map" databaseId="sqlserver">
|
||||
select ${columns}, convert(nvarchar(19),log_date,120) createdate,
|
||||
uuid from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="elogCountByMorePermission" resultType="java.util.Map">
|
||||
select count(1) counts from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
</select>
|
||||
|
||||
<select id="elogCount" resultType="java.util.Map">
|
||||
select count(1) counts from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
|
||||
<if test="logContent.operator != null and logContent.operator !=''">
|
||||
and log_operator = #{logContent.operator}
|
||||
</if>
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
</select>
|
||||
|
||||
<select id="elogCountPapi" resultType="java.util.Map">
|
||||
select count(1) counts from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
and delete_type = 0
|
||||
<if test="logContent.operator != null and logContent.operator !=''">
|
||||
and log_operator = #{logContent.operator}
|
||||
</if>
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryDetailElogList" resultType="java.util.Map">
|
||||
select *,DATE_FORMAT(create_time,"%Y-%m-%d %H:%i:%S") createdate from ${tableName}
|
||||
where mainid = #{logContent.uuid}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryDetailElogList" resultType="java.util.Map" databaseId="postgresql">
|
||||
select *,to_char(create_time::timestamp,'YYYY-MM-DD HH24:MI:SS') createdate from ${tableName}
|
||||
where mainid = #{logContent.uuid}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryDetailElogList" resultType="java.util.Map" databaseId="oracle">
|
||||
select *,to_char(create_time,'yyyy-mm-dd HH24:mi:ss') createdate from ${tableName}
|
||||
where mainid = #{logContent.uuid}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
<select id="queryDetailElogList" resultType="java.util.Map" databaseId="sqlserver">
|
||||
select *,convert(nvarchar(19),create_time,120) createdate from ${tableName}
|
||||
where mainid = #{logContent.uuid}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
order by log_date desc ,id desc
|
||||
</select>
|
||||
|
||||
<select id="queryAllChanges" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
</select>
|
||||
|
||||
<select id="queryAllMainData" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where uuid = #{uuid}
|
||||
</select>
|
||||
|
||||
<select id="queryAllMainChanges" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
and isdetail = '0'
|
||||
</select>
|
||||
|
||||
<select id="queryAllDetailChanges" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
and isdetail = '1'
|
||||
</select>
|
||||
|
||||
<select id="elogDetailCount" resultType="java.util.Map">
|
||||
select count(1) counts from ${tableName}
|
||||
where mainid = #{logContent.uuid}
|
||||
|
||||
<if test="conditionSql != null">#{conditionSql}</if>
|
||||
</select>
|
||||
|
||||
<!-- <select id="queryOperators" resultType="com.weaver.teams.domain.user.SimpleEmployee">-->
|
||||
<!-- select log_operator id, max(log_date) updateTime-->
|
||||
<!-- from ${tableName}-->
|
||||
<!-- where targetid = #{targetId}-->
|
||||
<!-- and operatetype = #{operateType}-->
|
||||
<!-- group by log_operator-->
|
||||
<!-- order by updateTime desc-->
|
||||
<!-- </select>-->
|
||||
<select id="queryReadInfoOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity">
|
||||
select log_operator employeeId, max(log_date) date
|
||||
from ${tableName}
|
||||
where targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by log_date desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="postgresql">
|
||||
select log_operator employeeId, max(log_date) date
|
||||
from ${tableName}
|
||||
where targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by date desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="oracle">
|
||||
select log_operator employeeId, max(log_date) "date"
|
||||
from ${tableName}
|
||||
where targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by "date" desc
|
||||
</select>
|
||||
<select id="queryReadInfoOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="sqlserver">
|
||||
select log_operator employeeId, max(log_date) "date"
|
||||
from ${tableName}
|
||||
where targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by "date" desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoDateOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity">
|
||||
select log_operator employeeId, max(log_date) date from ${tableName} where targetid = #{targetId} and
|
||||
operatetype = #{operateType}
|
||||
<if test="startDate != null">
|
||||
AND log_date <![CDATA[ >= ]]> #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND log_date <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
group by log_operator order by log_date desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoDateOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity"
|
||||
databaseId="postgresql">
|
||||
select log_operator employeeId, max(log_date) date from ${tableName} where targetid = #{targetId} and
|
||||
operatetype = #{operateType}
|
||||
<if test="startDate != null">
|
||||
AND log_date <![CDATA[ >= ]]> #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND log_date <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
group by log_operator order by date desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoDateOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="oracle">
|
||||
select log_operator employeeId, max(log_date) "date" from ${tableName} where targetid = #{targetId} and
|
||||
operatetype = #{operateType}
|
||||
<if test="startDate != null">
|
||||
AND log_date <![CDATA[ >= ]]> TO_DATE(#{startDate}, 'SYYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND log_date <![CDATA[ <= ]]> TO_DATE(#{endDate}, 'SYYYY-MM-DD HH24:MI:SS')
|
||||
</if>
|
||||
group by log_operator order by "date" desc
|
||||
</select>
|
||||
|
||||
<select id="queryReadInfoDateOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity"
|
||||
databaseId="sqlserver">
|
||||
select log_operator employeeId, max(log_date) "date" from ${tableName} where targetid = #{targetId} and
|
||||
operatetype = #{operateType}
|
||||
<if test="startDate != null">
|
||||
AND log_date <![CDATA[ >= ]]> #{startDate}
|
||||
</if>
|
||||
<if test="endDate != null">
|
||||
AND log_date <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
group by log_operator order by "date" desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryElogContextById" resultType="java.lang.Integer">
|
||||
select 1
|
||||
from ${tableName}
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="queryElogTraceInfo" resultType="java.util.Map">
|
||||
select operatorname,
|
||||
targetname,
|
||||
modulename,
|
||||
operatetypename,
|
||||
DATE_FORMAT(log_date, "%Y-%m-%d %H:%i:%S") createdate
|
||||
from ${tableName}
|
||||
where belongmainid = #{traceId}
|
||||
order by log_date desc, id desc LIMIT #{offset}, #{pageSize}
|
||||
</select>
|
||||
<select id="queryElogTraceInfo" resultType="java.util.Map" databaseId="postgresql">
|
||||
select operatorname,
|
||||
targetname,
|
||||
modulename,
|
||||
operatetypename,
|
||||
to_char(log_date::timestamp, 'YYYY-MM-DD HH24:MI:SS') createdate
|
||||
from ${tableName}
|
||||
where belongmainid = #{traceId}
|
||||
order by log_date desc, id desc limit #{pageSize}
|
||||
offset #{offset}
|
||||
|
||||
</select>
|
||||
<select id="queryElogTraceInfo" resultType="java.util.Map" databaseId="oracle">
|
||||
SELECT operatorname, targetname, modulename, operatetypename
|
||||
FROM (SELECT TMP.*, ROWNUM ROW_ID
|
||||
FROM (select t.*, to_char(log_date, 'yyyy-mm-dd HH24:mi:ss') createdate
|
||||
from ${tableName} t
|
||||
where belongmainid = #{traceId}
|
||||
order by log_date desc, id desc) TMP
|
||||
WHERE ROWNUM <= (#{pageSize} + #{offset}))
|
||||
WHERE ROW_ID > #{offset}
|
||||
|
||||
|
||||
</select>
|
||||
<select id="queryElogTraceInfo" resultType="java.util.Map" databaseId="sqlserver">
|
||||
select atmp.operatorname, atmp.targetname, atmp.modulename, atmp.operatetypename
|
||||
from (select atmp.*, row_number() over(order by log_date desc ,id desc ) as rownumber
|
||||
from (select top(#{pageSize}) atmp.*
|
||||
from (select *, convert(nvarchar(19), log_date, 120) createdate
|
||||
from ${tableName}
|
||||
where belongmainid = #{traceId}) atmp
|
||||
order by log_date desc, id desc) atmp) atmp
|
||||
where rownumber > #{offset}
|
||||
order by log_date desc, id desc
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="queryElogTraceInfoCount" resultType="java.lang.Integer">
|
||||
select count(id) id
|
||||
from ${tableName}
|
||||
where belongmainid = #{traceId}
|
||||
</select>
|
||||
|
||||
<select id="queryLogInfoByCustom" resultType="java.util.Map">
|
||||
select * from ${tableName}
|
||||
<where>${sql}</where>
|
||||
</select>
|
||||
|
||||
<select id="queryAllChangesData" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
order by showorder asc, id asc
|
||||
</select>
|
||||
|
||||
<select id="queryTenantKeyOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity">
|
||||
select log_operator employeeId, max(log_date) date
|
||||
from ${tableName}
|
||||
where tenant_key = #{tenantKey}
|
||||
and targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by date desc
|
||||
</select>
|
||||
|
||||
<select id="queryTenantKeyOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="postgresql">
|
||||
select log_operator employeeId, max(log_date) date
|
||||
from ${tableName}
|
||||
where tenant_key = #{tenantKey}
|
||||
and targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by date desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryTenantKeyOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="oracle">
|
||||
select log_operator employeeId, max(log_date) "date"
|
||||
from ${tableName}
|
||||
where tenant_key = #{tenantKey}
|
||||
and targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by "date" desc
|
||||
</select>
|
||||
<select id="queryTenantKeyOperators" resultType="com.engine.salary.elog.entity.dto.ReadInfoEntity" databaseId="sqlserver">
|
||||
select log_operator employeeId, max(log_date) "date"
|
||||
from ${tableName}
|
||||
where tenant_key = #{tenantKey}
|
||||
and targetid = #{targetId}
|
||||
and operatetype = #{operateType}
|
||||
group by log_operator
|
||||
order by "date" desc
|
||||
</select>
|
||||
|
||||
<select id="queryAllChangesDataPages" resultType="java.util.Map">
|
||||
select *
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
order by showorder asc, id asc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="queryAllChangesPageCounts" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from ${tableName}
|
||||
where mainid = #{mainid}
|
||||
</select>
|
||||
<select id="elogCountOnlyNum" resultType="java.lang.Long">
|
||||
select count(*) from ${tableName}
|
||||
where modulename = #{logContent.moduleName} and functionname = #{logContent.functionName}
|
||||
and delete_type = 0
|
||||
<if test="logContent.operator != null and logContent.operator !=''">
|
||||
and log_operator = #{logContent.operator}
|
||||
</if>
|
||||
<if test="conditionSql != null">${conditionSql}</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,8 @@
|
||||
package com.engine.salary.mapper.elog;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface QueryCurretValusMapper {
|
||||
|
||||
Map queryValues(String sql);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.engine.salary.mapper.elog.QueryCurretValusMapper">
|
||||
|
||||
<select id="queryValues" resultType="java.util.Map">
|
||||
${querySql} limit 1
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue