영상관리리스트 추가

This commit is contained in:
Harry M. You
2025-12-02 18:48:06 +09:00
parent 8d99a46119
commit d0426fd9e1
6 changed files with 130 additions and 21 deletions

View File

@@ -58,7 +58,7 @@ public class MapSheetMngApiController {
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/getFolders")
@PostMapping("/folder-list")
public ApiResponseDto<List<FileDto.FolderDto>> getDir(
@RequestBody SrchFoldersDto srchDto
) {
@@ -78,7 +78,7 @@ public class MapSheetMngApiController {
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/getFiles")
@PostMapping("/file-list")
public ApiResponseDto<FilesDto> getFiles(
@RequestBody SrchFilesDto srchDto
) {
@@ -99,4 +99,29 @@ public class MapSheetMngApiController {
){
return ApiResponseDto.ok(mapSheetMngService.findMapSheetErrorList(searchReq));
}
@Operation(summary = "영상관리목록 조회", description = "영상관리목록 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/mng-list")
public ApiResponseDto<Page<MapSheetMngDto.MngDto>> findMapSheetMngList(
@RequestBody
@Valid
MapSheetMngDto.searchReq searchReq
){
return ApiResponseDto.ok(mapSheetMngService.findMapSheetMngList(searchReq));
}
}

View File

@@ -177,4 +177,8 @@ public class MapSheetMngService {
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);
}
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngCoreService.findMapSheetMngList(searchReq);
}
}

View File

@@ -18,4 +18,8 @@ public class MapSheetMngCoreService {
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngRepository.findMapSheetErrorList(searchReq);
}
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngRepository.findMapSheetMngList(searchReq);
}
}

View File

@@ -1,42 +1,54 @@
package com.kamco.cd.kamcoback.postgres.entity;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.CommonDateEntity;
import jakarta.persistence.*;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.validation.constraints.Size;
import java.time.OffsetDateTime;
import lombok.Getter;
import lombok.Setter;
import java.time.ZonedDateTime;
import org.hibernate.annotations.ColumnDefault;
@Getter
@Setter
@Entity
@Table(name = "tb_map_sheet_mng")
public class MapSheetMngEntity extends CommonDateEntity {
public class MapSheetMngEntity {
@Id
@Column(name = "mng_yyyy")
private Integer mngYyyy;
@Column(name = "mng_yyyy", nullable = false)
private Integer id;
@Column(name = "mng_state")
@Enumerated(EnumType.STRING)
private MapSheetMngDto.MngState mngState;
@Size(max = 20)
@Column(name = "mng_state", length = 20)
private String mngState;
@Column(name = "sync_state")
@Enumerated(EnumType.STRING)
private MapSheetMngDto.SyncState syncState;
@Size(max = 20)
@Column(name = "sync_state", length = 20)
private String syncState;
@Column(name = "mng_state_dttm")
private ZonedDateTime mngStateDttm;
private OffsetDateTime mngStateDttm;
@Column(name = "sync_state_dttm")
private ZonedDateTime syncStateDttm;
private OffsetDateTime syncStateDttm;
@Column(name = "created_dttm")
private OffsetDateTime createdDttm;
@Column(name = "created_uid")
private Long createdUid;
@Column(name = "updated_dttm")
private OffsetDateTime updatedDttm;
@Column(name = "updated_uid")
private Long updatedUid;
@Size(max = 255)
@ColumnDefault("'NULL::character varying'")
@Column(name = "mng_path")
private String mngPath;
}

View File

@@ -1,12 +1,12 @@
package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngEntity;
import jakarta.validation.Valid;
import org.springframework.data.domain.Page;
import java.util.List;
public interface MapSheetMngRepositoryCustom {
Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(MapSheetMngDto.@Valid searchReq searchReq);
Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq);
}

View File

@@ -2,6 +2,7 @@ package com.kamco.cd.kamcoback.postgres.repository.mapsheet;
import com.kamco.cd.kamcoback.mapsheet.dto.MapSheetMngDto;
import com.kamco.cd.kamcoback.postgres.entity.MapSheetMngHstEntity;
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.Expressions;
@@ -84,6 +85,55 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
return new PageImpl<>(foundContent, pageable, countQuery);
}
@Override
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.@Valid searchReq searchReq) {
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
List<MapSheetMngDto.MngDto> foundContent = queryFactory
.select(
Projections.constructor(
MapSheetMngDto.MngDto.class,
Expressions.numberTemplate(Integer.class, "row_number() over(order by {0} desc)", mapSheetMngEntity.createdDttm)
/*
mapSheetMngEntity.id,
mapSheetMngEntity.mngState,
mapSheetMngEntity.syncState,
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.mngStateDttm),
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.syncStateDttm),
10,
20,
(Expression<?>) mapSheetMngEntity.mngPath,
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.createdDttm),
mapSheetMngEntity.createdUid,
Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD HH24:MI:SS')", mapSheetMngEntity.updatedDttm),
mapSheetMngEntity.updatedUid
*/
)
)
.from(mapSheetMngEntity)
.where(
mapSheetMngEntity.id.eq(searchReq.getMngYyyy()),
mapSheetErrorSearchValue(searchReq)
)
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.orderBy(mapSheetMngEntity.createdDttm.desc())
.fetch();
Long countQuery = queryFactory
.select(mapSheetMngEntity.id.count())
.from(mapSheetMngEntity)
.where(
mapSheetMngEntity.id.eq(searchReq.getMngYyyy()),
mapSheetErrorSearchValue(searchReq)
)
.fetchOne();
return new PageImpl<>(foundContent, pageable, countQuery);
}
private NumberExpression<Integer> rowNum(){
return Expressions.numberTemplate(Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);
}
@@ -97,4 +147,18 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
return Expressions.booleanTemplate("{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetName)
.or(Expressions.booleanTemplate("{0} like '%" + searchReq.getSearchValue() + "%'", mapSheetMngHstEntity.mapSheetNum));
}
private NumberExpression<Integer> mngRowNum(){
return Expressions.numberTemplate(Integer.class, "row_number() over(order by {0} desc)", mapSheetMngEntity.createdDttm);
}
private BooleanExpression mapSheetMngSearchValue(MapSheetMngDto.searchReq searchReq) {
if (Objects.isNull(searchReq.getSearchValue())) {
return null;
}
// 검색어 1개 값이 도엽명 or 도엽번호 like 검색
return Expressions.booleanTemplate("{0} = " + searchReq.getSearchValue() , mapSheetMngEntity.id);
}
}