|
|
|
|
@@ -34,18 +34,15 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
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);
|
|
|
|
|
this.queryFactory = queryFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(
|
|
|
|
|
MapSheetMngDto.MngSearchReq searchReq) {
|
|
|
|
|
public Page<MapSheetMngDto.MngDto> findMapSheetMngList(MapSheetMngDto.MngSearchReq searchReq) {
|
|
|
|
|
|
|
|
|
|
Pageable pageable = searchReq.toPageable();
|
|
|
|
|
BooleanBuilder whereBuilder = new BooleanBuilder();
|
|
|
|
|
@@ -116,73 +113,67 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
|
|
|
|
|
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
|
|
|
|
MapSheetMngDto.@Valid ErrorSearchReq searchReq) {
|
|
|
|
|
|
|
|
|
|
Pageable pageable = PageRequest.of(searchReq.getPage(), searchReq.getSize());
|
|
|
|
|
List<MapSheetMngDto.ErrorDataDto> foundContent =
|
|
|
|
|
queryFactory
|
|
|
|
|
.select(
|
|
|
|
|
Projections.constructor(
|
|
|
|
|
MapSheetMngDto.ErrorDataDto.class,
|
|
|
|
|
mapSheetMngHstEntity.hstUid,
|
|
|
|
|
rowNum(),
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"concat({0}, {1})",
|
|
|
|
|
mapSheetMngHstEntity.mapSheetName, mapInkx50kEntity.mapidcdNo),
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"concat({0}, substring({1}, {2}, {3}))",
|
|
|
|
|
mapSheetMngHstEntity.mapSheetName, mapSheetMngHstEntity.mapSheetNum, 6, 8),
|
|
|
|
|
mapSheetMngHstEntity.mapSheetCodeSrc,
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
|
|
|
|
|
mapSheetMngHstEntity.dataState))
|
|
|
|
|
.from(mapSheetMngHstEntity)
|
|
|
|
|
.innerJoin(mapInkx5kEntity)
|
|
|
|
|
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
|
|
|
|
.leftJoin(mapInkx50kEntity)
|
|
|
|
|
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
|
|
|
|
.where(
|
|
|
|
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
|
|
|
|
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
|
|
|
|
mapSheetErrorSearchValue(searchReq))
|
|
|
|
|
.offset(pageable.getOffset())
|
|
|
|
|
.limit(pageable.getPageSize())
|
|
|
|
|
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
|
|
|
|
.fetch();
|
|
|
|
|
queryFactory
|
|
|
|
|
.select(
|
|
|
|
|
Projections.constructor(
|
|
|
|
|
MapSheetMngDto.ErrorDataDto.class,
|
|
|
|
|
mapSheetMngHstEntity.hstUid,
|
|
|
|
|
rowNum(),
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"concat({0}, {1})",
|
|
|
|
|
mapSheetMngHstEntity.mapSheetName, mapInkx50kEntity.mapidcdNo),
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"concat({0}, substring({1}, {2}, {3}))",
|
|
|
|
|
mapSheetMngHstEntity.mapSheetName, mapSheetMngHstEntity.mapSheetNum, 6, 8),
|
|
|
|
|
mapSheetMngHstEntity.mapSheetCodeSrc,
|
|
|
|
|
Expressions.stringTemplate(
|
|
|
|
|
"to_char({0}, 'YYYY-MM-DD')", mapSheetMngHstEntity.createdDate),
|
|
|
|
|
mapSheetMngHstEntity.dataState))
|
|
|
|
|
.from(mapSheetMngHstEntity)
|
|
|
|
|
.innerJoin(mapInkx5kEntity)
|
|
|
|
|
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
|
|
|
|
.leftJoin(mapInkx50kEntity)
|
|
|
|
|
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
|
|
|
|
.where(
|
|
|
|
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
|
|
|
|
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
|
|
|
|
mapSheetErrorSearchValue(searchReq))
|
|
|
|
|
.offset(pageable.getOffset())
|
|
|
|
|
.limit(pageable.getPageSize())
|
|
|
|
|
.orderBy(mapSheetMngHstEntity.createdDate.desc())
|
|
|
|
|
.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.longValue()))
|
|
|
|
|
.where(
|
|
|
|
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
|
|
|
|
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
|
|
|
|
mapSheetErrorSearchValue(searchReq))
|
|
|
|
|
.fetchOne();
|
|
|
|
|
queryFactory
|
|
|
|
|
.select(mapSheetMngHstEntity.hstUid.count())
|
|
|
|
|
.from(mapSheetMngHstEntity)
|
|
|
|
|
.innerJoin(mapInkx5kEntity)
|
|
|
|
|
.on(mapSheetMngHstEntity.mapSheetCode.eq(mapInkx5kEntity.fid))
|
|
|
|
|
.leftJoin(mapInkx50kEntity)
|
|
|
|
|
.on(mapInkx5kEntity.fidK50.eq(mapInkx50kEntity.fid.longValue()))
|
|
|
|
|
.where(
|
|
|
|
|
mapSheetMngHstEntity.mngYyyy.eq(searchReq.getMngYyyy()),
|
|
|
|
|
// mapSheetMngHstEntity.dataState.eq(MapSheetMngDto.DataState.FAIL), // 오류만 검색
|
|
|
|
|
mapSheetErrorSearchValue(searchReq))
|
|
|
|
|
.fetchOne();
|
|
|
|
|
|
|
|
|
|
return new PageImpl<>(foundContent, pageable, countQuery);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void deleteMngAll(int mngYyyy){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public void deleteMngAll(int mngYyyy) {}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int insertMapSheetOrgDataToMapSheetMngHst(int mngYyyy) {
|
|
|
|
|
|
|
|
|
|
String sql = """
|
|
|
|
|
String sql =
|
|
|
|
|
"""
|
|
|
|
|
INSERT INTO tb_map_sheet_mng_hst
|
|
|
|
|
(
|
|
|
|
|
mng_yyyy
|
|
|
|
|
@@ -214,7 +205,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
int exeCnt = query.executeUpdate(); // 실행 (영향받은 행의 개수 반환)
|
|
|
|
|
|
|
|
|
|
return exeCnt;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -226,8 +216,6 @@ public class MapSheetMngRepositoryImpl extends QuerydslRepositorySupport
|
|
|
|
|
.fetchOne());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private NumberExpression<Integer> rowNum() {
|
|
|
|
|
return Expressions.numberTemplate(
|
|
|
|
|
Integer.class, "row_number() over(order by {0} desc)", mapSheetMngHstEntity.createdDate);
|
|
|
|
|
|