도엽 테이블 컬럼 수정된 사항 맞추기
This commit is contained in:
@@ -24,7 +24,7 @@ public class MapInkxMngCoreService {
|
||||
|
||||
// 목록
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ public class MapInkxMngCoreService {
|
||||
}
|
||||
|
||||
MapInkx5kEntity entity =
|
||||
new MapInkx5kEntity(
|
||||
req.getMapidcdNo(), req.getMapidNm(), map_polygon, fid50k.longValue(), "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<MapInkx5kEntity> 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, "");
|
||||
|
||||
@@ -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")
|
||||
@@ -40,13 +40,13 @@ public class MapInkx5kEntity extends CommonDateEntity {
|
||||
private Geometry geom;
|
||||
|
||||
@Column(name = "fid_k50")
|
||||
private Long fidK50;
|
||||
private Integer fidK50;
|
||||
|
||||
@Column(name = "use_inference")
|
||||
private String useInference;
|
||||
|
||||
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.mapidNm = mapidNm;
|
||||
this.geom = geom;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<MapList> findMapInkxMngList(
|
||||
searchReq searchReq, String useInference, String searchVal) {
|
||||
searchReq searchReq, String useInference, String searchVal) {
|
||||
|
||||
Pageable pageable = searchReq.toPageable();
|
||||
List<MapInkxMngDto.MapList> 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.intValue().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<MapInkx5kEntity> 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 + "%"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ public class MapInkxMngDto {
|
||||
private String mapidcdNo;
|
||||
private String mapidNm;
|
||||
private JsonNode geom;
|
||||
private Long fidK50;
|
||||
private Integer fidK50;
|
||||
private String useInference;
|
||||
private ZonedDateTime createdDttm;
|
||||
private ZonedDateTime updatedDttm;
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user