비즈니스로그 조회 수정

This commit is contained in:
2025-04-09 15:48:58 +09:00
parent a50f703eb0
commit 2c719227b4
4 changed files with 38 additions and 8 deletions

View File

@@ -0,0 +1,11 @@
package com.caliverse.admin.domain.entity;
public enum EInputType {
None,
String,
Number,
Boolean,
Null
;
}

View File

@@ -1,5 +1,6 @@
package com.caliverse.admin.domain.request;
import com.caliverse.admin.domain.entity.EInputType;
import com.caliverse.admin.domain.entity.common.SearchUserType;
import com.caliverse.admin.logs.entity.LogAction;
import com.caliverse.admin.logs.entity.LogDomain;
@@ -10,6 +11,8 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
@Data
@Builder
@@ -24,6 +27,7 @@ public class LogGenericRequest {
private LogAction logAction;
@JsonProperty("log_domain")
private LogDomain logDomain;
private List<LogFilter> filters;
@JsonProperty("tran_id")
private String tranId;
@JsonProperty("start_dt")
@@ -36,4 +40,13 @@ public class LogGenericRequest {
private Integer pageSize;
@JsonProperty("order_by")
private String orderBy;
@Data
public static class LogFilter{
@JsonProperty("field_name")
private String fieldName;
@JsonProperty("field_type")
private EInputType fieldType;
private String value;
}
}

View File

@@ -74,17 +74,11 @@ public class LogService {
}
int totalItems = logList.size();
int totalPages = (int) Math.ceil((double) totalItems / size);
page = (totalItems > 0 && page > totalPages) ? totalPages : page;
List<GenericMongoLog> pagedList = (totalItems == 0) ?
new ArrayList<>() :
logList.subList((page - 1) * size, Math.min((page - 1) * size + size, totalItems));
return LogResponse.builder()
.resultData(LogResponse.ResultData.builder()
.genericList(pagedList)
.total(pagedList.size())
.genericList(logList)
.total(totalItems)
.totalAll(totalItems)
.pageNo(logGenericRequest.getPageNo() != null ?
page : 1)

View File

@@ -371,4 +371,16 @@ public class CommonUtils {
LocalDate localDate = date.minusMonths(1);
return localDate.lengthOfMonth();
}
public static String formatValueForRegex(Object value) {
if (value == null) {
return "null";
} else if (value instanceof String) {
return "\"" + value.toString().replace("\"", "\\\"") + "\"";
} else if (value instanceof Boolean || value instanceof Number) {
return value.toString();
} else {
return "\"" + value.toString().replace("\"", "\\\"") + "\"";
}
}
}