diff --git a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java index 6735fef5..d4948c5d 100644 --- a/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java +++ b/src/main/java/com/kamco/cd/kamcoback/postgres/repository/Inference/InferenceResultRepositoryImpl.java @@ -24,7 +24,6 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC @Override public Long upsertGroupsFromMapSheetAnal(Long id) { - // id = learn 테이블 id String sql = """ INSERT INTO tb_map_sheet_anal_inference ( @@ -54,12 +53,12 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC :pendingStateId FROM tb_map_sheet_learn r WHERE r.id = :id - ON CONFLICT (learn_id, compare_yyyy, target_yyyy) + ON CONFLICT (stage, compare_yyyy, target_yyyy) DO UPDATE SET detecting_cnt = EXCLUDED.detecting_cnt, anal_title = EXCLUDED.anal_title, - stage = EXCLUDED.stage, - updated_dttm = now() + updated_dttm = now(), + learn_id = EXCLUDED.learn_id RETURNING anal_uid """; @@ -118,8 +117,9 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC msl.target_yyyy, r.map_id, msl.stage - ON CONFLICT (anal_uid, compare_yyyy, target_yyyy, map_sheet_num) + ON CONFLICT (stage, compare_yyyy, target_yyyy, map_sheet_num) DO UPDATE SET + anal_uid = EXCLUDED.anal_uid, ref_map_sheet_num = EXCLUDED.ref_map_sheet_num, updated_dttm = now() """; @@ -212,11 +212,11 @@ public class InferenceResultRepositoryImpl implements InferenceResultRepositoryC AND r.map_id ~ '^[0-9]+$' AND r.map_id::bigint = msadi.map_sheet_num WHERE msl.anal_uid = :analUid + AND r.after_c is not null + AND r.after_p is not null AND r.probability is not null AND r.before_c is not null AND r.before_p is not null - AND r.after_c is not null - AND r.after_p is not null ORDER BY r.uid, r.created_date DESC NULLS LAST ) x ON CONFLICT (result_uid)