[agent-pipeline] pipe-20260328153638-axu2 round-1
This commit is contained in:
@@ -27,8 +27,8 @@ public class CodeMergeService extends BaseService {
|
||||
*/
|
||||
public Map<String, Object> getTablesWithColumn(String columnName) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("columnName", columnName);
|
||||
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getTablesWithColumn", params);
|
||||
params.put("column_name", columnName);
|
||||
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_tables_with_column", params);
|
||||
|
||||
List<String> tables = rows.stream()
|
||||
.map(r -> {
|
||||
@@ -39,7 +39,7 @@ public class CodeMergeService extends BaseService {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("columnName", columnName);
|
||||
result.put("column_name", columnName);
|
||||
result.put("tables", tables);
|
||||
result.put("count", tables.size());
|
||||
return result;
|
||||
@@ -52,9 +52,9 @@ public class CodeMergeService extends BaseService {
|
||||
* columnName + oldValue 기준으로 영향받을 테이블/행 수 미리보기 (DB 변경 없음)
|
||||
*/
|
||||
public Map<String, Object> previewCodeMerge(Map<String, Object> body) {
|
||||
String columnName = str(body.get("columnName"));
|
||||
String oldValue = str(body.get("oldValue"));
|
||||
String companyCode = str(body.get("companyCode"));
|
||||
String columnName = str(body.get("column_name"));
|
||||
String oldValue = str(body.get("old_value"));
|
||||
String companyCode = str(body.get("company_code"));
|
||||
|
||||
if (isBlank(columnName) || isBlank(oldValue)) {
|
||||
throw new IllegalArgumentException("필수 필드가 누락되었습니다. (columnName, oldValue)");
|
||||
@@ -63,8 +63,8 @@ public class CodeMergeService extends BaseService {
|
||||
log.info("코드 병합 미리보기: column={}, oldValue={}, company={}", columnName, oldValue, companyCode);
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("columnName", columnName);
|
||||
List<Map<String, Object>> tableRows = sqlSession.selectList(NS + "getTablesWithColumn", params);
|
||||
params.put("column_name", columnName);
|
||||
List<Map<String, Object>> tableRows = sqlSession.selectList(NS + "get_tables_with_column", params);
|
||||
|
||||
List<Map<String, Object>> preview = new ArrayList<>();
|
||||
int totalRows = 0;
|
||||
@@ -82,8 +82,8 @@ public class CodeMergeService extends BaseService {
|
||||
Integer count = jdbcTemplate.queryForObject(countSql, Integer.class, oldValue, companyCode);
|
||||
if (count != null && count > 0) {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("tableName", tableName);
|
||||
item.put("affectedRows", count);
|
||||
item.put("table_name", tableName);
|
||||
item.put("affected_rows", count);
|
||||
preview.add(item);
|
||||
totalRows += count;
|
||||
}
|
||||
@@ -93,10 +93,10 @@ public class CodeMergeService extends BaseService {
|
||||
}
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("columnName", columnName);
|
||||
result.put("oldValue", oldValue);
|
||||
result.put("column_name", columnName);
|
||||
result.put("old_value", oldValue);
|
||||
result.put("preview", preview);
|
||||
result.put("totalAffectedRows", totalRows);
|
||||
result.put("total_affected_rows", totalRows);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -108,10 +108,10 @@ public class CodeMergeService extends BaseService {
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> mergeAllTables(Map<String, Object> body) {
|
||||
String columnName = str(body.get("columnName"));
|
||||
String oldValue = str(body.get("oldValue"));
|
||||
String newValue = str(body.get("newValue"));
|
||||
String companyCode = str(body.get("companyCode"));
|
||||
String columnName = str(body.get("column_name"));
|
||||
String oldValue = str(body.get("old_value"));
|
||||
String newValue = str(body.get("new_value"));
|
||||
String companyCode = str(body.get("company_code"));
|
||||
|
||||
if (isBlank(columnName) || isBlank(oldValue) || isBlank(newValue)) {
|
||||
throw new IllegalArgumentException("필수 필드가 누락되었습니다. (columnName, oldValue, newValue)");
|
||||
@@ -132,19 +132,19 @@ public class CodeMergeService extends BaseService {
|
||||
|
||||
List<Map<String, Object>> affectedTables = rows.stream().map(r -> {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("tableName", r.get("table_name"));
|
||||
item.put("rowsUpdated", r.get("rows_updated") != null ? ((Number) r.get("rows_updated")).intValue() : 0);
|
||||
item.put("table_name", r.get("table_name"));
|
||||
item.put("rows_updated", r.get("rows_updated") != null ? ((Number) r.get("rows_updated")).intValue() : 0);
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
log.info("코드 병합 완료: 영향 테이블 {}개, 총 {}행", affectedTables.size(), totalRows);
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("columnName", columnName);
|
||||
result.put("oldValue", oldValue);
|
||||
result.put("newValue", newValue);
|
||||
result.put("affectedTables", affectedTables);
|
||||
result.put("totalRowsUpdated", totalRows);
|
||||
result.put("column_name", columnName);
|
||||
result.put("old_value", oldValue);
|
||||
result.put("new_value", newValue);
|
||||
result.put("affected_tables", affectedTables);
|
||||
result.put("total_rows_updated", totalRows);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -157,9 +157,9 @@ public class CodeMergeService extends BaseService {
|
||||
*/
|
||||
@Transactional
|
||||
public Map<String, Object> mergeByValue(Map<String, Object> body) {
|
||||
String oldValue = str(body.get("oldValue"));
|
||||
String newValue = str(body.get("newValue"));
|
||||
String companyCode = str(body.get("companyCode"));
|
||||
String oldValue = str(body.get("old_value"));
|
||||
String newValue = str(body.get("new_value"));
|
||||
String companyCode = str(body.get("company_code"));
|
||||
|
||||
if (isBlank(oldValue) || isBlank(newValue)) {
|
||||
throw new IllegalArgumentException("필수 필드가 누락되었습니다. (oldValue, newValue)");
|
||||
@@ -180,19 +180,19 @@ public class CodeMergeService extends BaseService {
|
||||
|
||||
List<Map<String, Object>> affectedData = rows.stream().map(r -> {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("tableName", r.get("out_table_name"));
|
||||
item.put("columnName", r.get("out_column_name"));
|
||||
item.put("rowsUpdated", r.get("out_rows_updated") != null ? ((Number) r.get("out_rows_updated")).intValue() : 0);
|
||||
item.put("table_name", r.get("out_table_name"));
|
||||
item.put("column_name", r.get("out_column_name"));
|
||||
item.put("rows_updated", r.get("out_rows_updated") != null ? ((Number) r.get("out_rows_updated")).intValue() : 0);
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
log.info("값 기반 코드 병합 완료: {} → {}, 총 {}행", oldValue, newValue, totalRows);
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("oldValue", oldValue);
|
||||
result.put("newValue", newValue);
|
||||
result.put("affectedData", affectedData);
|
||||
result.put("totalRowsUpdated", totalRows);
|
||||
result.put("old_value", oldValue);
|
||||
result.put("new_value", newValue);
|
||||
result.put("affected_data", affectedData);
|
||||
result.put("total_rows_updated", totalRows);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -203,8 +203,8 @@ public class CodeMergeService extends BaseService {
|
||||
* PostgreSQL 함수 preview_merge_code_by_value(oldValue, companyCode) 호출
|
||||
*/
|
||||
public Map<String, Object> previewByValue(Map<String, Object> body) {
|
||||
String oldValue = str(body.get("oldValue"));
|
||||
String companyCode = str(body.get("companyCode"));
|
||||
String oldValue = str(body.get("old_value"));
|
||||
String companyCode = str(body.get("company_code"));
|
||||
|
||||
if (isBlank(oldValue)) {
|
||||
throw new IllegalArgumentException("필수 필드가 누락되었습니다. (oldValue)");
|
||||
@@ -222,16 +222,16 @@ public class CodeMergeService extends BaseService {
|
||||
|
||||
List<Map<String, Object>> preview = rows.stream().map(r -> {
|
||||
Map<String, Object> item = new LinkedHashMap<>();
|
||||
item.put("tableName", r.get("out_table_name"));
|
||||
item.put("columnName", r.get("out_column_name"));
|
||||
item.put("affectedRows", r.get("out_affected_rows") != null ? ((Number) r.get("out_affected_rows")).intValue() : 0);
|
||||
item.put("table_name", r.get("out_table_name"));
|
||||
item.put("column_name", r.get("out_column_name"));
|
||||
item.put("affected_rows", r.get("out_affected_rows") != null ? ((Number) r.get("out_affected_rows")).intValue() : 0);
|
||||
return item;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
result.put("oldValue", oldValue);
|
||||
result.put("old_value", oldValue);
|
||||
result.put("preview", preview);
|
||||
result.put("totalAffectedRows", totalRows);
|
||||
result.put("total_affected_rows", totalRows);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user