도엽 테이블 컬럼 수정된 사항 맞추기

This commit is contained in:
2025-12-30 10:07:56 +09:00
parent cbbc934f98
commit 34ee60b908
5 changed files with 581 additions and 580 deletions

View File

@@ -24,7 +24,7 @@ public class MapInkxMngCoreService {
// 목록 // 목록
public Page<MapInkxMngDto.MapList> findMapInkxMngList( public Page<MapInkxMngDto.MapList> findMapInkxMngList(
MapInkxMngDto.searchReq searchReq, String useInference, String searchVal) { MapInkxMngDto.searchReq searchReq, String useInference, String searchVal) {
return mapInkx5kRepository.findMapInkxMngList(searchReq, useInference, searchVal); return mapInkx5kRepository.findMapInkxMngList(searchReq, useInference, searchVal);
} }
@@ -43,9 +43,9 @@ public class MapInkxMngCoreService {
} }
MapInkx5kEntity entity = MapInkx5kEntity entity =
new MapInkx5kEntity( new MapInkx5kEntity(
req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k.longValue(), "USE" // 기본은 USE로 req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k, "USE" // 기본은 USE로
); );
mapInkx5kRepository.save(entity); mapInkx5kRepository.save(entity);
@@ -54,10 +54,10 @@ public class MapInkxMngCoreService {
public ResponseObj updateUseInference(@Valid UseInferReq useInferReq) { public ResponseObj updateUseInference(@Valid UseInferReq useInferReq) {
Optional<MapInkx5kEntity> entity = Optional<MapInkx5kEntity> entity =
Optional.ofNullable( Optional.ofNullable(
mapInkx5kRepository mapInkx5kRepository
.findByMapidCdNoInfo(useInferReq.getMapidcdNo()) .findByMapidCdNoInfo(useInferReq.getMapidcdNo())
.orElseThrow(() -> new EntityNotFoundException("도엽정보를 찾을 수 없습니다."))); .orElseThrow(() -> new EntityNotFoundException("도엽정보를 찾을 수 없습니다.")));
entity.get().updateUseInference(useInferReq.getUseInference()); entity.get().updateUseInference(useInferReq.getUseInference());
return new ResponseObj(ApiResponseCode.OK, ""); return new ResponseObj(ApiResponseCode.OK, "");

View File

@@ -25,9 +25,9 @@ public class MapInkx5kEntity extends CommonDateEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_inkx_5k_fid_seq_gen") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_inkx_5k_fid_seq_gen")
@SequenceGenerator( @SequenceGenerator(
name = "tb_map_inkx_5k_fid_seq_gen", name = "tb_map_inkx_5k_fid_seq_gen",
sequenceName = "tb_map_inkx_5k_fid_seq", sequenceName = "tb_map_inkx_5k_fid_seq",
allocationSize = 1) allocationSize = 1)
private Integer fid; private Integer fid;
@Column(name = "mapidcd_no") @Column(name = "mapidcd_no")
@@ -40,13 +40,13 @@ public class MapInkx5kEntity extends CommonDateEntity {
private Geometry geom; private Geometry geom;
@Column(name = "fid_k50") @Column(name = "fid_k50")
private Long fidK50; private Integer fidK50;
@Column(name = "use_inference") @Column(name = "use_inference")
private String useInference; private String useInference;
public MapInkx5kEntity( public MapInkx5kEntity(
String mapidcdNo, String mapidNm, Geometry geom, Long fidK50, String useInference) { String mapidcdNo, String mapidNm, Geometry geom, Integer fidK50, String useInference) {
this.mapidcdNo = mapidcdNo; this.mapidcdNo = mapidcdNo;
this.mapidNm = mapidNm; this.mapidNm = mapidNm;
this.geom = geom; this.geom = geom;

View File

@@ -21,7 +21,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport; import org.springframework.data.jpa.repository.support.QuerydslRepositorySupport;
public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
implements MapInkx5kRepositoryCustom { implements MapInkx5kRepositoryCustom {
private final JPAQueryFactory queryFactory; private final JPAQueryFactory queryFactory;
@@ -34,53 +34,53 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
QMapInkx5kEntity map5k = QMapInkx5kEntity.mapInkx5kEntity; QMapInkx5kEntity map5k = QMapInkx5kEntity.mapInkx5kEntity;
return queryFactory return queryFactory
.selectFrom(map5k) .selectFrom(map5k)
.where(map5k.mapidcdNo.in(codes)) .where(map5k.mapidcdNo.in(codes))
.orderBy(map5k.mapidcdNo.asc()) .orderBy(map5k.mapidcdNo.asc())
.fetch(); .fetch();
} }
@Override @Override
public Page<MapList> findMapInkxMngList( public Page<MapList> findMapInkxMngList(
searchReq searchReq, String useInference, String searchVal) { searchReq searchReq, String useInference, String searchVal) {
Pageable pageable = searchReq.toPageable(); Pageable pageable = searchReq.toPageable();
List<MapInkxMngDto.MapList> foundContent = List<MapInkxMngDto.MapList> foundContent =
queryFactory queryFactory
.select( .select(
Projections.constructor( Projections.constructor(
MapInkxMngDto.MapList.class, MapInkxMngDto.MapList.class,
Expressions.numberTemplate( Expressions.numberTemplate(
Integer.class, Integer.class,
"row_number() over(order by {0} asc)", "row_number() over(order by {0} asc)",
mapInkx5kEntity.mapidcdNo), mapInkx5kEntity.mapidcdNo),
mapInkx5kEntity.mapidcdNo, mapInkx5kEntity.mapidcdNo,
mapInkx50kEntity.mapidcdNo, mapInkx50kEntity.mapidcdNo,
mapInkx5kEntity.mapidNm, mapInkx5kEntity.mapidNm,
mapInkx5kEntity.createdDate, mapInkx5kEntity.createdDate,
mapInkx5kEntity.modifiedDate, mapInkx5kEntity.modifiedDate,
// Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')",
// mapInkx5kEntity.createdDate), // mapInkx5kEntity.createdDate),
// Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')", // Expressions.stringTemplate("to_char({0}, 'YYYY-MM-DD')",
// mapInkx5kEntity.modifiedDate), // mapInkx5kEntity.modifiedDate),
mapInkx5kEntity.useInference)) mapInkx5kEntity.useInference))
.from(mapInkx5kEntity) .from(mapInkx5kEntity)
.innerJoin(mapInkx50kEntity) .innerJoin(mapInkx50kEntity)
.on(mapInkx5kEntity.fidK50.intValue().eq(mapInkx50kEntity.fid)) .on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid))
.where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) .where(searchUseInference(useInference), searchValueMapCdNm(searchVal))
.offset(pageable.getOffset()) .offset(pageable.getOffset())
.limit(pageable.getPageSize()) .limit(pageable.getPageSize())
.orderBy(mapInkx5kEntity.mapidcdNo.asc()) .orderBy(mapInkx5kEntity.mapidcdNo.asc())
.fetch(); .fetch();
Long countQuery = Long countQuery =
queryFactory queryFactory
.select(mapInkx5kEntity.count()) .select(mapInkx5kEntity.count())
.from(mapInkx5kEntity) .from(mapInkx5kEntity)
.innerJoin(mapInkx50kEntity) .innerJoin(mapInkx50kEntity)
.on(mapInkx5kEntity.fidK50.intValue().eq(mapInkx50kEntity.fid)) .on(mapInkx5kEntity.fidK50.intValue().eq(mapInkx50kEntity.fid))
.where(searchUseInference(useInference), searchValueMapCdNm(searchVal)) .where(searchUseInference(useInference), searchValueMapCdNm(searchVal))
.fetchOne(); .fetchOne();
return new PageImpl<>(foundContent, pageable, countQuery); return new PageImpl<>(foundContent, pageable, countQuery);
} }
@@ -88,19 +88,19 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
@Override @Override
public Long findByMapidCdNoExists(String mapidcdNo) { public Long findByMapidCdNoExists(String mapidcdNo) {
return queryFactory return queryFactory
.select(mapInkx5kEntity.count()) .select(mapInkx5kEntity.count())
.from(mapInkx5kEntity) .from(mapInkx5kEntity)
.where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo))
.fetchOne(); .fetchOne();
} }
@Override @Override
public Optional<MapInkx5kEntity> findByMapidCdNoInfo(String mapidcdNo) { public Optional<MapInkx5kEntity> findByMapidCdNoInfo(String mapidcdNo) {
return Optional.ofNullable( return Optional.ofNullable(
queryFactory queryFactory
.selectFrom(mapInkx5kEntity) .selectFrom(mapInkx5kEntity)
.where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo)) .where(mapInkx5kEntity.mapidcdNo.eq(mapidcdNo))
.fetchOne()); .fetchOne());
} }
private BooleanExpression searchUseInference(String useInference) { private BooleanExpression searchUseInference(String useInference) {
@@ -115,8 +115,8 @@ public class MapInkx5kRepositoryImpl extends QuerydslRepositorySupport
return null; return null;
} }
return mapInkx5kEntity return mapInkx5kEntity
.mapidcdNo .mapidcdNo
.like("%" + searchVal + "%") .like("%" + searchVal + "%")
.or(mapInkx5kEntity.mapidNm.like("%" + searchVal + "%")); .or(mapInkx5kEntity.mapidNm.like("%" + searchVal + "%"));
} }
} }

View File

@@ -48,7 +48,7 @@ public class MapInkxMngDto {
private String mapidcdNo; private String mapidcdNo;
private String mapidNm; private String mapidNm;
private JsonNode geom; private JsonNode geom;
private Long fidK50; private Integer fidK50;
private String useInference; private String useInference;
private ZonedDateTime createdDttm; private ZonedDateTime createdDttm;
private ZonedDateTime updatedDttm; private ZonedDateTime updatedDttm;
@@ -72,28 +72,28 @@ public class MapInkxMngDto {
// 목록 Querydsl 에서 리턴 받는 건 생성자 기준임 -> 쿼리 컬럼 그대로 받고 여기서 Java 형변환 해서 return 하기 // 목록 Querydsl 에서 리턴 받는 건 생성자 기준임 -> 쿼리 컬럼 그대로 받고 여기서 Java 형변환 해서 return 하기
public MapList( public MapList(
Integer rowNum, Integer rowNum,
String mapidcdNo5k, String mapidcdNo5k,
String mapidcdNo50k, String mapidcdNo50k,
String mapidNm, String mapidNm,
ZonedDateTime createdDttmTime, ZonedDateTime createdDttmTime,
ZonedDateTime updatedDttmTime, ZonedDateTime updatedDttmTime,
String useInference) { String useInference) {
this.rowNum = rowNum; this.rowNum = rowNum;
this.mapidcdNo5k = mapidcdNo5k; this.mapidcdNo5k = mapidcdNo5k;
this.mapidcdNo50k = mapidcdNo50k; this.mapidcdNo50k = mapidcdNo50k;
this.mapidNm = mapidNm; this.mapidNm = mapidNm;
DateTimeFormatter fmt = 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.createdDttm = fmt.format(createdDttmTime);
this.updatedDttm = fmt.format(updatedDttmTime); this.updatedDttm = fmt.format(updatedDttmTime);
this.createdDttmTime = createdDttmTime; this.createdDttmTime = createdDttmTime;
this.updatedDttmTime = updatedDttmTime; this.updatedDttmTime = updatedDttmTime;
this.useInference = this.useInference =
useInference.equals("USE") useInference.equals("USE")
? UseInferenceType.USE.getDesc() ? UseInferenceType.USE.getDesc()
: UseInferenceType.EXCEPT.getDesc(); : UseInferenceType.EXCEPT.getDesc();
} }
} }
@@ -114,7 +114,7 @@ public class MapInkxMngDto {
String[] sortParams = sort.split(","); String[] sortParams = sort.split(",");
String property = sortParams[0]; String property = sortParams[0];
Sort.Direction direction = 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, Sort.by(direction, property));
} }
return PageRequest.of(page, size); return PageRequest.of(page, size);
@@ -135,12 +135,12 @@ public class MapInkxMngDto {
private String mapidNm; private String mapidNm;
@Schema( @Schema(
description = "좌표 목록 (한 줄에 한 점, '경도 위도' 형식)", description = "좌표 목록 (한 줄에 한 점, '경도 위도' 형식)",
example = example =
"127.17500001632317 36.17499998262991\n" "127.17500001632317 36.17499998262991\n"
+ "127.14999995475043 36.17500002877932\n" + "127.14999995475043 36.17500002877932\n"
+ "127.15000004313612 36.199999984012415\n" + "127.15000004313612 36.199999984012415\n"
+ "127.1750000466954 36.20000001863179") + "127.1750000466954 36.20000001863179")
private String coordinates; private String coordinates;
} }