Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -265,7 +265,7 @@ public class DdlService extends BaseService {
|
||||
params.put("limit", Math.min(limit, 200));
|
||||
params.put("user_id", userId);
|
||||
params.put("ddl_type", ddlType);
|
||||
return sqlSession.selectList(NS + "select_ddl_logs", params);
|
||||
return sqlSession.selectList(NS + "selectDdlLogs", params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getDdlStatistics(String fromDate, String toDate) {
|
||||
@@ -273,10 +273,10 @@ public class DdlService extends BaseService {
|
||||
params.put("from_date", fromDate);
|
||||
params.put("to_date", toDate);
|
||||
|
||||
Map<String, Object> totalStats = sqlSession.selectOne(NS + "select_ddl_total_stats", params);
|
||||
List<Map<String, Object>> byType = sqlSession.selectList(NS + "select_ddl_stats_by_type", params);
|
||||
List<Map<String, Object>> byUser = sqlSession.selectList(NS + "select_ddl_stats_by_user", params);
|
||||
List<Map<String, Object>> recentFailures = sqlSession.selectList(NS + "select_recent_failures", params);
|
||||
Map<String, Object> totalStats = sqlSession.selectOne(NS + "selectDdlTotalStats", params);
|
||||
List<Map<String, Object>> byType = sqlSession.selectList(NS + "selectDdlStatsByType", params);
|
||||
List<Map<String, Object>> byUser = sqlSession.selectList(NS + "selectDdlStatsByUser", params);
|
||||
List<Map<String, Object>> recentFailures = sqlSession.selectList(NS + "selectRecentFailures", params);
|
||||
|
||||
Map<String, Long> byDdlType = new LinkedHashMap<>();
|
||||
for (Map<String, Object> row : byType) {
|
||||
@@ -300,15 +300,15 @@ public class DdlService extends BaseService {
|
||||
public List<Map<String, Object>> getTableDdlHistory(String tableName) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("table_name", tableName);
|
||||
return sqlSession.selectList(NS + "select_table_ddl_history", params);
|
||||
return sqlSession.selectList(NS + "selectTableDdlHistory", params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getTableInfo(String tableName) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("table_name", tableName);
|
||||
Map<String, Object> tableInfo = sqlSession.selectOne(NS + "select_table_info", params);
|
||||
Map<String, Object> tableInfo = sqlSession.selectOne(NS + "selectTableInfo", params);
|
||||
if (tableInfo == null) return null;
|
||||
List<Map<String, Object>> columns = sqlSession.selectList(NS + "select_table_columns", params);
|
||||
List<Map<String, Object>> columns = sqlSession.selectList(NS + "selectTableColumns", params);
|
||||
return Map.of("table_info", tableInfo, "columns", columns);
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ public class DdlService extends BaseService {
|
||||
LocalDateTime cutoff = LocalDateTime.now().minusDays(retentionDays);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("cutoff_date", cutoff.format(DateTimeFormatter.ISO_LOCAL_DATE_TIME));
|
||||
int deleted = sqlSession.delete(NS + "delete_old_ddl_logs", params);
|
||||
int deleted = sqlSession.delete(NS + "deleteOldDdlLogs", params);
|
||||
log.info("DDL 로그 정리 완료: {}개 삭제, 보존 기간: {}일", deleted, retentionDays);
|
||||
return deleted;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ public class DdlService extends BaseService {
|
||||
params.put("ddl_query", ddlQuery);
|
||||
params.put("success", success);
|
||||
params.put("error_message", errorMessage);
|
||||
sqlSession.insert(NS + "insert_ddl_log", params);
|
||||
sqlSession.insert(NS + "insertDdlLog", params);
|
||||
} catch (Exception e) {
|
||||
log.error("DDL 로그 기록 실패: userId={}, ddlType={}, tableName={}", userId, ddlType, tableName, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user