This commit is contained in:
wangyu 2021-01-14 16:04:49 +08:00
parent 0a79d57337
commit 75792a3903
4 changed files with 45 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package com.flyfish.framework.logging.config;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.InitializingBean;
import java.util.HashMap;
import java.util.List;
@ -11,8 +12,7 @@ import java.util.Map;
*
* @author wangyu
*/
@RequiredArgsConstructor
public class LoggingTextRegistry {
public class LoggingTextRegistry implements InitializingBean {
// 映射
private final Map<String, String> mapping = new HashMap<>();
@ -20,7 +20,21 @@ public class LoggingTextRegistry {
// 自定义处理
private final List<LoggingTextModifier> modifiers;
public LoggingTextRegistry(List<LoggingTextModifier> modifiers) {
this.modifiers = modifiers;
this.mapping.put("CREATE", "新增");
this.mapping.put("UPDATE", "更新");
this.mapping.put("UPDATE_ALL", "更新全部");
this.mapping.put("DELETE", "删除");
this.mapping.put("SYNC", "同步");
}
public String text(String code) {
return mapping.getOrDefault(code, code);
}
@Override
public void afterPropertiesSet() {
modifiers.forEach(modifier -> modifier.modify(mapping));
}
}

View File

@ -13,5 +13,4 @@ import com.flyfish.framework.logging.domain.LogQo;
@RestMapping("logs")
public class LogController extends BaseController<Log, LogQo> {
}

View File

@ -1,10 +1,34 @@
package com.flyfish.framework.logging.domain;
import com.flyfish.framework.domain.base.NameLikeQo;
import com.flyfish.framework.builder.CriteriaBuilder;
import com.flyfish.framework.domain.base.BaseQo;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* 日志查询实体
*
* @author wangyu
*/
public class LogQo extends NameLikeQo<Log> {
@Getter
@Setter
public class LogQo extends BaseQo<Log> {
private String operator;
private String module;
private Boolean success;
private List<String> range;
@Override
public CriteriaBuilder<Log> criteriaBuilder() {
return super.criteriaBuilder()
.with("operator", CriteriaBuilder.Builders.LIKE)
.with("module", "success")
.with("range", "startTime", CriteriaBuilder.Builders.DATE_RANGE);
}
}

View File

@ -23,11 +23,13 @@ public class PermissionQo extends TreeQo<Permission> {
private String parentId;
private String type;
private List<String> parentIds;
@Override
public CriteriaBuilder<Permission> criteriaBuilder() {
return super.criteriaBuilder().with("admin", "parentId")
return super.criteriaBuilder().with("admin", "parentId", "type")
.with("parentIds", "parentId", CriteriaBuilder.Builders.IN);
}
}