영문 Enum 항목값 내릴 수 있도록 수정 Accept-Language: en 으로 추가하여 호출해야 함.
This commit is contained in:
@@ -35,6 +35,11 @@ public class ChangeDetectionDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@CodeExpose
|
||||
@@ -55,6 +60,11 @@ public class ChangeDetectionDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "TestDto", description = "테스트용")
|
||||
|
||||
@@ -324,21 +324,4 @@ public class CommonCodeApiController {
|
||||
public ApiResponseDto<List<CodeDto>> getTypeCode(@PathVariable String type) {
|
||||
return ApiResponseDto.ok(commonCodeService.getTypeCode(type));
|
||||
}
|
||||
|
||||
@Operation(summary = "코드 단건 조회", description = "코드 조회")
|
||||
@ApiResponses(
|
||||
value = {
|
||||
@ApiResponse(
|
||||
responseCode = "200",
|
||||
description = "코드 조회 성공",
|
||||
content =
|
||||
@Content(
|
||||
mediaType = "application/json",
|
||||
schema = @Schema(implementation = CodeDto.class))),
|
||||
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
|
||||
})
|
||||
@GetMapping("/type/copy/{type}")
|
||||
public ApiResponseDto<List<CodeDto>> getTypeCodeCopy(@PathVariable String type) {
|
||||
return ApiResponseDto.ok(commonCodeService.getTypeCode(type));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@@ -119,10 +120,12 @@ public class CommonCodeDto {
|
||||
String props2,
|
||||
String props3,
|
||||
ZonedDateTime deletedDttm) {
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
this.id = id;
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
this.name = name;
|
||||
this.name = english ? code : name;
|
||||
this.order = order;
|
||||
this.used = used;
|
||||
this.deleted = deleted;
|
||||
|
||||
@@ -45,4 +45,9 @@ public enum CommonUseStatus implements EnumType {
|
||||
public EnumDto<CommonUseStatus> getEnumDto() {
|
||||
return new EnumDto<>(this, this.id, this.text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,13 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CrsType implements EnumType {
|
||||
EPSG_3857("Web Mercator, 웹지도 미터(EPSG:900913 동일)"),
|
||||
EPSG_4326("WGS84 위경도, GeoJSON/OSM 기본"),
|
||||
EPSG_5186("5186::Korea 2000 중부 TM, 한국 SHP"),
|
||||
EPSG_5179("5179::Korea 2000 중부 TM, 한국 SHP");
|
||||
EPSG_3857("Web Mercator, 웹지도 미터(EPSG:900913 동일)", "Web Mercator"),
|
||||
EPSG_4326("WGS84 위경도, GeoJSON/OSM 기본", "GeoJSON/OSM"),
|
||||
EPSG_5186("5186::Korea 2000 중부 TM, 한국 SHP", "5186::Korea 2000"),
|
||||
EPSG_5179("5179::Korea 2000 중부 TM, 한국 SHP", "5179::Korea 2000");
|
||||
|
||||
private final String desc;
|
||||
private final String descEn;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
@@ -25,4 +26,9 @@ public enum CrsType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return descEn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,14 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FileUploadStatus implements EnumType {
|
||||
INIT("초기화"),
|
||||
UPLOADING("업로드중"),
|
||||
DONE("업로드완료"),
|
||||
MERGED("병합완료"),
|
||||
MERGE_FAIL("병합 실패");
|
||||
INIT("초기화", "Init"),
|
||||
UPLOADING("업로드중", "Uploading"),
|
||||
DONE("업로드완료", "Upload Done"),
|
||||
MERGED("병합완료", "Merged Done"),
|
||||
MERGE_FAIL("병합 실패", "Merge Failed");
|
||||
|
||||
private final String desc;
|
||||
private final String descEn;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
@@ -26,4 +27,9 @@ public enum FileUploadStatus implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return descEn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ public enum ImageryFitStatus implements EnumType {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
|
||||
public static ImageryFitStatus fromCode(String code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
|
||||
@@ -10,14 +10,15 @@ import lombok.Getter;
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum LayerType implements EnumType {
|
||||
TILE("배경지도"),
|
||||
GEOJSON("객체데이터"),
|
||||
WMTS("타일레이어"),
|
||||
WMS("지적도"),
|
||||
KAMCO_WMS("국유인WMS"),
|
||||
KAMCO_WMTS("국유인WMTS");
|
||||
TILE("배경지도", "Tile"),
|
||||
GEOJSON("객체데이터", "GeoJSON"),
|
||||
WMTS("타일레이어", "WMTS"),
|
||||
WMS("지적도", "WMS"),
|
||||
KAMCO_WMS("국유인WMS", "KAMCO_WMS"),
|
||||
KAMCO_WMTS("국유인WMTS", "KAMCO_WMTS");
|
||||
|
||||
private final String desc;
|
||||
private final String descEn;
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
@@ -29,6 +30,11 @@ public enum LayerType implements EnumType {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return descEn;
|
||||
}
|
||||
|
||||
public static Optional<LayerType> from(String type) {
|
||||
try {
|
||||
return Optional.of(LayerType.valueOf(type));
|
||||
|
||||
@@ -24,4 +24,9 @@ public enum RoleType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,4 +24,9 @@ public enum StatusType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,4 +23,9 @@ public enum SyncCheckStateType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,4 +30,9 @@ public enum SyncStateType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,6 @@ public interface EnumType {
|
||||
String getId();
|
||||
|
||||
String getText();
|
||||
|
||||
String getTextEn();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.reflections.Reflections;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
public class Enums {
|
||||
|
||||
@@ -32,11 +33,13 @@ public class Enums {
|
||||
// enum -> CodeDto list
|
||||
public static List<CodeDto> toList(Class<? extends Enum<?>> enumClass) {
|
||||
Object[] enums = enumClass.getEnumConstants();
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
|
||||
return Arrays.stream(enums)
|
||||
.map(e -> (EnumType) e)
|
||||
.filter(e -> !isHidden(enumClass, (Enum<?>) e))
|
||||
.map(e -> new CodeDto(e.getId(), e.getText()))
|
||||
.map(e -> new CodeDto(e.getId(), english ? e.getTextEn() : e.getText()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
||||
@@ -192,6 +192,11 @@ public class ApiResponseDto<T> {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public static ApiResponseCode getCode(String name) {
|
||||
return ApiResponseCode.valueOf(name.toUpperCase());
|
||||
}
|
||||
|
||||
@@ -29,6 +29,11 @@ public class GukYuinDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -26,4 +26,9 @@ public enum GukYuinStatus implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,11 @@ public class InferenceResultDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
/** 탐지 데이터 옵션 dto */
|
||||
@@ -79,6 +84,11 @@ public class InferenceResultDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -108,6 +118,11 @@ public class InferenceResultDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -129,6 +144,11 @@ public class InferenceResultDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
/** 목록조회 dto */
|
||||
|
||||
@@ -37,6 +37,11 @@ public class LabelAllocateDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@CodeExpose
|
||||
@@ -59,6 +64,11 @@ public class LabelAllocateDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@CodeExpose
|
||||
@@ -80,6 +90,11 @@ public class LabelAllocateDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -36,6 +36,11 @@ public class ErrorLogDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "ErrorLogBasic", description = "에러로그 기본 정보")
|
||||
|
||||
@@ -21,4 +21,9 @@ public enum EventStatus implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,9 @@ public enum EventType implements EnumType {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,11 @@ public class MapSheetMngDto {
|
||||
public String getText() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return message;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "MngSearchReq", description = "영상관리 검색 요청")
|
||||
@@ -346,6 +351,10 @@ public class MapSheetMngDto {
|
||||
}
|
||||
|
||||
SyncStateType type = Enums.fromId(SyncStateType.class, enumId);
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
if ("en".equalsIgnoreCase(lang)) {
|
||||
return type.getTextEn();
|
||||
}
|
||||
return type.getText();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
@@ -65,16 +66,20 @@ public class MembersDto {
|
||||
|
||||
private String getUserRoleName(String roleId) {
|
||||
RoleType type = Enums.fromId(RoleType.class, roleId);
|
||||
return type.getText();
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
return english ? type.getTextEn() : type.getText();
|
||||
}
|
||||
|
||||
private String getStatusName(String status, Boolean pwdResetYn) {
|
||||
StatusType type = Enums.fromId(StatusType.class, status);
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
pwdResetYn = pwdResetYn != null && pwdResetYn;
|
||||
if (type.equals(StatusType.PENDING) && pwdResetYn) {
|
||||
type = StatusType.ACTIVE;
|
||||
}
|
||||
return type.getText();
|
||||
return english ? type.getTextEn() : type.getText();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ public class ModelMngDto {
|
||||
public String getText() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextEn() {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
|
||||
@Schema(name = "ModelMgmtDto Basic", description = "모델관리 엔티티 기본 정보")
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.kamco.cd.kamcoback.log.dto.EventType;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.AuditLogEntity;
|
||||
import com.kamco.cd.kamcoback.postgres.entity.QMenuEntity;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Expression;
|
||||
import com.querydsl.core.types.Projections;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.CaseBuilder;
|
||||
@@ -26,6 +27,7 @@ import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -83,13 +85,18 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
public Page<AuditLogDto.MenuAuditList> findLogByMenu(
|
||||
AuditLogDto.searchReq searchReq, String searchValue) {
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
|
||||
Expression<String> menuNameExpr =
|
||||
"en".equalsIgnoreCase(lang) ? menuEntity.menuNmEn.max() : menuEntity.menuNm.max();
|
||||
|
||||
List<AuditLogDto.MenuAuditList> foundContent =
|
||||
queryFactory
|
||||
.select(
|
||||
Projections.constructor(
|
||||
AuditLogDto.MenuAuditList.class,
|
||||
auditLogEntity.menuUid.as("menuId"),
|
||||
menuEntity.menuNm.max().as("menuName"),
|
||||
menuNameExpr,
|
||||
readCount().as("readCount"),
|
||||
cudCount().as("cudCount"),
|
||||
printCount().as("printCount"),
|
||||
@@ -217,21 +224,25 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
@Override
|
||||
public Page<AuditLogDto.DailyDetail> findLogByDailyResult(
|
||||
AuditLogDto.searchReq searchReq, LocalDate logDate) {
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
StringExpression parentMenuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(menuEntity.menuNm)
|
||||
.otherwise(parent.menuNm);
|
||||
.then(english ? menuEntity.menuNmEn : menuEntity.menuNm)
|
||||
.otherwise(english ? parent.menuNmEn : parent.menuNm);
|
||||
|
||||
// 2depth menu name
|
||||
StringExpression menuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
.otherwise(english ? menuEntity.menuNmEn : menuEntity.menuNm);
|
||||
|
||||
StringExpression menuNm = (english ? menuEntity.menuNmEn : menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.DailyDetail> foundContent =
|
||||
queryFactory
|
||||
@@ -241,20 +252,20 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
auditLogEntity.id.as("logId"),
|
||||
memberEntity.name.as("userName"),
|
||||
memberEntity.employeeNo.as("loginId"),
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
menuNm.as("menuName"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD HH24:MI')", auditLogEntity.createdDate)
|
||||
.as("logDateTime"),
|
||||
Projections.constructor(
|
||||
AuditLogDto.LogDetail.class,
|
||||
Expressions.constant("한국자산관리공사"), // serviceName
|
||||
Expressions.constant(english ? "Kamco" : "한국자산관리공사"), // serviceName
|
||||
parentMenuName.as("parentMenuName"),
|
||||
menuName,
|
||||
menuEntity.menuUrl.as("menuUrl"),
|
||||
menuEntity.description.as("menuDescription"),
|
||||
menuEntity.menuOrder.as("sortOrder"),
|
||||
menuEntity.isUse.as("used")))) // TODO
|
||||
menuEntity.isUse.as("used"))))
|
||||
.from(auditLogEntity)
|
||||
.leftJoin(menuEntity)
|
||||
.on(auditLogEntity.menuUid.eq(menuEntity.menuUid))
|
||||
@@ -285,21 +296,23 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
@Override
|
||||
public Page<AuditLogDto.MenuDetail> findLogByMenuResult(
|
||||
AuditLogDto.searchReq searchReq, String menuUid) {
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
StringExpression parentMenuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(menuEntity.menuNm)
|
||||
.otherwise(parent.menuNm);
|
||||
.then(english ? menuEntity.menuNmEn : menuEntity.menuNm)
|
||||
.otherwise(english ? parent.menuNmEn : parent.menuNm);
|
||||
|
||||
// 2depth menu name
|
||||
StringExpression menuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
.otherwise(english ? menuEntity.menuNmEn : menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.MenuDetail> foundContent =
|
||||
queryFactory
|
||||
@@ -315,7 +328,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
AuditLogDto.LogDetail.class,
|
||||
Expressions.constant("한국자산관리공사"), // serviceName
|
||||
Expressions.constant(english ? "Kamco" : "한국자산관리공사"), // serviceName
|
||||
parentMenuName.as("parentMenuName"),
|
||||
menuName,
|
||||
menuEntity.menuUrl.as("menuUrl"),
|
||||
@@ -352,21 +365,25 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
@Override
|
||||
public Page<AuditLogDto.UserDetail> findLogByAccountResult(
|
||||
AuditLogDto.searchReq searchReq, Long userUid) {
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
boolean english = "en".equalsIgnoreCase(lang);
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
QMenuEntity parent = new QMenuEntity("parent");
|
||||
// 1depth menu name
|
||||
StringExpression parentMenuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(menuEntity.menuNm)
|
||||
.otherwise(parent.menuNm);
|
||||
.then(english ? menuEntity.menuNmEn : menuEntity.menuNm)
|
||||
.otherwise(english ? parent.menuNmEn : parent.menuNm);
|
||||
|
||||
// 2depth menu name
|
||||
StringExpression menuName =
|
||||
new CaseBuilder()
|
||||
.when(parent.menuUid.isNull())
|
||||
.then(NULL_STRING)
|
||||
.otherwise(menuEntity.menuNm);
|
||||
.otherwise(english ? menuEntity.menuNmEn : menuEntity.menuNm);
|
||||
|
||||
StringExpression menuNm = (english ? menuEntity.menuNmEn : menuEntity.menuNm);
|
||||
|
||||
List<AuditLogDto.UserDetail> foundContent =
|
||||
queryFactory
|
||||
@@ -377,11 +394,11 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
Expressions.stringTemplate(
|
||||
"to_char({0}, 'YYYY-MM-DD HH24:MI')", auditLogEntity.createdDate)
|
||||
.as("logDateTime"),
|
||||
menuEntity.menuNm.as("menuName"),
|
||||
menuNm.as("menuName"),
|
||||
auditLogEntity.eventType.as("eventType"),
|
||||
Projections.constructor(
|
||||
AuditLogDto.LogDetail.class,
|
||||
Expressions.constant("한국자산관리공사"), // serviceName
|
||||
Expressions.constant(english ? "Kamco" : "한국자산관리공사"), // serviceName
|
||||
parentMenuName.as("parentMenuName"),
|
||||
menuName,
|
||||
menuEntity.menuUrl.as("menuUrl"),
|
||||
@@ -442,7 +459,7 @@ public class AuditLogRepositoryImpl extends QuerydslRepositorySupport
|
||||
if (StringUtils.isBlank(searchValue)) {
|
||||
return null;
|
||||
}
|
||||
return menuEntity.menuNm.contains(searchValue);
|
||||
return menuEntity.menuNm.contains(searchValue).or(menuEntity.menuNmEn.contains(searchValue));
|
||||
}
|
||||
|
||||
private BooleanExpression loginIdOrUsernameContains(String searchValue) {
|
||||
|
||||
Reference in New Issue
Block a user