diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapInkxMngCoreService.java b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapInkxMngCoreService.java index 5e69bec3..a3beac7e 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapInkxMngCoreService.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/core/MapInkxMngCoreService.java @@ -24,7 +24,7 @@ public class MapInkxMngCoreService { // 목록 public Page findMapInkxMngList( - MapInkxMngDto.searchReq searchReq, String useInference, String searchVal) { + MapInkxMngDto.searchReq searchReq, String useInference, String searchVal) { return mapInkx5kRepository.findMapInkxMngList(searchReq, useInference, searchVal); } @@ -43,9 +43,9 @@ public class MapInkxMngCoreService { } MapInkx5kEntity entity = - new MapInkx5kEntity( - req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k, "USE" // 기본은 USE로 - ); + new MapInkx5kEntity( + req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k, "USE" // 기본은 USE로 + ); mapInkx5kRepository.save(entity); @@ -54,10 +54,10 @@ public class MapInkxMngCoreService { public ResponseObj updateUseInference(@Valid UseInferReq useInferReq) { Optional entity = - Optional.ofNullable( - mapInkx5kRepository - .findByMapidCdNoInfo(useInferReq.getMapidcdNo()) - .orElseThrow(() -> new EntityNotFoundException("도엽정보를 찾을 수 없습니다."))); + Optional.ofNullable( + mapInkx5kRepository + .findByMapidCdNoInfo(useInferReq.getMapidcdNo()) + .orElseThrow(() -> new EntityNotFoundException("도엽정보를 찾을 수 없습니다."))); entity.get().updateUseInference(useInferReq.getUseInference()); return new ResponseObj(ApiResponseCode.OK, ""); diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapInkx5kEntity.java b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapInkx5kEntity.java index c6e3ca87..981b0818 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapInkx5kEntity.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/entity/MapInkx5kEntity.java @@ -25,9 +25,9 @@ public class MapInkx5kEntity extends CommonDateEntity { @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_inkx_5k_fid_seq_gen") @SequenceGenerator( - name = "tb_map_inkx_5k_fid_seq_gen", - sequenceName = "tb_map_inkx_5k_fid_seq", - allocationSize = 1) + name = "tb_map_inkx_5k_fid_seq_gen", + sequenceName = "tb_map_inkx_5k_fid_seq", + allocationSize = 1) private Integer fid; @Column(name = "mapidcd_no") @@ -46,7 +46,7 @@ public class MapInkx5kEntity extends CommonDateEntity { private String useInference; public MapInkx5kEntity( - String mapidcdNo, String mapidNm, Geometry geom, Integer fidK50, String useInference) { + String mapidcdNo, String mapidNm, Geometry geom, Integer fidK50, String useInference) { this.mapidcdNo = mapidcdNo; this.mapidNm = mapidNm; this.geom = geom; diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java index 6c214497..dd0bcb4c 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/mapsheet/MapSheetMngRepositoryImpl.java @@ -33,13 +33,12 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport - implements MapSheetMngRepositoryCustom { + implements MapSheetMngRepositoryCustom { private final JPAQueryFactory queryFactory; private final StringExpression NULL_STRING = Expressions.stringTemplate("cast(null as text)"); - @PersistenceContext - private EntityManager em; + @PersistenceContext private EntityManager em; public MapSheetMngRepositoryImpl(JPAQueryFactory queryFactory) { super(MapSheetMngHstEntity.class); @@ -59,121 +58,121 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport NumberExpression totalCount = mapSheetMngHstEntity.count().as("syncTotCnt"); NumberExpression doneCount = - new CaseBuilder() - .when(mapSheetMngHstEntity.dataState.eq("DONE")) - .then(1L) - .otherwise(0L) - .sum() - .as("syncStateDoneCnt"); + new CaseBuilder() + .when(mapSheetMngHstEntity.dataState.eq("DONE")) + .then(1L) + .otherwise(0L) + .sum() + .as("syncStateDoneCnt"); List foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngDto.class, - Expressions.numberTemplate( - Integer.class, - "row_number() over(order by {0} desc)", - mapSheetMngEntity.createdDttm), - mapSheetMngEntity.mngYyyy, - mapSheetMngEntity.mngPath, - mapSheetMngEntity.mngState, - mapSheetMngEntity.syncState, - mapSheetMngEntity.syncCheckState, - mapSheetMngHstEntity.count().as("syncTotalCnt"), - new CaseBuilder() - .when(mapSheetMngHstEntity.dataState.eq("DONE")) - .then(1L) - .otherwise(0L) - .sum() - .as("syncStateDoneCnt"), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.ne("NOTYET")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) - .then(1L) - .otherwise(0L) - .sum(), - mapSheetMngEntity.createdDttm, - mapSheetMngHstEntity.syncEndDttm.max())) - .from(mapSheetMngEntity) - .leftJoin(mapSheetMngHstEntity) - .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) - .where(whereBuilder) - // .offset(pageable.getOffset()) - // .limit(pageable.getPageSize()) - .orderBy(mapSheetMngEntity.mngYyyy.desc()) - .groupBy(mapSheetMngEntity.mngYyyy) - .fetch(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngDto.class, + Expressions.numberTemplate( + Integer.class, + "row_number() over(order by {0} desc)", + mapSheetMngEntity.createdDttm), + mapSheetMngEntity.mngYyyy, + mapSheetMngEntity.mngPath, + mapSheetMngEntity.mngState, + mapSheetMngEntity.syncState, + mapSheetMngEntity.syncCheckState, + mapSheetMngHstEntity.count().as("syncTotalCnt"), + new CaseBuilder() + .when(mapSheetMngHstEntity.dataState.eq("DONE")) + .then(1L) + .otherwise(0L) + .sum() + .as("syncStateDoneCnt"), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.ne("NOTYET")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) + .then(1L) + .otherwise(0L) + .sum(), + mapSheetMngEntity.createdDttm, + mapSheetMngHstEntity.syncEndDttm.max())) + .from(mapSheetMngEntity) + .leftJoin(mapSheetMngHstEntity) + .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) + .where(whereBuilder) + // .offset(pageable.getOffset()) + // .limit(pageable.getPageSize()) + .orderBy(mapSheetMngEntity.mngYyyy.desc()) + .groupBy(mapSheetMngEntity.mngYyyy) + .fetch(); Long countQuery = - queryFactory - .select(mapSheetMngEntity.mngYyyy.count()) - .from(mapSheetMngEntity) - .where(whereBuilder) - .fetchOne(); + queryFactory + .select(mapSheetMngEntity.mngYyyy.count()) + .from(mapSheetMngEntity) + .where(whereBuilder) + .fetchOne(); return foundContent; } @@ -181,15 +180,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport public List findMapSheetMngYyyyList() { List foundContent = - queryFactory - .select(yearEntity.yyyy) - .from(yearEntity) - .leftJoin(mapSheetMngEntity) - .on(mapSheetMngEntity.mngYyyy.eq(yearEntity.yyyy)) - .where(yearEntity.status.eq("NOTYET")) - .orderBy(yearEntity.yyyy.asc()) - .limit(10) - .fetch(); + queryFactory + .select(yearEntity.yyyy) + .from(yearEntity) + .leftJoin(mapSheetMngEntity) + .on(mapSheetMngEntity.mngYyyy.eq(yearEntity.yyyy)) + .where(yearEntity.status.eq("NOTYET")) + .orderBy(yearEntity.yyyy.asc()) + .limit(10) + .fetch(); foundContent.sort(Comparator.reverseOrder()); @@ -198,11 +197,11 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport public void updateYearState(int yyyy, String status) { long execCount = - queryFactory - .update(yearEntity) - .set(yearEntity.status, status) - .where(yearEntity.yyyy.eq(yyyy)) - .execute(); + queryFactory + .update(yearEntity) + .set(yearEntity.status, status) + .where(yearEntity.yyyy.eq(yyyy)) + .execute(); } public MapSheetMngDto.MngDto findMapSheetMng(int mngYyyy) { @@ -211,117 +210,117 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport whereBuilder.and(mapSheetMngEntity.mngYyyy.eq(mngYyyy)); MapSheetMngDto.MngDto foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngDto.class, - Expressions.numberTemplate( - Integer.class, - "row_number() over(order by {0} desc)", - mapSheetMngEntity.createdDttm), - mapSheetMngEntity.mngYyyy, - mapSheetMngEntity.mngPath, - mapSheetMngEntity.mngState, - mapSheetMngEntity.syncState, - mapSheetMngEntity.syncCheckState, - mapSheetMngHstEntity.count().as("syncTotalCnt"), - new CaseBuilder() - .when(mapSheetMngHstEntity.dataState.eq("DONE")) - .then(1L) - .otherwise(0L) - .sum() - .as("syncStateDoneCnt"), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.ne("NOTYET")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and( - mapSheetMngHstEntity - .syncState - .eq("TYPEERROR") - .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) - .then(1L) - .otherwise(0L) - .sum(), - new CaseBuilder() - .when( - mapSheetMngHstEntity - .syncCheckState - .eq("DONE") - .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) - .then(1L) - .otherwise(0L) - .sum(), - mapSheetMngEntity.createdDttm, - mapSheetMngHstEntity.syncEndDttm.max())) - .from(mapSheetMngEntity) - .leftJoin(mapSheetMngHstEntity) - .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) - .where(whereBuilder) - .groupBy(mapSheetMngEntity.mngYyyy) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngDto.class, + Expressions.numberTemplate( + Integer.class, + "row_number() over(order by {0} desc)", + mapSheetMngEntity.createdDttm), + mapSheetMngEntity.mngYyyy, + mapSheetMngEntity.mngPath, + mapSheetMngEntity.mngState, + mapSheetMngEntity.syncState, + mapSheetMngEntity.syncCheckState, + mapSheetMngHstEntity.count().as("syncTotalCnt"), + new CaseBuilder() + .when(mapSheetMngHstEntity.dataState.eq("DONE")) + .then(1L) + .otherwise(0L) + .sum() + .as("syncStateDoneCnt"), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.ne("NOTYET")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("NOTPAIR")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOTPAIR"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("DUPLICATE")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("DUPLICATE"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR"))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and( + mapSheetMngHstEntity + .syncState + .eq("TYPEERROR") + .or(mapSheetMngHstEntity.syncState.eq("SIZEERROR")))) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when(mapSheetMngHstEntity.syncState.eq("NOFILE")) + .then(1L) + .otherwise(0L) + .sum(), + new CaseBuilder() + .when( + mapSheetMngHstEntity + .syncCheckState + .eq("DONE") + .and(mapSheetMngHstEntity.syncState.eq("NOFILE"))) + .then(1L) + .otherwise(0L) + .sum(), + mapSheetMngEntity.createdDttm, + mapSheetMngHstEntity.syncEndDttm.max())) + .from(mapSheetMngEntity) + .leftJoin(mapSheetMngHstEntity) + .on(mapSheetMngEntity.mngYyyy.eq(mapSheetMngHstEntity.mngYyyy)) + .where(whereBuilder) + .groupBy(mapSheetMngEntity.mngYyyy) + .fetchOne(); return foundContent; } @Override public Page findMapSheetErrorList( - MapSheetMngDto.@Valid ErrorSearchReq searchReq) { + MapSheetMngDto.@Valid ErrorSearchReq searchReq) { Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize()); BooleanBuilder whereBuilder = new BooleanBuilder(); whereBuilder.and(mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy())); whereBuilder.and( - mapSheetMngHstEntity.syncState.ne("DONE").and(mapSheetMngHstEntity.syncState.ne("NOTYET"))); + mapSheetMngHstEntity.syncState.ne("DONE").and(mapSheetMngHstEntity.syncState.ne("NOTYET"))); if (searchReq.getSyncState() != null && !searchReq.getSyncState().isEmpty()) { whereBuilder.and(mapSheetMngHstEntity.syncState.eq(searchReq.getSyncState())); @@ -333,70 +332,70 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport if (searchReq.getSearchValue() != null && !searchReq.getSearchValue().isEmpty()) { whereBuilder.and( - mapSheetMngHstEntity - .mapSheetNum - .eq(searchReq.getSearchValue()) - .or(mapSheetMngHstEntity.refMapSheetNum.eq(searchReq.getSearchValue())) - .or( - Expressions.stringTemplate( - "concat({0},substring({1}, 0, 6))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) - .likeIgnoreCase("%" + searchReq.getSearchValue() + "%")) - .or( - Expressions.stringTemplate( - "concat({0},substring({1}, 6, 8))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) - .likeIgnoreCase("%" + searchReq.getSearchValue() + "%"))); + mapSheetMngHstEntity + .mapSheetNum + .eq(searchReq.getSearchValue()) + .or(mapSheetMngHstEntity.refMapSheetNum.eq(searchReq.getSearchValue())) + .or( + Expressions.stringTemplate( + "concat({0},substring({1}, 0, 6))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) + .likeIgnoreCase("%" + searchReq.getSearchValue() + "%")) + .or( + Expressions.stringTemplate( + "concat({0},substring({1}, 6, 8))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) + .likeIgnoreCase("%" + searchReq.getSearchValue() + "%"))); } List foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.ErrorDataDto.class, - mapSheetMngHstEntity.hstUid, - mapSheetMngHstEntity.mngYyyy, - mapSheetMngHstEntity.mapSheetNum, - mapSheetMngHstEntity.refMapSheetNum, - Expressions.stringTemplate( - "concat({0},substring({1}, 0, 6))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) - .as("map50kName"), - Expressions.stringTemplate( - "concat({0},{1})", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) - .as("map5kName"), - Expressions.stringTemplate( - "concat({0},substring({1}, 6, 8))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) - .as("mapSrcName"), - mapInkx5kEntity.fid, - mapSheetMngHstEntity.createdDate, - mapSheetMngHstEntity.syncState, - mapSheetMngHstEntity.syncTfwFileName, - mapSheetMngHstEntity.syncTifFileName, - mapSheetMngHstEntity.syncCheckState, - mapSheetMngHstEntity.syncCheckTfwFileName, - mapSheetMngHstEntity.syncCheckTifFileName)) - .from(mapSheetMngHstEntity) - .innerJoin(mapInkx5kEntity) - .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) - .where(whereBuilder) - .orderBy(mapSheetMngHstEntity.createdDate.desc()) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .fetch(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.ErrorDataDto.class, + mapSheetMngHstEntity.hstUid, + mapSheetMngHstEntity.mngYyyy, + mapSheetMngHstEntity.mapSheetNum, + mapSheetMngHstEntity.refMapSheetNum, + Expressions.stringTemplate( + "concat({0},substring({1}, 0, 6))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) + .as("map50kName"), + Expressions.stringTemplate( + "concat({0},{1})", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) + .as("map5kName"), + Expressions.stringTemplate( + "concat({0},substring({1}, 6, 8))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum) + .as("mapSrcName"), + mapInkx5kEntity.fid, + mapSheetMngHstEntity.createdDate, + mapSheetMngHstEntity.syncState, + mapSheetMngHstEntity.syncTfwFileName, + mapSheetMngHstEntity.syncTifFileName, + mapSheetMngHstEntity.syncCheckState, + mapSheetMngHstEntity.syncCheckTfwFileName, + mapSheetMngHstEntity.syncCheckTifFileName)) + .from(mapSheetMngHstEntity) + .innerJoin(mapInkx5kEntity) + .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) + .where(whereBuilder) + .orderBy(mapSheetMngHstEntity.createdDate.desc()) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .fetch(); Long countQuery = - queryFactory - .select(mapSheetMngHstEntity.hstUid.count()) - .from(mapSheetMngHstEntity) - .innerJoin(mapInkx5kEntity) - .on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid)) - .leftJoin(mapInkx50kEntity) - .on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid)) - .where(whereBuilder) - .fetchOne(); + queryFactory + .select(mapSheetMngHstEntity.hstUid.count()) + .from(mapSheetMngHstEntity) + .innerJoin(mapInkx5kEntity) + .on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid)) + .leftJoin(mapInkx50kEntity) + .on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid)) + .where(whereBuilder) + .fetchOne(); return new PageImpl<>(foundContent, pageable, countQuery); } @@ -408,42 +407,42 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport whereBuilder.and(mapSheetMngHstEntity.hstUid.eq(hstUid)); MapSheetMngDto.ErrorDataDto foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.ErrorDataDto.class, - mapSheetMngHstEntity.hstUid, - mapSheetMngHstEntity.mngYyyy, - mapSheetMngHstEntity.mapSheetNum, - mapSheetMngHstEntity.refMapSheetNum, - Expressions.stringTemplate( - "concat({0}, substring({1}, 1, 5))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.ErrorDataDto.class, + mapSheetMngHstEntity.hstUid, + mapSheetMngHstEntity.mngYyyy, + mapSheetMngHstEntity.mapSheetNum, + mapSheetMngHstEntity.refMapSheetNum, + Expressions.stringTemplate( + "concat({0}, substring({1}, 1, 5))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), - // ✅ 튜플 방지: concat으로 문자열 생성 - Expressions.stringTemplate( - "concat('(', {0}, ',', {1}, ')')", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), - Expressions.stringTemplate( - "concat({0}, substring({1}, 6, 3))", - mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), + // ✅ 튜플 방지: concat으로 문자열 생성 + Expressions.stringTemplate( + "concat('(', {0}, ',', {1}, ')')", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), + Expressions.stringTemplate( + "concat({0}, substring({1}, 6, 3))", + mapInkx5kEntity.mapidNm, mapSheetMngHstEntity.mapSheetNum), - // fid 타입 주의 (Long이면 DTO도 Long으로 맞추는 걸 추천) - mapInkx5kEntity.fid, // 또는 mapInkx5kEntity.fid.intValue() + // fid 타입 주의 (Long이면 DTO도 Long으로 맞추는 걸 추천) + mapInkx5kEntity.fid, // 또는 mapInkx5kEntity.fid.intValue() - // ✅ createdDate 말고 ZonedDateTime으로 매핑된 필드로 - mapSheetMngHstEntity.createdDate, // (예시) - mapSheetMngHstEntity.syncState, - mapSheetMngHstEntity.syncTfwFileName, - mapSheetMngHstEntity.syncTifFileName, - mapSheetMngHstEntity.syncCheckState, - mapSheetMngHstEntity.syncCheckTfwFileName, - mapSheetMngHstEntity.syncCheckTifFileName)) - .from(mapSheetMngHstEntity) - .innerJoin(mapInkx5kEntity) - .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) - .where(whereBuilder) - .fetchOne(); + // ✅ createdDate 말고 ZonedDateTime으로 매핑된 필드로 + mapSheetMngHstEntity.createdDate, // (예시) + mapSheetMngHstEntity.syncState, + mapSheetMngHstEntity.syncTfwFileName, + mapSheetMngHstEntity.syncTifFileName, + mapSheetMngHstEntity.syncCheckState, + mapSheetMngHstEntity.syncCheckTfwFileName, + mapSheetMngHstEntity.syncCheckTifFileName)) + .from(mapSheetMngHstEntity) + .innerJoin(mapInkx5kEntity) + .on(mapSheetMngHstEntity.mapSheetNum.eq(mapInkx5kEntity.mapidcdNo)) + .where(whereBuilder) + .fetchOne(); return foundContent; } @@ -456,22 +455,22 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport whereBuilder.and(mapSheetMngFileEntity.fileDel.eq(false)); List foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngFilesDto.class, - mapSheetMngFileEntity.fileUid, - mapSheetMngFileEntity.mngYyyy, - mapSheetMngFileEntity.mapSheetNum, - mapSheetMngFileEntity.refMapSheetNum, - mapSheetMngFileEntity.filePath, - mapSheetMngFileEntity.fileName, - mapSheetMngFileEntity.fileExt, - mapSheetMngFileEntity.hstUid, - mapSheetMngFileEntity.fileSize)) - .from(mapSheetMngFileEntity) - .where(whereBuilder) - .fetch(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngFilesDto.class, + mapSheetMngFileEntity.fileUid, + mapSheetMngFileEntity.mngYyyy, + mapSheetMngFileEntity.mapSheetNum, + mapSheetMngFileEntity.refMapSheetNum, + mapSheetMngFileEntity.filePath, + mapSheetMngFileEntity.fileName, + mapSheetMngFileEntity.fileExt, + mapSheetMngFileEntity.hstUid, + mapSheetMngFileEntity.fileSize)) + .from(mapSheetMngFileEntity) + .where(whereBuilder) + .fetch(); return foundContent; } @@ -483,23 +482,23 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport whereBuilder.and(mapSheetMngFileEntity.fileDel.eq(false)); List foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngFilesDto.class, - mapSheetMngFileEntity.fileUid, - mapSheetMngFileEntity.mngYyyy, - mapSheetMngFileEntity.mapSheetNum, - mapSheetMngFileEntity.refMapSheetNum, - mapSheetMngFileEntity.filePath, - mapSheetMngFileEntity.fileName, - mapSheetMngFileEntity.fileExt, - mapSheetMngFileEntity.hstUid, - mapSheetMngFileEntity.fileSize)) - .from(mapSheetMngFileEntity) - .where(whereBuilder) - .orderBy(mapSheetMngFileEntity.filePath.asc()) - .fetch(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngFilesDto.class, + mapSheetMngFileEntity.fileUid, + mapSheetMngFileEntity.mngYyyy, + mapSheetMngFileEntity.mapSheetNum, + mapSheetMngFileEntity.refMapSheetNum, + mapSheetMngFileEntity.filePath, + mapSheetMngFileEntity.fileName, + mapSheetMngFileEntity.fileExt, + mapSheetMngFileEntity.hstUid, + mapSheetMngFileEntity.fileSize)) + .from(mapSheetMngFileEntity) + .where(whereBuilder) + .orderBy(mapSheetMngFileEntity.filePath.asc()) + .fetch(); return foundContent; } @@ -511,24 +510,24 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport whereBuilder.and(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)); MapSheetMngDto.MngFilesDto foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngFilesDto.class, - mapSheetMngFileEntity.fileUid, - mapSheetMngFileEntity.mngYyyy, - mapSheetMngFileEntity.mapSheetNum, - mapSheetMngFileEntity.refMapSheetNum, - mapSheetMngFileEntity.filePath, - mapSheetMngFileEntity.fileName, - mapSheetMngFileEntity.fileExt, - mapSheetMngFileEntity.hstUid, - mapSheetMngFileEntity.fileSize)) - .from(mapSheetMngFileEntity) - .where(whereBuilder) - .orderBy(mapSheetMngFileEntity.fileUid.desc()) - .limit(1) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngFilesDto.class, + mapSheetMngFileEntity.fileUid, + mapSheetMngFileEntity.mngYyyy, + mapSheetMngFileEntity.mapSheetNum, + mapSheetMngFileEntity.refMapSheetNum, + mapSheetMngFileEntity.filePath, + mapSheetMngFileEntity.fileName, + mapSheetMngFileEntity.fileExt, + mapSheetMngFileEntity.hstUid, + mapSheetMngFileEntity.fileSize)) + .from(mapSheetMngFileEntity) + .where(whereBuilder) + .orderBy(mapSheetMngFileEntity.fileUid.desc()) + .limit(1) + .fetchOne(); return foundContent; } @@ -537,22 +536,22 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport public MapSheetMngDto.MngFilesDto findByFileUidMapSheetFile(Long fileUid) { MapSheetMngDto.MngFilesDto foundContent = - queryFactory - .select( - Projections.constructor( - MapSheetMngDto.MngFilesDto.class, - mapSheetMngFileEntity.fileUid, - mapSheetMngFileEntity.mngYyyy, - mapSheetMngFileEntity.mapSheetNum, - mapSheetMngFileEntity.refMapSheetNum, - mapSheetMngFileEntity.filePath, - mapSheetMngFileEntity.fileName, - mapSheetMngFileEntity.fileExt, - mapSheetMngFileEntity.hstUid, - mapSheetMngFileEntity.fileSize)) - .from(mapSheetMngFileEntity) - .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) - .fetchOne(); + queryFactory + .select( + Projections.constructor( + MapSheetMngDto.MngFilesDto.class, + mapSheetMngFileEntity.fileUid, + mapSheetMngFileEntity.mngYyyy, + mapSheetMngFileEntity.mapSheetNum, + mapSheetMngFileEntity.refMapSheetNum, + mapSheetMngFileEntity.filePath, + mapSheetMngFileEntity.fileName, + mapSheetMngFileEntity.fileExt, + mapSheetMngFileEntity.hstUid, + mapSheetMngFileEntity.fileSize)) + .from(mapSheetMngFileEntity) + .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) + .fetchOne(); return foundContent; } @@ -560,147 +559,147 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport @Override public void MapSheetMngComplete(int mngYyyy) { long execCount = - queryFactory - .update(mapSheetMngEntity) - .set(mapSheetMngEntity.mngState, "COMPLETE") - .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .update(mapSheetMngEntity) + .set(mapSheetMngEntity.mngState, "COMPLETE") + .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) + .execute(); } @Override public void updateMapSheetMngHstSyncCheckState(MapSheetMngDto.SyncCheckStateReqUpdateDto updReq) { long execCount = - queryFactory - .update(mapSheetMngHstEntity) - .set(mapSheetMngHstEntity.syncCheckState, updReq.getSyncCheckState()) - .set(mapSheetMngHstEntity.mapSheetPath, updReq.getFilePath()) - .set(mapSheetMngHstEntity.syncCheckTfwFileName, updReq.getSyncCheckTfwFileName()) - .set(mapSheetMngHstEntity.syncCheckTifFileName, updReq.getSyncCheckTifFileName()) - .set(mapSheetMngHstEntity.syncCheckStrtDttm, ZonedDateTime.now()) - .set(mapSheetMngHstEntity.syncCheckEndDttm, ZonedDateTime.now()) - .where(mapSheetMngHstEntity.hstUid.eq(updReq.getHstUid())) - .execute(); + queryFactory + .update(mapSheetMngHstEntity) + .set(mapSheetMngHstEntity.syncCheckState, updReq.getSyncCheckState()) + .set(mapSheetMngHstEntity.mapSheetPath, updReq.getFilePath()) + .set(mapSheetMngHstEntity.syncCheckTfwFileName, updReq.getSyncCheckTfwFileName()) + .set(mapSheetMngHstEntity.syncCheckTifFileName, updReq.getSyncCheckTifFileName()) + .set(mapSheetMngHstEntity.syncCheckStrtDttm, ZonedDateTime.now()) + .set(mapSheetMngHstEntity.syncCheckEndDttm, ZonedDateTime.now()) + .where(mapSheetMngHstEntity.hstUid.eq(updReq.getHstUid())) + .execute(); } @Override public void deleteByMngYyyyMngAll(int mngYyyy) { long deletedFileCount = - queryFactory - .delete(mapSheetMngFileEntity) - .where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngFileEntity) + .where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)) + .execute(); long deletedHisCount = - queryFactory - .delete(mapSheetMngHstEntity) - .where(mapSheetMngHstEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngHstEntity) + .where(mapSheetMngHstEntity.mngYyyy.eq(mngYyyy)) + .execute(); long deletedMngCount = - queryFactory - .delete(mapSheetMngEntity) - .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngEntity) + .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) + .execute(); } @Override public void deleteByMngYyyyMng(int mngYyyy) { long deletedMngCount = - queryFactory - .delete(mapSheetMngEntity) - .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngEntity) + .where(mapSheetMngEntity.mngYyyy.eq(mngYyyy)) + .execute(); } @Override public void deleteByMngYyyyMngHst(int mngYyyy) { long deletedHisCount = - queryFactory - .delete(mapSheetMngHstEntity) - .where(mapSheetMngHstEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngHstEntity) + .where(mapSheetMngHstEntity.mngYyyy.eq(mngYyyy)) + .execute(); } @Override public void deleteByMngYyyyMngFile(int mngYyyy) { long deletedFileCount = - queryFactory - .delete(mapSheetMngFileEntity) - .where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)) - .execute(); + queryFactory + .delete(mapSheetMngFileEntity) + .where(mapSheetMngFileEntity.mngYyyy.eq(mngYyyy)) + .execute(); } @Override public void deleteByHstUidMngFile(Long hstUid) { long deletedFileCount = - queryFactory - .update(mapSheetMngFileEntity) - .set(mapSheetMngFileEntity.fileDel, true) - .where(mapSheetMngFileEntity.hstUid.eq(hstUid)) - .execute(); + queryFactory + .update(mapSheetMngFileEntity) + .set(mapSheetMngFileEntity.fileDel, true) + .where(mapSheetMngFileEntity.hstUid.eq(hstUid)) + .execute(); } @Override public void deleteByFileUidMngFile(Long fileUid) { long fileCount = - queryFactory - .update(mapSheetMngFileEntity) - .set(mapSheetMngFileEntity.fileDel, true) - .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) - .execute(); + queryFactory + .update(mapSheetMngFileEntity) + .set(mapSheetMngFileEntity.fileDel, true) + .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) + .execute(); } @Override public void updateByHstUidMngFileState(Long hstUid, String fileState) { long execCount = - queryFactory - .update(mapSheetMngFileEntity) - .set(mapSheetMngFileEntity.fileState, fileState) - .where(mapSheetMngFileEntity.hstUid.eq(hstUid)) - .execute(); + queryFactory + .update(mapSheetMngFileEntity) + .set(mapSheetMngFileEntity.fileState, fileState) + .where(mapSheetMngFileEntity.hstUid.eq(hstUid)) + .execute(); } @Override public void deleteByNotInFileUidMngFile(Long hstUid, List fileUids) { long execCount = - queryFactory - .update(mapSheetMngFileEntity) - .set(mapSheetMngFileEntity.fileDel, true) - .where( - mapSheetMngFileEntity - .hstUid - .eq(hstUid) - .and(mapSheetMngFileEntity.fileUid.notIn(fileUids))) - .execute(); + queryFactory + .update(mapSheetMngFileEntity) + .set(mapSheetMngFileEntity.fileDel, true) + .where( + mapSheetMngFileEntity + .hstUid + .eq(hstUid) + .and(mapSheetMngFileEntity.fileUid.notIn(fileUids))) + .execute(); } @Override public void updateByFileUidMngFileState(Long fileUid, String fileState) { long execCount = - queryFactory - .update(mapSheetMngFileEntity) - .set(mapSheetMngFileEntity.fileState, fileState) - .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) - .execute(); + queryFactory + .update(mapSheetMngFileEntity) + .set(mapSheetMngFileEntity.fileState, fileState) + .where(mapSheetMngFileEntity.fileUid.eq(fileUid)) + .execute(); } @Override public int findByYearFileNameFileCount(int mngYyyy, String fileName) { Long execCount = - queryFactory - .select(mapSheetMngFileEntity.count()) - .from(mapSheetMngFileEntity) - .where( - mapSheetMngFileEntity - .mngYyyy - .eq(mngYyyy) - .and(mapSheetMngFileEntity.fileName.eq(fileName))) - .fetchOne(); + queryFactory + .select(mapSheetMngFileEntity.count()) + .from(mapSheetMngFileEntity) + .where( + mapSheetMngFileEntity + .mngYyyy + .eq(mngYyyy) + .and(mapSheetMngFileEntity.fileName.eq(fileName))) + .fetchOne(); return Math.toIntExact(execCount); } @@ -708,36 +707,36 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport @Override public void mngFileSave(@Valid MapSheetMngDto.MngFileAddReq addReq) { long fileCount = - queryFactory - .insert(mapSheetMngFileEntity) - .columns( - mapSheetMngFileEntity.mngYyyy, - mapSheetMngFileEntity.mapSheetNum, - mapSheetMngFileEntity.refMapSheetNum, - mapSheetMngFileEntity.filePath, - mapSheetMngFileEntity.fileName, - mapSheetMngFileEntity.fileExt, - mapSheetMngFileEntity.hstUid, - mapSheetMngFileEntity.fileSize, - mapSheetMngFileEntity.fileState) - .values( - addReq.getMngYyyy(), - addReq.getMapSheetNum(), - addReq.getRefMapSheetNum(), - addReq.getFilePath(), - addReq.getFileName(), - addReq.getFileExt(), - addReq.getHstUid(), - addReq.getFileSize(), - addReq.getFileState()) - .execute(); + queryFactory + .insert(mapSheetMngFileEntity) + .columns( + mapSheetMngFileEntity.mngYyyy, + mapSheetMngFileEntity.mapSheetNum, + mapSheetMngFileEntity.refMapSheetNum, + mapSheetMngFileEntity.filePath, + mapSheetMngFileEntity.fileName, + mapSheetMngFileEntity.fileExt, + mapSheetMngFileEntity.hstUid, + mapSheetMngFileEntity.fileSize, + mapSheetMngFileEntity.fileState) + .values( + addReq.getMngYyyy(), + addReq.getMapSheetNum(), + addReq.getRefMapSheetNum(), + addReq.getFilePath(), + addReq.getFileName(), + addReq.getFileExt(), + addReq.getHstUid(), + addReq.getFileSize(), + addReq.getFileState()) + .execute(); } @Override public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy, String mngPath) { String sql = - """ + """ INSERT INTO tb_map_sheet_mng_hst ( mng_yyyy @@ -777,17 +776,17 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport @Override public Optional findMapSheetMngHstInfo(Long hstUid) { return Optional.ofNullable( - queryFactory - .selectFrom(mapSheetMngHstEntity) - .where(mapSheetMngHstEntity.hstUid.eq(hstUid)) - .fetchOne()); + queryFactory + .selectFrom(mapSheetMngHstEntity) + .where(mapSheetMngHstEntity.hstUid.eq(hstUid)) + .fetchOne()); } @Override public void updateHstFileSizes( - Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes) { + Long hstUid, long tifSizeBytes, long tfwSizeBytes, long totalSizeBytes) { String sql = - "UPDATE tb_map_sheet_mng_hst SET tif_size_bytes = :tif, tfw_size_bytes = :tfw, total_size_bytes = :tot WHERE hst_uid = :uid"; + "UPDATE tb_map_sheet_mng_hst SET tif_size_bytes = :tif, tfw_size_bytes = :tfw, total_size_bytes = :tot WHERE hst_uid = :uid"; Query query = (Query) em.createNativeQuery(sql); query.setParameter("tif", tifSizeBytes); query.setParameter("tfw", tfwSizeBytes); @@ -798,7 +797,7 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport private NumberExpression rowNum() { return Expressions.numberTemplate( - Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate); + Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate); } private BooleanExpression mapSheetErrorSearchValue(MapSheetMngDto.ErrorSearchReq searchReq) { @@ -808,10 +807,10 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport // 검색어 1개 값이 도엽명 or 도엽번호 like 검색 return Expressions.booleanTemplate( - "{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetName) - .or( - Expressions.booleanTemplate( - "{0} like '%" + searchReq.getSearchValue() + "%'", - mapSheetMngHstEntity.mapSheetNum)); + "{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetName) + .or( + Expressions.booleanTemplate( + "{0} like '%" + searchReq.getSearchValue() + "%'", + mapSheetMngHstEntity.mapSheetNum)); } } diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/scene/MapInkx5kRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/scene/MapInkx5kRepositoryImpl.java index 5412d4ef..88531ad1 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/scene/MapInkx5kRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/scene/MapInkx5kRepositoryImpl.java @@ -21,7 +21,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport - implements MapInkx5kRepositoryCustom { + implements MapInkx5kRepositoryCustom { private final JPAQueryFactory queryFactory; @@ -34,53 +34,53 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport QMapInkx5kEntity map5k = QMapInkx5kEntity.mapInkx5kEntity; return queryFactory - .selectFrom(map5k) - .where(map5k.mapidcdNo.in(codes)) - .orderBy(map5k.mapidcdNo.asc()) - .fetch(); + .selectFrom(map5k) + .where(map5k.mapidcdNo.in(codes)) + .orderBy(map5k.mapidcdNo.asc()) + .fetch(); } @Override public Page findMapInkxMngList( - searchReq searchReq, String useInference, String searchVal) { + searchReq searchReq, String useInference, String searchVal) { Pageable pageable = searchReq.toPageable(); List foundContent = - queryFactory - .select( - Projections.constructor( - MapInkxMngDto.MapList.class, - Expressions.numberTemplate( - Integer.class, - "row_number() over(order by {0} asc)", - mapInkx5kEntity.mapidcdNo), - mapInkx5kEntity.mapidcdNo, - mapInkx50kEntity.mapidcdNo, - mapInkx5kEntity.mapidNm, - mapInkx5kEntity.createdDate, - mapInkx5kEntity.modifiedDate, - // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", - // mapInkx5kEntity.createdDate), - // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", - // mapInkx5kEntity.modifiedDate), - mapInkx5kEntity.useInference)) - .from(mapInkx5kEntity) - .innerJoin(mapInkx50kEntity) - .on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid)) - .where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) - .offset(pageable.getOffset()) - .limit(pageable.getPageSize()) - .orderBy(mapInkx5kEntity.mapidcdNo.asc()) - .fetch(); + queryFactory + .select( + Projections.constructor( + MapInkxMngDto.MapList.class, + Expressions.numberTemplate( + Integer.class, + "row_number() over(order by {0} asc)", + mapInkx5kEntity.mapidcdNo), + mapInkx5kEntity.mapidcdNo, + mapInkx50kEntity.mapidcdNo, + mapInkx5kEntity.mapidNm, + mapInkx5kEntity.createdDate, + mapInkx5kEntity.modifiedDate, + // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", + // mapInkx5kEntity.createdDate), + // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", + // mapInkx5kEntity.modifiedDate), + mapInkx5kEntity.useInference)) + .from(mapInkx5kEntity) + .innerJoin(mapInkx50kEntity) + .on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid)) + .where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) + .offset(pageable.getOffset()) + .limit(pageable.getPageSize()) + .orderBy(mapInkx5kEntity.mapidcdNo.asc()) + .fetch(); Long countQuery = - queryFactory - .select(mapInkx5kEntity.count()) - .from(mapInkx5kEntity) - .innerJoin(mapInkx50kEntity) - .on(mapInkx5kEntity.fidK50.intValue().eq(mapInkx50kEntity.fid)) - .where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) - .fetchOne(); + queryFactory + .select(mapInkx5kEntity.count()) + .from(mapInkx5kEntity) + .innerJoin(mapInkx50kEntity) + .on(mapInkx5kEntity.fidK50.intValue().eq(mapInkx50kEntity.fid)) + .where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) + .fetchOne(); return new PageImpl<>(foundContent, pageable, countQuery); } @@ -88,19 +88,19 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport @Override public Long findByMapidCdNoExists(String mapidcdNo) { return queryFactory - .select(mapInkx5kEntity.count()) - .from(mapInkx5kEntity) - .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) - .fetchOne(); + .select(mapInkx5kEntity.count()) + .from(mapInkx5kEntity) + .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) + .fetchOne(); } @Override public Optional findByMapidCdNoInfo(String mapidcdNo) { return Optional.ofNullable( - queryFactory - .selectFrom(mapInkx5kEntity) - .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) - .fetchOne()); + queryFactory + .selectFrom(mapInkx5kEntity) + .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) + .fetchOne()); } private BooleanExpression searchUseInference(String useInference) { @@ -115,8 +115,8 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport return null; } return mapInkx5kEntity - .mapidcdNo - .like("%" + searchVal + "%") - .or(mapInkx5kEntity.mapidNm.like("%" + searchVal + "%")); + .mapidcdNo + .like("%" + searchVal + "%") + .or(mapInkx5kEntity.mapidNm.like("%" + searchVal + "%")); } } diff --git a/src/main/java/com/kamco/cd/kamcoback/scene/dto/MapInkxMngDto.java b/src/main/java/com/kamco/cd/kamcoback/scene/dto/MapInkxMngDto.java index 992cf071..635943f1 100644 --- a/src/main/java/com/kamco/cd/kamcoback/scene/dto/MapInkxMngDto.java +++ b/src/main/java/com/kamco/cd/kamcoback/scene/dto/MapInkxMngDto.java @@ -72,28 +72,28 @@ public class MapInkxMngDto { // 목록 Querydsl 에서 리턴 받는 건 생성자 기준임 -> 쿼리 컬럼 그대로 받고 여기서 Java 형변환 해서 return 하기 public MapList( - Integer rowNum, - String mapidcdNo5k, - String mapidcdNo50k, - String mapidNm, - ZonedDateTime createdDttmTime, - ZonedDateTime updatedDttmTime, - String useInference) { + Integer rowNum, + String mapidcdNo5k, + String mapidcdNo50k, + String mapidNm, + ZonedDateTime createdDttmTime, + ZonedDateTime updatedDttmTime, + String useInference) { this.rowNum = rowNum; this.mapidcdNo5k = mapidcdNo5k; this.mapidcdNo50k = mapidcdNo50k; this.mapidNm = mapidNm; DateTimeFormatter fmt = - DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("Asia/Seoul")); + DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.of("Asia/Seoul")); this.createdDttm = fmt.format(createdDttmTime); this.updatedDttm = fmt.format(updatedDttmTime); this.createdDttmTime = createdDttmTime; this.updatedDttmTime = updatedDttmTime; this.useInference = - useInference.equals("USE") - ? UseInferenceType.USE.getDesc() - : UseInferenceType.EXCEPT.getDesc(); + useInference.equals("USE") + ? UseInferenceType.USE.getDesc() + : UseInferenceType.EXCEPT.getDesc(); } } @@ -114,7 +114,7 @@ public class MapInkxMngDto { String[] sortParams = sort.split(","); String property = sortParams[0]; Sort.Direction direction = - sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; + sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC; return PageRequest.of(page, size, Sort.by(direction, property)); } return PageRequest.of(page, size); @@ -135,12 +135,12 @@ public class MapInkxMngDto { private String mapidNm; @Schema( - description = "좌표 목록 (한 줄에 한 점, '경도 위도' 형식)", - example = - "127.17500001632317 36.17499998262991\n" - + "127.14999995475043 36.17500002877932\n" - + "127.15000004313612 36.199999984012415\n" - + "127.1750000466954 36.20000001863179") + description = "좌표 목록 (한 줄에 한 점, '경도 위도' 형식)", + example = + "127.17500001632317 36.17499998262991\n" + + "127.14999995475043 36.17500002877932\n" + + "127.15000004313612 36.199999984012415\n" + + "127.1750000466954 36.20000001863179") private String coordinates; }