Refactor code structure for improved readability and maintainability

This commit is contained in:
DDD1542
2026-03-31 09:34:54 +09:00
parent c465141f53
commit 87498b9940
141 changed files with 6275 additions and 1939 deletions
@@ -249,6 +249,21 @@ public class AdminController {
return ResponseEntity.ok(ApiResponse.success(adminService.saveUser(body), "사용자 수정 성공"));
}
/**
* DELETE /api/admin/users/{userId}
* 사용자 삭제 (비활성화)
*/
@DeleteMapping("/users/{userId}")
public ResponseEntity<ApiResponse<Void>> deleteUser(
@PathVariable String userId) {
Map<String, Object> existing = adminService.getUserInfo(userId);
if (existing == null) {
return ResponseEntity.status(404).body(ApiResponse.error("사용자를 찾을 수 없습니다."));
}
adminService.changeUserStatus(userId, "inactive");
return ResponseEntity.ok(ApiResponse.success(null, "사용자 삭제 성공"));
}
/**
* PATCH /api/admin/users/{userId}/status
* 사용자 상태 변경
@@ -84,6 +84,12 @@ public class BatchController {
body.put("company_code", companyCode);
body.put("created_by", userId);
body.put("updated_by", userId);
// API 필드명(cron_expression) → DB 필드명(cron_schedule) 매핑
if (body.containsKey("cron_expression") && !body.containsKey("cron_schedule")) {
body.put("cron_schedule", body.get("cron_expression"));
}
Map<String, Object> created = batchService.insertBatch(body);
return ResponseEntity.status(201).body(ApiResponse.success(created, "배치 설정이 성공적으로 생성되었습니다."));
}
@@ -97,6 +103,12 @@ public class BatchController {
body.put("company_code", companyCode);
body.put("updated_by", userId);
body.put("id", id);
// API 필드명(cron_expression) → DB 필드명(cron_schedule) 매핑
if (body.containsKey("cron_expression") && !body.containsKey("cron_schedule")) {
body.put("cron_schedule", body.get("cron_expression"));
}
Map<String, Object> updated = batchService.updateBatch(body);
return ResponseEntity.ok(ApiResponse.success(updated, "배치 설정이 성공적으로 수정되었습니다."));
}
@@ -42,7 +42,7 @@ public class NumberingRuleController {
@GetMapping("/available/{menuObjid}")
public ResponseEntity<ApiResponse<List<Map<String, Object>>>> getAvailableRulesForMenuWithId(
@RequestAttribute("company_code") String companyCode,
@PathVariable Integer menuObjid) {
@PathVariable String menuObjid) {
List<Map<String, Object>> list = numberingRuleService.getAvailableRulesForMenu(companyCode, menuObjid);
return ResponseEntity.ok(ApiResponse.success(list, "사용 가능한 채번 규칙을 조회했습니다."));
}
@@ -86,7 +86,7 @@ public class NumberingRuleController {
@GetMapping("/test/list/{menuObjid}")
public ResponseEntity<ApiResponse<List<Map<String, Object>>>> getRulesFromTestWithMenu(
@RequestAttribute("company_code") String companyCode,
@PathVariable Integer menuObjid) {
@PathVariable String menuObjid) {
List<Map<String, Object>> list = numberingRuleService.getRulesFromTest(companyCode, menuObjid);
return ResponseEntity.ok(ApiResponse.success(list, "테스트 채번 규칙 목록을 조회했습니다."));
}
@@ -97,6 +97,15 @@ public class RoleController {
Map<String, Object> params = new HashMap<>(body);
params.put("writer", userId);
params.put("objid", (int)(System.currentTimeMillis() % Integer.MAX_VALUE));
// API 필드명(role_name/role_code) → DB 필드명(auth_name/auth_code) 매핑
if (params.containsKey("role_name") && !params.containsKey("auth_name")) {
params.put("auth_name", params.get("role_name"));
}
if (params.containsKey("role_code") && !params.containsKey("auth_code")) {
params.put("auth_code", params.get("role_code"));
}
Map<String, Object> created = roleService.createRoleGroup(params);
return ResponseEntity.status(201).body(ApiResponse.success(created, "권한 그룹 생성 성공"));
@@ -130,6 +139,14 @@ public class RoleController {
Map<String, Object> params = new HashMap<>(body);
params.put("objid", parseLong(id));
// API 필드명(role_name/role_code) → DB 필드명(auth_name/auth_code) 매핑
if (params.containsKey("role_name") && !params.containsKey("auth_name")) {
params.put("auth_name", params.get("role_name"));
}
if (params.containsKey("role_code") && !params.containsKey("auth_code")) {
params.put("auth_code", params.get("role_code"));
}
Map<String, Object> updated = roleService.updateRoleGroup(params);
return ResponseEntity.ok(ApiResponse.success(updated, "권한 그룹 수정 성공"));
}
@@ -44,7 +44,7 @@ public class ScreenManagementController {
if (screen == null) {
return ResponseEntity.status(404).body(ApiResponse.error("화면을 찾을 수 없습니다."));
}
return ResponseEntity.ok(ApiResponse.success(commonService.toCamelCaseKeys(screen)));
return ResponseEntity.ok(ApiResponse.success(screen));
}
@GetMapping("/screens/{id}/menu")
@@ -540,7 +540,7 @@ public class ScreenManagementController {
@GetMapping("/menus/{menuObjid}/screens")
public ResponseEntity<ApiResponse<List<Map<String, Object>>>> getScreensByMenu(
@RequestAttribute("company_code") String companyCode,
@PathVariable Integer menuObjid) {
@PathVariable String menuObjid) {
return ResponseEntity.ok(ApiResponse.success(service.getScreensByMenu(menuObjid, companyCode)));
}
@@ -548,7 +548,7 @@ public class ScreenManagementController {
public ResponseEntity<ApiResponse<Void>> unassignScreenFromMenu(
@RequestAttribute("company_code") String companyCode,
@PathVariable Integer screenId,
@PathVariable Integer menuObjid) {
@PathVariable String menuObjid) {
try {
service.unassignScreenFromMenu(screenId, menuObjid, companyCode);
return ResponseEntity.ok(ApiResponse.success(null, "메뉴 할당이 해제되었습니다."));
@@ -76,6 +76,15 @@ public class AdminService extends BaseService {
}
public Map<String, Object> saveMenu(Map<String, Object> params) {
// Generate timestamp-based objid
long objid = System.currentTimeMillis();
params.put("objid", objid);
// Map frontend field names to DB column names
if (params.get("menu_name_kor") == null && params.get("menu_name") != null) {
params.put("menu_name_kor", params.get("menu_name"));
}
sqlSession.insert("admin.insertMenu", params);
return params;
}
@@ -126,7 +135,7 @@ public class AdminService extends BaseService {
pagination.put("total_pages", totalPages);
Map<String, Object> result = new HashMap<>();
result.put("data", commonService.toCamelCaseKeysList(users));
result.put("data", users);
result.put("total", total);
result.put("search_type", rawSearch != null ? "v2" : "none");
result.put("pagination", pagination);
@@ -342,17 +351,15 @@ public class AdminService extends BaseService {
commonService.applyCompanyCodeFilter(params);
List<Map<String, Object>> rawList = sqlSession.selectList("admin.selectDepartmentList", params);
// 평탄 목록 (camelCase 변환)
List<Map<String, Object>> flatList = rawList.stream()
.map(commonService::toCamelCaseKeys)
.collect(Collectors.toList());
// 평탄 목록
List<Map<String, Object>> flatList = new java.util.ArrayList<>(rawList);
// 트리 구조 빌드 — 1차: camelCase 변환 + children 초기화
// 트리 구조 빌드
java.util.LinkedHashMap<String, Map<String, Object>> deptTreeMap = new java.util.LinkedHashMap<>();
List<Map<String, Object>> rootDepts = new java.util.ArrayList<>();
for (Map<String, Object> raw : rawList) {
Map<String, Object> node = commonService.toCamelCaseKeys(raw);
Map<String, Object> node = new java.util.LinkedHashMap<>(raw);
node.put("children", new java.util.ArrayList<>());
deptTreeMap.put((String) raw.get("dept_code"), node);
}
@@ -16,7 +16,7 @@ public class AnalyticsReportService extends BaseService {
private static final String NS = "analyticsReport.";
public Map<String, Object> getProductionReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_production_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getProductionReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("processes", extractFilterSet(rows, "process"));
filterOptions.put("equipment", extractFilterSet(rows, "equipment"));
@@ -30,7 +30,7 @@ public class AnalyticsReportService extends BaseService {
}
public Map<String, Object> getInventoryReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_inventory_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getInventoryReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("items", extractFilterSet(rows, "item"));
filterOptions.put("warehouses", extractFilterSet(rows, "warehouse"));
@@ -49,7 +49,7 @@ public class AnalyticsReportService extends BaseService {
}
public Map<String, Object> getPurchaseReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_purchase_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getPurchaseReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("suppliers", extractFilterSet(rows, "supplier"));
filterOptions.put("items", extractFilterSet(rows, "item"));
@@ -63,7 +63,7 @@ public class AnalyticsReportService extends BaseService {
}
public Map<String, Object> getQualityReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_quality_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getQualityReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("items", extractFilterSet(rows, "item"));
filterOptions.put("defect_types", List.of(
@@ -83,7 +83,7 @@ public class AnalyticsReportService extends BaseService {
}
public Map<String, Object> getEquipmentReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_equipment_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getEquipmentReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("equipment", extractFilterSet(rows, "equipment"));
filterOptions.put("equip_types", extractFilterSet(rows, "equip_type"));
@@ -97,7 +97,7 @@ public class AnalyticsReportService extends BaseService {
}
public Map<String, Object> getMoldReportData(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_mold_report_data", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getMoldReportData", params);
Map<String, Object> filterOptions = new LinkedHashMap<>();
filterOptions.put("molds", extractFilterSet(rows, "mold"));
filterOptions.put("mold_types", extractFilterSet(rows, "mold_type"));
@@ -19,43 +19,43 @@ public class BatchExecutionLogService extends BaseService {
public Map<String, Object> getBatchExecutionLogList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
Integer totalObj = sqlSession.selectOne(NS + "get_batch_execution_log_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getBatchExecutionLogListCnt", params);
int totalCount = totalObj != null ? totalObj : 0;
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_batch_execution_log_list", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getBatchExecutionLogList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getBatchExecutionLogInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_batch_execution_log_info", params);
return sqlSession.selectOne(NS + "getBatchExecutionLogInfo", params);
}
@Transactional
public Map<String, Object> insertBatchExecutionLog(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_batch_execution_log", params);
sqlSession.insert(NS + "insertBatchExecutionLog", params);
return params;
}
@Transactional
public Map<String, Object> updateBatchExecutionLog(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_batch_execution_log", params);
sqlSession.update(NS + "updateBatchExecutionLog", params);
return params;
}
@Transactional
public Map<String, Object> deleteBatchExecutionLog(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_batch_execution_log", params);
sqlSession.delete(NS + "deleteBatchExecutionLog", params);
return params;
}
public Map<String, Object> getBatchExecutionLogLatest(Map<String, Object> params) {
return sqlSession.selectOne(NS + "get_batch_execution_log_latest", params);
return sqlSession.selectOne(NS + "getBatchExecutionLogLatest", params);
}
public Map<String, Object> getBatchExecutionLogStats(Map<String, Object> params) {
return sqlSession.selectOne(NS + "get_batch_execution_log_stats", params);
return sqlSession.selectOne(NS + "getBatchExecutionLogStats", params);
}
}
@@ -31,7 +31,7 @@ public class BatchManagementService extends BaseService {
public Map<String, Object> getBatchStats(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> stats = sqlSession.selectOne(NS + "get_batch_management_stats", params);
Map<String, Object> stats = sqlSession.selectOne(NS + "getBatchManagementStats", params);
return stats != null ? stats : Collections.emptyMap();
}
@@ -39,7 +39,7 @@ public class BatchManagementService extends BaseService {
public List<Map<String, Object>> getNodeFlows(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_batch_management_node_flow_list", params);
return sqlSession.selectList(NS + "getBatchManagementNodeFlowList", params);
}
// ── Connections / Tables / Columns ────────────────────────────────────────
@@ -205,17 +205,17 @@ public class BatchManagementService extends BaseService {
public List<String> getAuthServiceNames(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_batch_management_auth_service_list", params);
return sqlSession.selectList(NS + "getBatchManagementAuthServiceList", params);
}
// ── Sparkline / Recent Logs ───────────────────────────────────────────────
public List<Map<String, Object>> getBatchSparkline(Map<String, Object> params) {
return sqlSession.selectList(NS + "get_batch_management_sparkline_data", params);
return sqlSession.selectList(NS + "getBatchManagementSparklineData", params);
}
public List<Map<String, Object>> getBatchRecentLogs(Map<String, Object> params) {
return sqlSession.selectList(NS + "get_batch_management_recent_log_list", params);
return sqlSession.selectList(NS + "getBatchManagementRecentLogList", params);
}
// ── Private Helpers ───────────────────────────────────────────────────────
@@ -21,25 +21,25 @@ public class BatchService extends BaseService {
public Map<String, Object> getBatchList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
Integer totalObj = sqlSession.selectOne(NS + "get_batch_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getBatchListCnt", params);
int totalCount = totalObj != null ? totalObj : 0;
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_batch_list", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getBatchList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getBatchInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_batch_info", params);
return sqlSession.selectOne(NS + "getBatchInfo", params);
}
@Transactional
public Map<String, Object> insertBatch(Map<String, Object> params) {
sqlSession.insert(NS + "insert_batch", params);
sqlSession.insert(NS + "insertBatch", params);
Long id = params.get("id") != null ? Long.parseLong(params.get("id").toString()) : null;
if (id != null) {
Map<String, Object> infoParams = new HashMap<>();
infoParams.put("id", id);
return sqlSession.selectOne(NS + "get_batch_info", infoParams);
return sqlSession.selectOne(NS + "getBatchInfo", infoParams);
}
return params;
}
@@ -47,16 +47,16 @@ public class BatchService extends BaseService {
@Transactional
public Map<String, Object> updateBatch(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_batch", params);
sqlSession.update(NS + "updateBatch", params);
Map<String, Object> infoParams = new HashMap<>();
infoParams.put("id", params.get("id"));
return sqlSession.selectOne(NS + "get_batch_info", infoParams);
return sqlSession.selectOne(NS + "getBatchInfo", infoParams);
}
@Transactional
public int deleteBatch(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.delete(NS + "delete_batch", params);
return sqlSession.delete(NS + "deleteBatch", params);
}
public List<Map<String, Object>> getConnections(String companyCode) {
@@ -73,7 +73,7 @@ public class BatchService extends BaseService {
params.put("company_code", companyCode);
params.put("is_active", "Y");
commonService.applyCompanyCodeFilter(params);
List<Map<String, Object>> externalConns = sqlSession.selectList(EXT_NS + "get_external_db_connection_list", params);
List<Map<String, Object>> externalConns = sqlSession.selectList(EXT_NS + "getExternalDbConnectionList", params);
for (Map<String, Object> conn : externalConns) {
Map<String, Object> item = new LinkedHashMap<>();
item.put("id", conn.get("id"));
@@ -91,7 +91,7 @@ public class BatchService extends BaseService {
public List<Map<String, Object>> getTables(String type, Long connectionId) {
if ("internal".equals(type)) {
return sqlSession.selectList(NS + "get_internal_tables");
return sqlSession.selectList(NS + "getInternalTables");
}
return new ArrayList<>();
}
@@ -100,7 +100,7 @@ public class BatchService extends BaseService {
if ("internal".equals(type)) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
return sqlSession.selectList(NS + "get_internal_table_columns", params);
return sqlSession.selectList(NS + "getInternalTableColumns", params);
}
return new ArrayList<>();
}
@@ -25,34 +25,34 @@ public class BomService extends BaseService {
public Map<String, Object> getBomList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_bom_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_bom_list", params);
int totalCount = sqlSession.selectOne(NS + "getBomListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getBomList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getBomInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_bom_info", params);
return sqlSession.selectOne(NS + "getBomInfo", params);
}
@Transactional
public Map<String, Object> insertBom(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_bom", params);
sqlSession.insert(NS + "insertBom", params);
return params;
}
@Transactional
public Map<String, Object> updateBom(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_bom", params);
sqlSession.update(NS + "updateBom", params);
return params;
}
@Transactional
public Map<String, Object> deleteBom(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_bom", params);
sqlSession.delete(NS + "deleteBom", params);
return params;
}
@@ -23,7 +23,7 @@ public class ButtonActionStandardService extends BaseService {
* 버튼 액션 목록 조회 (동적 필터)
*/
public List<Map<String, Object>> getButtonActions(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_button_actions", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectButtonActions", params);
rows.forEach(this::parseJsonFields);
return rows;
}
@@ -32,7 +32,7 @@ public class ButtonActionStandardService extends BaseService {
* 버튼 액션 단건 조회
*/
public Map<String, Object> getButtonAction(Map<String, Object> params) {
Map<String, Object> row = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> row = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (row != null) parseJsonFields(row);
return row;
}
@@ -43,7 +43,7 @@ public class ButtonActionStandardService extends BaseService {
@Transactional
public Map<String, Object> createButtonAction(Map<String, Object> params) {
// 중복 체크
Map<String, Object> existing = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (existing != null) {
throw new IllegalArgumentException("이미 존재하는 액션 타입입니다: " + params.get("action_type"));
}
@@ -59,11 +59,11 @@ public class ButtonActionStandardService extends BaseService {
params.putIfAbsent("sort_order", 0);
params.putIfAbsent("is_active", "Y");
sqlSession.insert(NS + "insert_button_action", params);
sqlSession.insert(NS + "insertButtonAction", params);
// 삽입된 행 조회 후 반환 (actionType 키로 조회)
params.put("action_type", params.get("action_type"));
Map<String, Object> created = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> created = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (created != null) parseJsonFields(created);
return created;
}
@@ -74,7 +74,7 @@ public class ButtonActionStandardService extends BaseService {
@Transactional
public Map<String, Object> updateButtonAction(Map<String, Object> params) {
// 존재 여부 확인
Map<String, Object> existing = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (existing == null) {
return null;
}
@@ -83,9 +83,9 @@ public class ButtonActionStandardService extends BaseService {
serializeJsonField(params, "validation_rules");
serializeJsonField(params, "action_config");
sqlSession.update(NS + "update_button_action", params);
sqlSession.update(NS + "updateButtonAction", params);
Map<String, Object> updated = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> updated = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (updated != null) parseJsonFields(updated);
return updated;
}
@@ -95,11 +95,11 @@ public class ButtonActionStandardService extends BaseService {
*/
@Transactional
public boolean deleteButtonAction(Map<String, Object> params) {
Map<String, Object> existing = sqlSession.selectOne(NS + "select_button_action_by_type", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectButtonActionByType", params);
if (existing == null) {
return false;
}
sqlSession.delete(NS + "delete_button_action", params);
sqlSession.delete(NS + "deleteButtonAction", params);
return true;
}
@@ -110,7 +110,7 @@ public class ButtonActionStandardService extends BaseService {
public void updateSortOrder(List<Map<String, Object>> items, String userId) {
for (Map<String, Object> item : items) {
item.put("updated_by", userId);
sqlSession.update(NS + "update_sort_order_item", item);
sqlSession.update(NS + "updateSortOrderItem", item);
}
}
@@ -118,7 +118,7 @@ public class ButtonActionStandardService extends BaseService {
* 카테고리 목록 조회 (카운트 포함)
*/
public List<Map<String, Object>> getCategories(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_categories", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectCategories", params);
// count 필드를 Integer로 변환
rows.forEach(row -> {
Object cnt = row.get("count");
@@ -23,20 +23,20 @@ public class CascadingAutoFillService extends BaseService {
public Map<String, Object> getCascadingAutoFillGroupList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_cascading_auto_fill_group_list", params);
int totalCount = sqlSession.selectOne(NS + "getCascadingAutoFillGroupListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCascadingAutoFillGroupList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCascadingAutoFillGroupDetail(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> group = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_by_code", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCascadingAutoFillGroupByCode", params);
if (group == null) return null;
Map<String, Object> mappingParams = new HashMap<>();
mappingParams.put("group_code", params.get("group_code"));
mappingParams.put("company_code", group.get("company_code"));
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "get_cascading_auto_fill_mapping_list", mappingParams);
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "getCascadingAutoFillMappingList", mappingParams);
Map<String, Object> result = new HashMap<>(group);
result.put("mappings", mappings);
@@ -51,7 +51,7 @@ public class CascadingAutoFillService extends BaseService {
// Generate group code: AF_{timestamp_base36}_{count:03d}
Map<String, Object> countParams = new HashMap<>();
countParams.put("company_code", companyCode);
Number cntNum = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_count", countParams);
Number cntNum = sqlSession.selectOne(NS + "getCascadingAutoFillGroupCount", countParams);
int count = (cntNum != null ? cntNum.intValue() : 0) + 1;
String timestamp = Long.toString(System.currentTimeMillis(), 36).toUpperCase();
String suffix = timestamp.substring(Math.max(0, timestamp.length() - 4));
@@ -62,7 +62,7 @@ public class CascadingAutoFillService extends BaseService {
params.put("is_active", "Y");
}
sqlSession.insert(NS + "insert_cascading_auto_fill_group", params);
sqlSession.insert(NS + "insertCascadingAutoFillGroup", params);
// Insert mappings
Object mappingsObj = params.get("mappings");
@@ -79,7 +79,7 @@ public class CascadingAutoFillService extends BaseService {
if (mp.get("is_editable") == null) mp.put("is_editable", "Y");
if (mp.get("is_required") == null) mp.put("is_required", "N");
if (mp.get("sort_order") == null) mp.put("sort_order", i + 1);
sqlSession.insert(NS + "insert_cascading_auto_fill_mapping", mp);
sqlSession.insert(NS + "insertCascadingAutoFillMapping", mp);
}
}
}
@@ -91,20 +91,20 @@ public class CascadingAutoFillService extends BaseService {
commonService.applyCompanyCodeFilter(params);
String groupCode = (String) params.get("group_code");
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_by_code", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingAutoFillGroupByCode", params);
if (existing == null) return null;
String actualCompanyCode = (String) existing.get("company_code");
params.put("company_code", actualCompanyCode);
sqlSession.update(NS + "update_cascading_auto_fill_group", params);
sqlSession.update(NS + "updateCascadingAutoFillGroup", params);
// Replace mappings if provided
if (params.containsKey("mappings")) {
Map<String, Object> delParams = new HashMap<>();
delParams.put("group_code", groupCode);
delParams.put("company_code", actualCompanyCode);
sqlSession.delete(NS + "delete_cascading_auto_fill_mappings", delParams);
sqlSession.delete(NS + "deleteCascadingAutoFillMappings", delParams);
Object mappingsObj = params.get("mappings");
if (mappingsObj instanceof List) {
@@ -120,7 +120,7 @@ public class CascadingAutoFillService extends BaseService {
if (mp.get("is_editable") == null) mp.put("is_editable", "Y");
if (mp.get("is_required") == null) mp.put("is_required", "N");
if (mp.get("sort_order") == null) mp.put("sort_order", i + 1);
sqlSession.insert(NS + "insert_cascading_auto_fill_mapping", mp);
sqlSession.insert(NS + "insertCascadingAutoFillMapping", mp);
}
}
}
@@ -131,7 +131,7 @@ public class CascadingAutoFillService extends BaseService {
@Transactional
public boolean deleteCascadingAutoFillGroup(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_by_code", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingAutoFillGroupByCode", params);
if (existing == null) return false;
String groupCode = (String) params.get("group_code");
@@ -140,8 +140,8 @@ public class CascadingAutoFillService extends BaseService {
Map<String, Object> delParams = new HashMap<>();
delParams.put("group_code", groupCode);
delParams.put("company_code", companyCode);
sqlSession.delete(NS + "delete_cascading_auto_fill_mappings", delParams);
sqlSession.delete(NS + "delete_cascading_auto_fill_group", delParams);
sqlSession.delete(NS + "deleteCascadingAutoFillMappings", delParams);
sqlSession.delete(NS + "deleteCascadingAutoFillGroup", delParams);
return true;
}
@@ -151,7 +151,7 @@ public class CascadingAutoFillService extends BaseService {
Map<String, Object> groupParams = new HashMap<>(params);
groupParams.put("is_active", "Y");
Map<String, Object> group = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_by_code", groupParams);
Map<String, Object> group = sqlSession.selectOne(NS + "getCascadingAutoFillGroupByCode", groupParams);
if (group == null) return null;
String masterTable = sanitizeIdentifier((String) group.get("master_table"));
@@ -185,14 +185,14 @@ public class CascadingAutoFillService extends BaseService {
Map<String, Object> groupParams = new HashMap<>(params);
groupParams.put("is_active", "Y");
Map<String, Object> group = sqlSession.selectOne(NS + "get_cascading_auto_fill_group_by_code", groupParams);
Map<String, Object> group = sqlSession.selectOne(NS + "getCascadingAutoFillGroupByCode", groupParams);
if (group == null) return null;
String actualCompanyCode = (String) group.get("company_code");
Map<String, Object> mappingParams = new HashMap<>();
mappingParams.put("group_code", groupCode);
mappingParams.put("company_code", actualCompanyCode);
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "get_cascading_auto_fill_mapping_list", mappingParams);
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "getCascadingAutoFillMappingList", mappingParams);
if (mappings.isEmpty()) {
Map<String, Object> empty = new HashMap<>();
@@ -24,34 +24,34 @@ public class CascadingConditionService extends BaseService {
public Map<String, Object> getCascadingConditionList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_cascading_condition_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_cascading_condition_list", params);
int totalCount = sqlSession.selectOne(NS + "getCascadingConditionListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCascadingConditionList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCascadingConditionInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_cascading_condition_info", params);
return sqlSession.selectOne(NS + "getCascadingConditionInfo", params);
}
@Transactional
public Map<String, Object> insertCascadingCondition(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_cascading_condition", params);
sqlSession.insert(NS + "insertCascadingCondition", params);
return params;
}
@Transactional
public Map<String, Object> updateCascadingCondition(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_cascading_condition", params);
sqlSession.update(NS + "updateCascadingCondition", params);
return params;
}
@Transactional
public Map<String, Object> deleteCascadingCondition(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_cascading_condition", params);
sqlSession.delete(NS + "deleteCascadingCondition", params);
return params;
}
@@ -73,7 +73,7 @@ public class CascadingConditionService extends BaseService {
}
// 2. 조건 규칙 조회 (우선순위 내림차순)
List<Map<String, Object>> conditions = sqlSession.selectList(NS + "get_cascading_conditions_by_relation_code", params);
List<Map<String, Object>> conditions = sqlSession.selectList(NS + "getCascadingConditionsByRelationCode", params);
// 3. 매칭 조건 탐색
Map<String, Object> matchedCondition = null;
@@ -21,20 +21,20 @@ public class CascadingHierarchyService extends BaseService {
public Map<String, Object> getCascadingHierarchyGroupList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_cascading_hierarchy_group_list", params);
int totalCount = sqlSession.selectOne(NS + "getCascadingHierarchyGroupListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCascadingHierarchyGroupList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCascadingHierarchyGroupDetail(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> group = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_by_code", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCascadingHierarchyGroupByCode", params);
if (group == null) return null;
Map<String, Object> levelParams = new HashMap<>();
levelParams.put("group_code", params.get("group_code"));
levelParams.put("company_code", group.get("company_code"));
List<Map<String, Object>> levels = sqlSession.selectList(NS + "get_cascading_hierarchy_level_list", levelParams);
List<Map<String, Object>> levels = sqlSession.selectList(NS + "getCascadingHierarchyLevelList", levelParams);
Map<String, Object> result = new HashMap<>(group);
result.put("levels", levels);
@@ -50,7 +50,7 @@ public class CascadingHierarchyService extends BaseService {
// Generate group code: HG_{timestamp_base36}_{count:03d}
Map<String, Object> countParams = new HashMap<>();
countParams.put("company_code", companyCode);
Number cntNum = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_count", countParams);
Number cntNum = sqlSession.selectOne(NS + "getCascadingHierarchyGroupCount", countParams);
int count = (cntNum != null ? cntNum.intValue() : 0) + 1;
String timestamp = Long.toString(System.currentTimeMillis(), 36).toUpperCase();
String suffix = timestamp.substring(Math.max(0, timestamp.length() - 4));
@@ -65,7 +65,7 @@ public class CascadingHierarchyService extends BaseService {
if (params.get("no_options_message") == null) params.put("no_options_message", "옵션이 없습니다");
if (params.get("loading_message") == null) params.put("loading_message", "로딩 중...");
sqlSession.insert(NS + "insert_cascading_hierarchy_group", params);
sqlSession.insert(NS + "insertCascadingHierarchyGroup", params);
// Insert levels for MULTI_TABLE type
Object levelsObj = params.get("levels");
@@ -84,7 +84,7 @@ public class CascadingHierarchyService extends BaseService {
if (lp.get("placeholder") == null && lp.get("level_name") != null) {
lp.put("placeholder", lp.get("level_name") + " 선택");
}
sqlSession.insert(NS + "insert_cascading_hierarchy_level", lp);
sqlSession.insert(NS + "insertCascadingHierarchyLevel", lp);
}
}
}
@@ -96,18 +96,18 @@ public class CascadingHierarchyService extends BaseService {
commonService.applyCompanyCodeFilter(params);
params.put("updated_by", params.getOrDefault("user_id", "system"));
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_by_code", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingHierarchyGroupByCode", params);
if (existing == null) return null;
params.put("company_code", existing.get("company_code"));
sqlSession.update(NS + "update_cascading_hierarchy_group", params);
sqlSession.update(NS + "updateCascadingHierarchyGroup", params);
return params;
}
@Transactional
public boolean deleteCascadingHierarchyGroup(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_by_code", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingHierarchyGroupByCode", params);
if (existing == null) return false;
String groupCode = (String) params.get("group_code");
@@ -116,8 +116,8 @@ public class CascadingHierarchyService extends BaseService {
Map<String, Object> delParams = new HashMap<>();
delParams.put("group_code", groupCode);
delParams.put("company_code", companyCode);
sqlSession.delete(NS + "delete_cascading_hierarchy_levels", delParams);
sqlSession.delete(NS + "delete_cascading_hierarchy_group", delParams);
sqlSession.delete(NS + "deleteCascadingHierarchyLevels", delParams);
sqlSession.delete(NS + "deleteCascadingHierarchyGroup", delParams);
return true;
}
@@ -129,7 +129,7 @@ public class CascadingHierarchyService extends BaseService {
Map<String, Object> groupParams = new HashMap<>();
groupParams.put("group_code", groupCode);
groupParams.put("company_code", params.get("company_code"));
Map<String, Object> group = sqlSession.selectOne(NS + "get_cascading_hierarchy_group_by_code", groupParams);
Map<String, Object> group = sqlSession.selectOne(NS + "getCascadingHierarchyGroupByCode", groupParams);
if (group == null) return null;
params.put("company_code", group.get("company_code"));
@@ -140,27 +140,27 @@ public class CascadingHierarchyService extends BaseService {
params.put("placeholder", params.get("level_name") + " 선택");
}
sqlSession.insert(NS + "insert_cascading_hierarchy_level", params);
sqlSession.insert(NS + "insertCascadingHierarchyLevel", params);
return params;
}
@Transactional
public Map<String, Object> updateCascadingHierarchyLevel(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_hierarchy_level_info", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingHierarchyLevelInfo", params);
if (existing == null) return null;
sqlSession.update(NS + "update_cascading_hierarchy_level", params);
sqlSession.update(NS + "updateCascadingHierarchyLevel", params);
return params;
}
@Transactional
public boolean deleteCascadingHierarchyLevel(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_cascading_hierarchy_level_info", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getCascadingHierarchyLevelInfo", params);
if (existing == null) return false;
sqlSession.delete(NS + "delete_cascading_hierarchy_level", params);
sqlSession.delete(NS + "deleteCascadingHierarchyLevel", params);
return true;
}
@@ -168,7 +168,7 @@ public class CascadingHierarchyService extends BaseService {
commonService.applyCompanyCodeFilter(params);
String companyCode = (String) params.get("company_code");
Map<String, Object> level = sqlSession.selectOne(NS + "get_cascading_hierarchy_level_for_options", params);
Map<String, Object> level = sqlSession.selectOne(NS + "getCascadingHierarchyLevelForOptions", params);
if (level == null) return null;
String tableName = sanitizeIdentifier((String) level.get("table_name"));
@@ -21,14 +21,14 @@ public class CascadingMutualExclusionService extends BaseService {
public Map<String, Object> getCascadingMutualExclusionList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_cascading_mutual_exclusion_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_cascading_mutual_exclusion_list", params);
int totalCount = sqlSession.selectOne(NS + "getCascadingMutualExclusionListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCascadingMutualExclusionList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCascadingMutualExclusionInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_cascading_mutual_exclusion_info", params);
return sqlSession.selectOne(NS + "getCascadingMutualExclusionInfo", params);
}
@Transactional
@@ -41,26 +41,26 @@ public class CascadingMutualExclusionService extends BaseService {
String companyCode = (String) params.get("company_code");
Map<String, Object> countParams = new LinkedHashMap<>();
countParams.put("company_code", companyCode);
int count = sqlSession.selectOne(NS + "get_cascading_mutual_exclusion_count", countParams);
int count = sqlSession.selectOne(NS + "getCascadingMutualExclusionCount", countParams);
String ts = Long.toString(System.currentTimeMillis(), 36).toUpperCase();
ts = ts.substring(Math.max(0, ts.length() - 4));
params.put("exclusion_code", String.format("EX_%s_%03d", ts, count + 1));
sqlSession.insert(NS + "insert_cascading_mutual_exclusion", params);
sqlSession.insert(NS + "insertCascadingMutualExclusion", params);
return params;
}
@Transactional
public Map<String, Object> updateCascadingMutualExclusion(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_cascading_mutual_exclusion", params);
sqlSession.update(NS + "updateCascadingMutualExclusion", params);
return params;
}
@Transactional
public Map<String, Object> deleteCascadingMutualExclusion(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_cascading_mutual_exclusion", params);
sqlSession.delete(NS + "deleteCascadingMutualExclusion", params);
return params;
}
@@ -69,7 +69,7 @@ public class CascadingMutualExclusionService extends BaseService {
*/
public Map<String, Object> validateCascadingMutualExclusion(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> exclusion = sqlSession.selectOne(NS + "get_cascading_mutual_exclusion_by_code", params);
Map<String, Object> exclusion = sqlSession.selectOne(NS + "getCascadingMutualExclusionByCode", params);
if (exclusion == null) throw new NoSuchElementException("상호 배제 규칙을 찾을 수 없습니다.");
@SuppressWarnings("unchecked")
@@ -125,7 +125,7 @@ public class CascadingMutualExclusionService extends BaseService {
commonService.applyCompanyCodeFilter(params);
String companyCode = (String) params.get("company_code");
Map<String, Object> exclusion = sqlSession.selectOne(NS + "get_cascading_mutual_exclusion_by_code", params);
Map<String, Object> exclusion = sqlSession.selectOne(NS + "getCascadingMutualExclusionByCode", params);
if (exclusion == null) throw new NoSuchElementException("상호 배제 규칙을 찾을 수 없습니다.");
String sourceTable = (String) exclusion.get("source_table");
@@ -22,19 +22,19 @@ public class CascadingRelationService extends BaseService {
public Map<String, Object> getCascadingRelationList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_cascading_relation_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_cascading_relation_list", params);
int totalCount = sqlSession.selectOne(NS + "getCascadingRelationListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCascadingRelationList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCascadingRelationInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_cascading_relation_info", params);
return sqlSession.selectOne(NS + "getCascadingRelationInfo", params);
}
public Map<String, Object> getCascadingRelationByCode(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_cascading_relation_by_code", params);
return sqlSession.selectOne(NS + "getCascadingRelationByCode", params);
}
@Transactional
@@ -55,7 +55,7 @@ public class CascadingRelationService extends BaseService {
params.put("clear_on_parent_change", Boolean.TRUE.equals(clearOnParentChange) ? "Y" : "N");
}
params.put("is_active", "Y");
sqlSession.insert(NS + "insert_cascading_relation", params);
sqlSession.insert(NS + "insertCascadingRelation", params);
return params;
}
@@ -70,14 +70,14 @@ public class CascadingRelationService extends BaseService {
if (clearOnParentChange instanceof Boolean) {
params.put("clear_on_parent_change", Boolean.TRUE.equals(clearOnParentChange) ? "Y" : "N");
}
sqlSession.update(NS + "update_cascading_relation", params);
sqlSession.update(NS + "updateCascadingRelation", params);
return params;
}
@Transactional
public Map<String, Object> deleteCascadingRelation(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "delete_cascading_relation", params);
sqlSession.update(NS + "deleteCascadingRelation", params);
return params;
}
@@ -87,7 +87,7 @@ public class CascadingRelationService extends BaseService {
public List<Map<String, Object>> getParentOptions(Map<String, Object> params) {
String companyCode = (String) params.get("company_code");
Map<String, Object> relation = sqlSession.selectOne(NS + "get_cascading_relation_by_code", params);
Map<String, Object> relation = sqlSession.selectOne(NS + "getCascadingRelationByCode", params);
if (relation == null) {
throw new NoSuchElementException("연쇄 관계를 찾을 수 없습니다.");
}
@@ -145,7 +145,7 @@ public class CascadingRelationService extends BaseService {
return Collections.emptyList();
}
Map<String, Object> relation = sqlSession.selectOne(NS + "get_cascading_relation_by_code", params);
Map<String, Object> relation = sqlSession.selectOne(NS + "getCascadingRelationByCode", params);
if (relation == null) {
throw new NoSuchElementException("연쇄 관계를 찾을 수 없습니다.");
}
@@ -27,7 +27,7 @@ public class CategoryTreeService extends BaseService {
params.put("company_code", companyCode);
params.put("table_name", tableName);
params.put("column_name", columnName);
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "get_category_tree_list", params);
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "getCategoryTreeList", params);
return buildTree(flatList);
}
@@ -39,7 +39,7 @@ public class CategoryTreeService extends BaseService {
params.put("company_code", companyCode);
params.put("table_name", tableName);
params.put("column_name", columnName);
return sqlSession.selectList(NS + "get_category_tree_list", params);
return sqlSession.selectList(NS + "getCategoryTreeList", params);
}
/**
@@ -49,7 +49,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
params.put("value_id", valueId);
return sqlSession.selectOne(NS + "get_category_tree_info", params);
return sqlSession.selectOne(NS + "getCategoryTreeInfo", params);
}
/**
@@ -75,7 +75,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> parentParams = new HashMap<>();
parentParams.put("company_code", companyCode);
parentParams.put("value_id", ((Number) parentValueIdRaw).intValue());
Map<String, Object> parent = sqlSession.selectOne(NS + "get_category_tree_info", parentParams);
Map<String, Object> parent = sqlSession.selectOne(NS + "getCategoryTreeInfo", parentParams);
if (parent != null) {
depth = ((Number) parent.get("depth")).intValue() + 1;
if (depth > 3) {
@@ -107,13 +107,13 @@ public class CategoryTreeService extends BaseService {
params.put("company_code", companyCode);
params.put("created_by", createdBy);
sqlSession.insert(NS + "insert_category_tree", params);
sqlSession.insert(NS + "insertCategoryTree", params);
// useGeneratedKeys → params.get("value_id") 에 생성된 ID 저장
Map<String, Object> fetchParams = new HashMap<>();
fetchParams.put("company_code", companyCode);
fetchParams.put("value_id", params.get("value_id"));
return sqlSession.selectOne(NS + "get_category_tree_info", fetchParams);
return sqlSession.selectOne(NS + "getCategoryTreeInfo", fetchParams);
}
/**
@@ -125,7 +125,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> currentParams = new HashMap<>();
currentParams.put("company_code", companyCode);
currentParams.put("value_id", valueId);
Map<String, Object> current = sqlSession.selectOne(NS + "get_category_tree_info", currentParams);
Map<String, Object> current = sqlSession.selectOne(NS + "getCategoryTreeInfo", currentParams);
if (current == null) return null;
String currentLabel = (String) current.get("value_label");
@@ -148,7 +148,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> newParentParams = new HashMap<>();
newParentParams.put("company_code", companyCode);
newParentParams.put("value_id", ((Number) body.get("parent_value_id")).intValue());
Map<String, Object> newParent = sqlSession.selectOne(NS + "get_category_tree_info", newParentParams);
Map<String, Object> newParent = sqlSession.selectOne(NS + "getCategoryTreeInfo", newParentParams);
if (newParent != null) {
newDepth = ((Number) newParent.get("depth")).intValue() + 1;
if (newDepth > 3) {
@@ -166,7 +166,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> parentParams = new HashMap<>();
parentParams.put("company_code", companyCode);
parentParams.put("value_id", ((Number) currentParentId).intValue());
Map<String, Object> parent = sqlSession.selectOne(NS + "get_category_tree_info", parentParams);
Map<String, Object> parent = sqlSession.selectOne(NS + "getCategoryTreeInfo", parentParams);
String parentPath = parent != null ? (String) parent.get("path") : null;
newPath = parentPath != null ? parentPath + "/" + newLabel : newLabel;
} else {
@@ -190,7 +190,7 @@ public class CategoryTreeService extends BaseService {
updateParams.put("is_default", body.get("is_default"));
updateParams.put("updated_by", updatedBy);
int affected = sqlSession.update(NS + "update_category_tree", updateParams);
int affected = sqlSession.update(NS + "updateCategoryTree", updateParams);
if (affected == 0) return null;
if (labelChanged || parentChanged) {
@@ -200,7 +200,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> fetchParams = new HashMap<>();
fetchParams.put("company_code", companyCode);
fetchParams.put("value_id", valueId);
return sqlSession.selectOne(NS + "get_category_tree_info", fetchParams);
return sqlSession.selectOne(NS + "getCategoryTreeInfo", fetchParams);
}
/**
@@ -218,7 +218,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> childParams = new HashMap<>();
childParams.put("value_id", valueId);
childParams.put("company_code", companyCode);
Integer childCountObj = sqlSession.selectOne(NS + "get_category_tree_children_cnt", childParams);
Integer childCountObj = sqlSession.selectOne(NS + "getCategoryTreeChildrenCnt", childParams);
int childCount = childCountObj != null ? childCountObj : 0;
if (childCount > 0) {
Map<String, Object> res = new LinkedHashMap<>();
@@ -254,7 +254,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> childParams = new HashMap<>();
childParams.put("value_id", valueId);
childParams.put("company_code", companyCode);
Integer childCountObj = sqlSession.selectOne(NS + "get_category_tree_children_cnt", childParams);
Integer childCountObj = sqlSession.selectOne(NS + "getCategoryTreeChildrenCnt", childParams);
int childCount = childCountObj != null ? childCountObj : 0;
if (childCount > 0) {
throw new IllegalStateException(
@@ -275,7 +275,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> deleteParams = new HashMap<>();
deleteParams.put("company_code", companyCode);
deleteParams.put("value_id", valueId);
return sqlSession.delete(NS + "delete_category_tree", deleteParams) > 0;
return sqlSession.delete(NS + "deleteCategoryTree", deleteParams) > 0;
}
/**
@@ -285,7 +285,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_category_tree_column_list", params);
return sqlSession.selectList(NS + "getCategoryTreeColumnList", params);
}
/**
@@ -294,7 +294,7 @@ public class CategoryTreeService extends BaseService {
public List<Map<String, Object>> getCategoryTreeKeyList(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_category_tree_key_list", params);
return sqlSession.selectList(NS + "getCategoryTreeKeyList", params);
}
// ─── private helpers ────────────────────────────────────────────────────────
@@ -336,7 +336,7 @@ public class CategoryTreeService extends BaseService {
params.put("company_code", companyCode);
params.put("parent_value_id", parentValueId);
List<Map<String, Object>> children = sqlSession.selectList(NS + "get_category_tree_children_list", params);
List<Map<String, Object>> children = sqlSession.selectList(NS + "getCategoryTreeChildrenList", params);
for (Map<String, Object> child : children) {
String valueLabel = (String) child.get("value_label");
String newPath = parentPath + "/" + valueLabel;
@@ -344,7 +344,7 @@ public class CategoryTreeService extends BaseService {
Map<String, Object> updateParams = new HashMap<>();
updateParams.put("value_id", child.get("value_id"));
updateParams.put("path", newPath);
sqlSession.update(NS + "update_category_tree_child_path", updateParams);
sqlSession.update(NS + "updateCategoryTreeChildPath", updateParams);
int childId = ((Number) child.get("value_id")).intValue();
updateChildrenPaths(companyCode, childId, newPath);
@@ -366,21 +366,21 @@ public class CategoryTreeService extends BaseService {
// 1. 테이블 존재 확인
Map<String, Object> tableParams = new HashMap<>();
tableParams.put("table_name", tableName);
Integer teObj = sqlSession.selectOne(NS + "check_table_exists", tableParams);
Integer teObj = sqlSession.selectOne(NS + "checkTableExists", tableParams);
if (teObj == null || teObj == 0) return notInUse;
// 2. 컬럼 존재 확인
Map<String, Object> colParams = new HashMap<>();
colParams.put("table_name", tableName);
colParams.put("column_name", columnName);
Integer ceObj = sqlSession.selectOne(NS + "check_column_exists", colParams);
Integer ceObj = sqlSession.selectOne(NS + "checkColumnExists", colParams);
if (ceObj == null || ceObj == 0) return notInUse;
// 3. company_code 컬럼 존재 확인
Map<String, Object> companyColParams = new HashMap<>();
companyColParams.put("table_name", tableName);
companyColParams.put("column_name", "company_code");
Integer ccObj = sqlSession.selectOne(NS + "check_column_exists", companyColParams);
Integer ccObj = sqlSession.selectOne(NS + "checkColumnExists", companyColParams);
boolean hasCompanyCode = ccObj != null && ccObj > 0;
// 4. 사용 건수 조회
@@ -391,14 +391,14 @@ public class CategoryTreeService extends BaseService {
countParams.put("column_name", columnName);
countParams.put("company_code", companyCode);
countParams.put("value_code", valueCode);
Integer cntObj = sqlSession.selectOne(NS + "count_category_usage_with_company", countParams);
Integer cntObj = sqlSession.selectOne(NS + "countCategoryUsageWithCompany", countParams);
count = cntObj != null ? cntObj : 0;
} else {
Map<String, Object> countParams = new HashMap<>();
countParams.put("table_name", tableName);
countParams.put("column_name", columnName);
countParams.put("value_code", valueCode);
Integer cntObj = sqlSession.selectOne(NS + "count_category_usage", countParams);
Integer cntObj = sqlSession.selectOne(NS + "countCategoryUsage", countParams);
count = cntObj != null ? cntObj : 0;
}
@@ -23,17 +23,17 @@ public class CategoryValueCascadingService extends BaseService {
public Map<String, Object> getCategoryValueCascadingGroupList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_category_value_cascading_group_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_category_value_cascading_group_list", params);
int totalCount = sqlSession.selectOne(NS + "getCategoryValueCascadingGroupListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getCategoryValueCascadingGroupList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getCategoryValueCascadingGroupInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> group = sqlSession.selectOne(NS + "get_category_value_cascading_group_info", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCategoryValueCascadingGroupInfo", params);
if (group == null) return null;
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "get_category_value_cascading_mappings_by_group_id", params);
List<Map<String, Object>> mappings = sqlSession.selectList(NS + "getCategoryValueCascadingMappingsByGroupId", params);
Map<String, List<Map<String, Object>>> mappingsByParent = new LinkedHashMap<>();
for (Map<String, Object> m : mappings) {
@@ -53,27 +53,27 @@ public class CategoryValueCascadingService extends BaseService {
public Map<String, Object> getCategoryValueCascadingGroupByCode(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_category_value_cascading_group_by_code", params);
return sqlSession.selectOne(NS + "getCategoryValueCascadingGroupByCode", params);
}
@Transactional
public Map<String, Object> insertCategoryValueCascadingGroup(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_category_value_cascading_group", params);
sqlSession.insert(NS + "insertCategoryValueCascadingGroup", params);
return params;
}
@Transactional
public Map<String, Object> updateCategoryValueCascadingGroup(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_category_value_cascading_group", params);
sqlSession.update(NS + "updateCategoryValueCascadingGroup", params);
return params;
}
@Transactional
public Map<String, Object> deleteCategoryValueCascadingGroup(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "delete_category_value_cascading_group", params);
sqlSession.update(NS + "deleteCategoryValueCascadingGroup", params);
return params;
}
@@ -84,7 +84,7 @@ public class CategoryValueCascadingService extends BaseService {
String companyCode = (String) params.get("company_code");
Object groupId = params.get("group_id");
sqlSession.delete(NS + "delete_category_value_cascading_mappings_by_group_id", params);
sqlSession.delete(NS + "deleteCategoryValueCascadingMappingsByGroupId", params);
int savedCount = 0;
Object mappingsObj = params.get("mappings");
@@ -94,7 +94,7 @@ public class CategoryValueCascadingService extends BaseService {
Map<String, Object> mappingParams = new HashMap<>(mapping);
mappingParams.put("group_id", groupId);
mappingParams.put("company_code", companyCode);
sqlSession.insert(NS + "insert_category_value_cascading_mapping", mappingParams);
sqlSession.insert(NS + "insertCategoryValueCascadingMapping", mappingParams);
savedCount++;
}
}
@@ -109,7 +109,7 @@ public class CategoryValueCascadingService extends BaseService {
commonService.applyCompanyCodeFilter(params);
String companyCode = (String) params.get("company_code");
Map<String, Object> group = sqlSession.selectOne(NS + "get_category_value_cascading_group_by_code", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCategoryValueCascadingGroupByCode", params);
if (group == null) {
Map<String, Object> result = new LinkedHashMap<>();
result.put("data", Collections.emptyList());
@@ -145,7 +145,7 @@ public class CategoryValueCascadingService extends BaseService {
commonService.applyCompanyCodeFilter(params);
String companyCode = (String) params.get("company_code");
Map<String, Object> group = sqlSession.selectOne(NS + "get_category_value_cascading_group_by_code", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCategoryValueCascadingGroupByCode", params);
if (group == null) {
Map<String, Object> result = new LinkedHashMap<>();
result.put("data", Collections.emptyList());
@@ -199,7 +199,7 @@ public class CategoryValueCascadingService extends BaseService {
return result;
}
Map<String, Object> group = sqlSession.selectOne(NS + "get_category_value_cascading_group_by_code", params);
Map<String, Object> group = sqlSession.selectOne(NS + "getCategoryValueCascadingGroupByCode", params);
if (group == null) {
Map<String, Object> result = new LinkedHashMap<>();
result.put("data", Collections.emptyList());
@@ -28,7 +28,7 @@ public class CodeMergeService extends BaseService {
public Map<String, Object> getTablesWithColumn(String columnName) {
Map<String, Object> params = new HashMap<>();
params.put("column_name", columnName);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_tables_with_column", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getTablesWithColumn", params);
List<String> tables = rows.stream()
.map(r -> {
@@ -64,7 +64,7 @@ public class CodeMergeService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("column_name", columnName);
List<Map<String, Object>> tableRows = sqlSession.selectList(NS + "get_tables_with_column", params);
List<Map<String, Object>> tableRows = sqlSession.selectList(NS + "getTablesWithColumn", params);
List<Map<String, Object>> preview = new ArrayList<>();
int totalRows = 0;
@@ -34,8 +34,8 @@ public class CommonCodeService extends BaseService {
Object isActiveRaw = params.get("is_active");
if (isActiveRaw != null) params.put("is_active", toActiveStr(isActiveRaw));
List<Map<String, Object>> categories = sqlSession.selectList(NS + "get_common_code_category_list", params);
Integer totalObj = sqlSession.selectOne(NS + "get_common_code_category_list_cnt", params);
List<Map<String, Object>> categories = sqlSession.selectList(NS + "getCommonCodeCategoryList", params);
Integer totalObj = sqlSession.selectOne(NS + "getCommonCodeCategoryListCnt", params);
int total = totalObj != null ? totalObj : 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -62,7 +62,7 @@ public class CommonCodeService extends BaseService {
params.put("value", value.trim());
params.put("exclude_code", excludeCode);
params.put("company_code", companyCode);
Integer countObj = sqlSession.selectOne(NS + "get_common_code_category_duplicate_by_field", params);
Integer countObj = sqlSession.selectOne(NS + "getCommonCodeCategoryDuplicateByField", params);
boolean isDuplicate = countObj != null && countObj > 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -89,12 +89,12 @@ public class CommonCodeService extends BaseService {
params.put("created_by", userId);
params.put("updated_by", userId);
sqlSession.insert(NS + "insert_common_code_category", params);
sqlSession.insert(NS + "insertCommonCodeCategory", params);
Map<String, Object> q = new HashMap<>();
q.put("category_code", params.get("category_code"));
q.put("company_code", companyCode);
return sqlSession.selectOne(NS + "get_common_code_category_info", q);
return sqlSession.selectOne(NS + "getCommonCodeCategoryInfo", q);
}
// ══════════════════════════════════════════════════════════════
@@ -115,13 +115,13 @@ public class CommonCodeService extends BaseService {
if (body.containsKey("sort_order")) params.put("sort_order", body.get("sort_order"));
if (body.containsKey("is_active")) params.put("is_active", toActiveStr(body.get("is_active")));
int updated = sqlSession.update(NS + "update_common_code_category", params);
int updated = sqlSession.update(NS + "updateCommonCodeCategory", params);
if (updated == 0) return null;
Map<String, Object> q = new HashMap<>();
q.put("category_code", categoryCode);
q.put("company_code", companyCode);
return sqlSession.selectOne(NS + "get_common_code_category_info", q);
return sqlSession.selectOne(NS + "getCommonCodeCategoryInfo", q);
}
// ══════════════════════════════════════════════════════════════
@@ -133,7 +133,7 @@ public class CommonCodeService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("category_code", categoryCode);
params.put("company_code", companyCode);
int deleted = sqlSession.delete(NS + "delete_common_code_category", params);
int deleted = sqlSession.delete(NS + "deleteCommonCodeCategory", params);
if (deleted == 0) throw new IllegalArgumentException("카테고리를 찾을 수 없습니다.");
}
@@ -151,8 +151,8 @@ public class CommonCodeService extends BaseService {
Object isActiveRaw = params.get("is_active");
if (isActiveRaw != null) params.put("is_active", toActiveStr(isActiveRaw));
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "get_common_code_list", params);
Integer totalObj = sqlSession.selectOne(NS + "get_common_code_list_cnt", params);
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "getCommonCodeList", params);
Integer totalObj = sqlSession.selectOne(NS + "getCommonCodeListCnt", params);
int total = totalObj != null ? totalObj : 0;
List<Map<String, Object>> codes = new ArrayList<>();
@@ -185,7 +185,7 @@ public class CommonCodeService extends BaseService {
params.put("value", value.trim());
params.put("exclude_code", excludeCode);
params.put("company_code", companyCode);
Integer countObj = sqlSession.selectOne(NS + "get_common_code_duplicate_by_field", params);
Integer countObj = sqlSession.selectOne(NS + "getCommonCodeDuplicateByField", params);
boolean isDuplicate = countObj != null && countObj > 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -209,7 +209,7 @@ public class CommonCodeService extends BaseService {
parentParams.put("category_code", categoryCode);
parentParams.put("code_value", parentCodeValueRaw.toString());
parentParams.put("company_code", companyCode);
Integer parentDepth = sqlSession.selectOne(NS + "get_common_code_parent_depth", parentParams);
Integer parentDepth = sqlSession.selectOne(NS + "getCommonCodeParentDepth", parentParams);
depth = (parentDepth != null ? parentDepth : 0) + 1;
}
@@ -228,13 +228,13 @@ public class CommonCodeService extends BaseService {
params.put("created_by", userId);
params.put("updated_by", userId);
sqlSession.insert(NS + "insert_common_code", params);
sqlSession.insert(NS + "insertCommonCode", params);
Map<String, Object> q = new HashMap<>();
q.put("category_code", categoryCode);
q.put("code_value", params.get("code_value"));
q.put("company_code", companyCode);
Map<String, Object> raw = sqlSession.selectOne(NS + "get_common_code_info", q);
Map<String, Object> raw = sqlSession.selectOne(NS + "getCommonCodeInfo", q);
return raw != null ? transformCode(raw) : null;
}
@@ -250,7 +250,7 @@ public class CommonCodeService extends BaseService {
params.put("code_value", code.get("code_value"));
params.put("sort_order", code.get("sort_order"));
params.put("company_code", companyCode);
sqlSession.update(NS + "update_common_code_sort_order", params);
sqlSession.update(NS + "updateCommonCodeSortOrder", params);
}
}
@@ -267,7 +267,7 @@ public class CommonCodeService extends BaseService {
// parentCodeValue, depth 필터는 params에 그대로 전달 (XML에서 처리)
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "get_common_code_hierarchical_list", params);
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "getCommonCodeHierarchicalList", params);
List<Map<String, Object>> result = new ArrayList<>();
for (Map<String, Object> raw : rawList) {
result.add(transformCode(raw));
@@ -284,7 +284,7 @@ public class CommonCodeService extends BaseService {
params.put("category_code", categoryCode);
params.put("company_code", companyCode);
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "get_common_code_tree_list", params);
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "getCommonCodeTreeList", params);
List<Map<String, Object>> flatTransformed = new ArrayList<>();
for (Map<String, Object> raw : flatList) {
@@ -306,7 +306,7 @@ public class CommonCodeService extends BaseService {
params.put("category_code", categoryCode);
params.put("code_value", codeValue);
params.put("company_code", companyCode);
Integer countObj = sqlSession.selectOne(NS + "get_common_code_children_cnt", params);
Integer countObj = sqlSession.selectOne(NS + "getCommonCodeChildrenCnt", params);
int count = countObj != null ? countObj : 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -342,7 +342,7 @@ public class CommonCodeService extends BaseService {
parentParams.put("category_code", categoryCode);
parentParams.put("code_value", newParent.toString());
parentParams.put("company_code", companyCode);
Integer parentDepth = sqlSession.selectOne(NS + "get_common_code_parent_depth", parentParams);
Integer parentDepth = sqlSession.selectOne(NS + "getCommonCodeParentDepth", parentParams);
params.put("depth", (parentDepth != null ? parentDepth : 0) + 1);
} else {
params.put("depth", 1);
@@ -351,14 +351,14 @@ public class CommonCodeService extends BaseService {
params.put("depth", body.get("depth"));
}
int updated = sqlSession.update(NS + "update_common_code", params);
int updated = sqlSession.update(NS + "updateCommonCode", params);
if (updated == 0) return null;
Map<String, Object> q = new HashMap<>();
q.put("category_code", categoryCode);
q.put("code_value", codeValue);
q.put("company_code", companyCode);
Map<String, Object> raw = sqlSession.selectOne(NS + "get_common_code_info", q);
Map<String, Object> raw = sqlSession.selectOne(NS + "getCommonCodeInfo", q);
return raw != null ? transformCode(raw) : null;
}
@@ -372,7 +372,7 @@ public class CommonCodeService extends BaseService {
params.put("category_code", categoryCode);
params.put("code_value", codeValue);
params.put("company_code", companyCode);
int deleted = sqlSession.delete(NS + "delete_common_code", params);
int deleted = sqlSession.delete(NS + "deleteCommonCode", params);
if (deleted == 0) throw new IllegalArgumentException("코드를 찾을 수 없습니다.");
}
@@ -387,7 +387,7 @@ public class CommonCodeService extends BaseService {
// 미지정 시 활성 코드만 반환 (드롭다운 기본 동작)
params.put("is_active", isActiveRaw != null ? toActiveStr(isActiveRaw) : "Y");
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "get_common_code_option_list", params);
List<Map<String, Object>> rawList = sqlSession.selectList(NS + "getCommonCodeOptionList", params);
List<Map<String, Object>> options = new ArrayList<>();
for (Map<String, Object> raw : rawList) {
Map<String, Object> opt = new LinkedHashMap<>();
@@ -95,6 +95,6 @@ public class CommonService extends BaseService {
*/
public List<Map<String, Object>> getCodeList(Map<String, Object> params) {
applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "select_code_list", params);
return sqlSession.selectList(NS + "selectCodeList", params);
}
}
@@ -56,8 +56,8 @@ public class ComponentStandardService extends BaseService {
// 페이지네이션
commonService.applyPagination(params);
List<Map<String, Object>> components = sqlSession.selectList(NS + "select_component_list", params);
Integer totalObj = sqlSession.selectOne(NS + "count_components", params);
List<Map<String, Object>> components = sqlSession.selectList(NS + "selectComponentList", params);
Integer totalObj = sqlSession.selectOne(NS + "countComponents", params);
int total = totalObj != null ? totalObj : 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -74,7 +74,7 @@ public class ComponentStandardService extends BaseService {
public Map<String, Object> getComponent(String componentCode) {
Map<String, Object> params = Map.of("component_code", componentCode);
Map<String, Object> component = sqlSession.selectOne(NS + "select_component", params);
Map<String, Object> component = sqlSession.selectOne(NS + "selectComponent", params);
if (component == null) {
throw new RuntimeException("컴포넌트를 찾을 수 없습니다: " + componentCode);
}
@@ -88,7 +88,7 @@ public class ComponentStandardService extends BaseService {
@Transactional
public Map<String, Object> createComponent(Map<String, Object> params) {
// 중복 코드 확인
if (sqlSession.selectOne(NS + "check_duplicate", params) != null) {
if (sqlSession.selectOne(NS + "checkDuplicate", params) != null) {
throw new RuntimeException("이미 존재하는 컴포넌트 코드입니다: " + params.get("component_code"));
}
@@ -105,8 +105,8 @@ public class ComponentStandardService extends BaseService {
// JSONB 필드 직렬화
serializeJsonFields(params);
sqlSession.insert(NS + "insert_component", params);
return sqlSession.selectOne(NS + "select_component", Map.of("component_code", params.get("component_code")));
sqlSession.insert(NS + "insertComponent", params);
return sqlSession.selectOne(NS + "selectComponent", Map.of("component_code", params.get("component_code")));
}
// ══════════════════════════════════════════════════════════
@@ -126,8 +126,8 @@ public class ComponentStandardService extends BaseService {
data.put("component_code", componentCode);
serializeJsonFields(data);
sqlSession.update(NS + "update_component", data);
return sqlSession.selectOne(NS + "select_component", Map.of("component_code", componentCode));
sqlSession.update(NS + "updateComponent", data);
return sqlSession.selectOne(NS + "selectComponent", Map.of("component_code", componentCode));
}
// ══════════════════════════════════════════════════════════
@@ -137,7 +137,7 @@ public class ComponentStandardService extends BaseService {
@Transactional
public Map<String, Object> deleteComponent(String componentCode) {
getComponent(componentCode); // 존재 확인
sqlSession.delete(NS + "delete_component", Map.of("component_code", componentCode));
sqlSession.delete(NS + "deleteComponent", Map.of("component_code", componentCode));
return Map.of("message", "컴포넌트가 삭제되었습니다: " + componentCode);
}
@@ -148,7 +148,7 @@ public class ComponentStandardService extends BaseService {
@Transactional
public Map<String, Object> updateSortOrder(List<Map<String, Object>> updates) {
for (Map<String, Object> item : updates) {
sqlSession.update(NS + "update_sort_order", item);
sqlSession.update(NS + "updateSortOrder", item);
}
return Map.of("message", "정렬 순서가 업데이트되었습니다.");
}
@@ -164,7 +164,7 @@ public class ComponentStandardService extends BaseService {
// 새 코드 중복 확인
Map<String, Object> dupCheck = new HashMap<>();
dupCheck.put("component_code", newCode);
if (sqlSession.selectOne(NS + "check_duplicate", dupCheck) != null) {
if (sqlSession.selectOne(NS + "checkDuplicate", dupCheck) != null) {
throw new RuntimeException("이미 존재하는 컴포넌트 코드입니다: " + newCode);
}
@@ -173,8 +173,8 @@ public class ComponentStandardService extends BaseService {
newComponent.put("component_name", newName);
serializeJsonFields(newComponent);
sqlSession.insert(NS + "insert_component", newComponent);
return sqlSession.selectOne(NS + "select_component", Map.of("component_code", newCode));
sqlSession.insert(NS + "insertComponent", newComponent);
return sqlSession.selectOne(NS + "selectComponent", Map.of("component_code", newCode));
}
// ══════════════════════════════════════════════════════════
@@ -182,7 +182,7 @@ public class ComponentStandardService extends BaseService {
// ══════════════════════════════════════════════════════════
public List<String> getCategories(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_categories", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectCategories", params);
List<String> categories = new ArrayList<>();
for (Map<String, Object> row : rows) {
Object cat = row.get("category");
@@ -196,10 +196,10 @@ public class ComponentStandardService extends BaseService {
// ══════════════════════════════════════════════════════════
public Map<String, Object> getStatistics(Map<String, Object> params) {
Integer totalObj = sqlSession.selectOne(NS + "count_statistics_total", params);
Integer totalObj = sqlSession.selectOne(NS + "countStatisticsTotal", params);
int total = totalObj != null ? totalObj : 0;
List<Map<String, Object>> byCategoryRaw = sqlSession.selectList(NS + "select_statistics_by_category", params);
List<Map<String, Object>> byCategoryRaw = sqlSession.selectList(NS + "selectStatisticsByCategory", params);
List<Map<String, Object>> byCategory = new ArrayList<>();
for (Map<String, Object> row : byCategoryRaw) {
Map<String, Object> item = new LinkedHashMap<>();
@@ -208,7 +208,7 @@ public class ComponentStandardService extends BaseService {
byCategory.add(item);
}
List<Map<String, Object>> byStatusRaw = sqlSession.selectList(NS + "select_statistics_by_status");
List<Map<String, Object>> byStatusRaw = sqlSession.selectList(NS + "selectStatisticsByStatus");
List<Map<String, Object>> byStatus = new ArrayList<>();
for (Map<String, Object> row : byStatusRaw) {
Map<String, Object> item = new LinkedHashMap<>();
@@ -229,7 +229,7 @@ public class ComponentStandardService extends BaseService {
// ══════════════════════════════════════════════════════════
public boolean checkDuplicate(Map<String, Object> params) {
return sqlSession.selectOne(NS + "check_duplicate", params) != null;
return sqlSession.selectOne(NS + "checkDuplicate", params) != null;
}
// ══ private helpers ═══════════════════════════════════════
@@ -27,7 +27,7 @@ public class DashboardService extends BaseService {
int offset = (page - 1) * limit;
List<Object> args = new ArrayList<>();
StringBuilder where = new StringBuilder("d.deleted_at IS NULL");
StringBuilder where = new StringBuilder("d.deleted_date IS NULL");
if (!"*".equals(companyCode)) {
where.append(" AND d.company_code = ?");
@@ -47,7 +47,7 @@ public class DashboardService extends BaseService {
int total = jdbcTemplate.queryForObject(countSql, Integer.class, args.toArray());
String listSql = "SELECT d.id, d.title, d.description, d.thumbnail_url, d.is_public," +
" d.created_by, d.created_at, d.updated_at, d.tags, d.category, d.view_count, d.company_code," +
" d.created_by, d.created_date, d.updated_date, d.tags, d.category, d.view_count, d.company_code," +
" u.user_name as created_by_name," +
" COUNT(de.id) as elements_count" +
" FROM dashboards d" +
@@ -55,8 +55,8 @@ public class DashboardService extends BaseService {
" LEFT JOIN user_info u ON d.created_by = u.user_id" +
" WHERE " + where +
" GROUP BY d.id, d.title, d.description, d.thumbnail_url, d.is_public," +
" d.created_by, d.created_at, d.updated_at, d.tags, d.category, d.view_count, d.company_code, u.user_name" +
" ORDER BY d.updated_at DESC LIMIT ? OFFSET ?";
" d.created_by, d.created_date, d.updated_date, d.tags, d.category, d.view_count, d.company_code, u.user_name" +
" ORDER BY d.updated_date DESC LIMIT ? OFFSET ?";
List<Object> listArgs = new ArrayList<>(args);
listArgs.add(limit);
listArgs.add(offset);
@@ -82,7 +82,7 @@ public class DashboardService extends BaseService {
public Map<String, Object> getDashboardById(String dashboardId, String companyCode) {
List<Object> args = new ArrayList<>();
args.add(dashboardId);
String where = "id = ? AND deleted_at IS NULL";
String where = "id = ? AND deleted_date IS NULL";
if (companyCode != null && !"*".equals(companyCode)) {
where += " AND company_code = ?";
args.add(companyCode);
@@ -113,7 +113,7 @@ public class DashboardService extends BaseService {
String settingsJson = toJson(params.getOrDefault("settings", new HashMap<>()));
jdbcTemplate.update(
"INSERT INTO dashboards (id, title, description, is_public, created_by, created_at, updated_at, tags, category, view_count, settings, company_code)" +
"INSERT INTO dashboards (id, title, description, is_public, created_by, created_date, updated_date, tags, category, view_count, settings, company_code)" +
" VALUES (?, ?, ?, ?, ?, NOW(), NOW(), ?::jsonb, ?, 0, ?::jsonb, ?)",
dashboardId, title, description, isPublic, userId, tagsJson, category, settingsJson, companyCode != null ? companyCode : "DEFAULT");
@@ -136,14 +136,14 @@ public class DashboardService extends BaseService {
if (params.containsKey("tags")) { sets.add("tags = ?::jsonb"); args.add(toJson(params.get("tags"))); }
if (params.containsKey("category")) { sets.add("category = ?"); args.add(params.get("category")); }
if (params.containsKey("settings")) { sets.add("settings = ?::jsonb"); args.add(toJson(params.get("settings"))); }
sets.add("updated_at = NOW()");
sets.add("updated_date = NOW()");
args.add(dashboardId);
args.add(userId);
int updated = jdbcTemplate.update(
"UPDATE dashboards SET " + String.join(", ", sets) +
" WHERE id = ? AND created_by = ? AND deleted_at IS NULL",
" WHERE id = ? AND created_by = ? AND deleted_date IS NULL",
args.toArray());
if (updated == 0) return null;
@@ -158,14 +158,14 @@ public class DashboardService extends BaseService {
@Transactional
public boolean deleteDashboard(String dashboardId, String userId) {
int deleted = jdbcTemplate.update(
"UPDATE dashboards SET deleted_at = NOW(), updated_at = NOW() WHERE id = ? AND created_by = ? AND deleted_at IS NULL",
"UPDATE dashboards SET deleted_date = NOW(), updated_date = NOW() WHERE id = ? AND created_by = ? AND deleted_date IS NULL",
dashboardId, userId);
return deleted > 0;
}
// ── 조회수 증가 ───────────────────────────────────────────────────────────────
public void incrementViewCount(String dashboardId) {
jdbcTemplate.update("UPDATE dashboards SET view_count = view_count + 1 WHERE id = ? AND deleted_at IS NULL", dashboardId);
jdbcTemplate.update("UPDATE dashboards SET view_count = view_count + 1 WHERE id = ? AND deleted_date IS NULL", dashboardId);
}
// ── execute-query (SELECT만) ──────────────────────────────────────────────────
@@ -254,7 +254,7 @@ public class DashboardService extends BaseService {
"INSERT INTO dashboard_elements (id, dashboard_id, element_type, element_subtype," +
" position_x, position_y, width, height, title, custom_title, show_header, content," +
" data_source_config, chart_config, list_config, yard_config, custom_metric_config," +
" display_order, created_at, updated_at)" +
" display_order, created_date, updated_date)" +
" VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?::jsonb,?::jsonb,?::jsonb,?::jsonb,?::jsonb,?,NOW(),NOW())",
elementId, dashboardId,
el.get("type"), el.get("subtype"),
@@ -281,8 +281,8 @@ public class DashboardService extends BaseService {
d.put("is_public", row.get("is_public"));
d.put("created_by", row.get("created_by"));
d.put("created_by_name", row.get("created_by_name") != null ? row.get("created_by_name") : row.get("created_by"));
d.put("created_at", row.get("created_at"));
d.put("updated_at", row.get("updated_at"));
d.put("created_date", row.get("created_date"));
d.put("updated_date", row.get("updated_date"));
d.put("tags", parseJson(row.get("tags"), new ArrayList<>()));
d.put("category", row.get("category"));
d.put("view_count", toInt(row.get("view_count"), 0));
@@ -16,13 +16,13 @@ public class DbTypeCategoryService extends BaseService {
private static final String NS = "dbTypeCategory.";
public List<Map<String, Object>> getAllCategories() {
return sqlSession.selectList(NS + "select_all_categories");
return sqlSession.selectList(NS + "selectAllCategories");
}
public Map<String, Object> getCategoryByTypeCode(String typeCode) {
Map<String, Object> params = new HashMap<>();
params.put("type_code", typeCode);
return sqlSession.selectOne(NS + "select_category_by_type_code", params);
return sqlSession.selectOne(NS + "selectCategoryByTypeCode", params);
}
@Transactional
@@ -31,23 +31,23 @@ public class DbTypeCategoryService extends BaseService {
Map<String, Object> checkParams = new HashMap<>();
checkParams.put("type_code", typeCode);
Integer existing = sqlSession.selectOne(NS + "count_by_type_code", checkParams);
Integer existing = sqlSession.selectOne(NS + "countByTypeCode", checkParams);
if (existing != null && existing > 0) {
throw new IllegalArgumentException("이미 존재하는 DB 타입 코드입니다.");
}
sqlSession.insert(NS + "insert_category", params);
return sqlSession.selectOne(NS + "select_category_by_type_code", checkParams);
sqlSession.insert(NS + "insertCategory", params);
return sqlSession.selectOne(NS + "selectCategoryByTypeCode", checkParams);
}
@Transactional
public Map<String, Object> updateCategory(String typeCode, Map<String, Object> params) {
params.put("type_code", typeCode);
sqlSession.update(NS + "update_category", params);
sqlSession.update(NS + "updateCategory", params);
Map<String, Object> checkParams = new HashMap<>();
checkParams.put("type_code", typeCode);
return sqlSession.selectOne(NS + "select_category_by_type_code", checkParams);
return sqlSession.selectOne(NS + "selectCategoryByTypeCode", checkParams);
}
@Transactional
@@ -55,21 +55,21 @@ public class DbTypeCategoryService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("type_code", typeCode);
Integer connectionCount = sqlSession.selectOne(NS + "count_connections_by_type", params);
Integer connectionCount = sqlSession.selectOne(NS + "countConnectionsByType", params);
if (connectionCount != null && connectionCount > 0) {
throw new IllegalStateException(
"해당 DB 타입을 사용하는 연결이 " + connectionCount + "개 있어 삭제할 수 없습니다.");
}
sqlSession.update(NS + "deactivate_category", params);
sqlSession.update(NS + "deactivateCategory", params);
}
public List<Map<String, Object>> getConnectionStatsByType() {
return sqlSession.selectList(NS + "select_connection_stats_by_type");
return sqlSession.selectList(NS + "selectConnectionStatsByType");
}
@Transactional
public void initializeDefaultCategories() {
sqlSession.insert(NS + "insert_default_categories", null);
sqlSession.insert(NS + "insertDefaultCategories", null);
}
}
@@ -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);
}
@@ -20,9 +20,9 @@ public class DeliveryService extends BaseService {
public Map<String, Object> getDeliveryStatus(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
List<Map<String, Object>> deliveries = sqlSession.selectList(NS + "get_delivery_list", params);
List<Map<String, Object>> issues = sqlSession.selectList(NS + "get_customer_issue_list", params);
Map<String, Object> todayStats = sqlSession.selectOne(NS + "get_delivery_today_stats", params);
List<Map<String, Object>> deliveries = sqlSession.selectList(NS + "getDeliveryList", params);
List<Map<String, Object>> issues = sqlSession.selectList(NS + "getCustomerIssueList", params);
Map<String, Object> todayStats = sqlSession.selectOne(NS + "getDeliveryTodayStats", params);
Map<String, Object> result = new HashMap<>();
result.put("deliveries", deliveries);
@@ -33,18 +33,18 @@ public class DeliveryService extends BaseService {
public List<Map<String, Object>> getDelayedDeliveries(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_delayed_delivery_list", params);
return sqlSession.selectList(NS + "getDelayedDeliveryList", params);
}
public List<Map<String, Object>> getCustomerIssues(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_customer_issue_list", params);
return sqlSession.selectList(NS + "getCustomerIssueList", params);
}
@Transactional
public void updateDeliveryStatus(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
int rows = sqlSession.update(NS + "update_delivery_status", params);
int rows = sqlSession.update(NS + "updateDeliveryStatus", params);
if (rows == 0) {
throw new IllegalArgumentException("Delivery not found: " + params.get("id"));
}
@@ -53,7 +53,7 @@ public class DeliveryService extends BaseService {
@Transactional
public void updateIssueStatus(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
int rows = sqlSession.update(NS + "update_customer_issue_status", params);
int rows = sqlSession.update(NS + "updateCustomerIssueStatus", params);
if (rows == 0) {
throw new IllegalArgumentException("Customer issue not found: " + params.get("id"));
}
@@ -42,13 +42,13 @@ public class DynamicFormService extends BaseService {
public String resolveBaseTable(String tableName) {
try {
Map<String, Object> params = Map.of("table_name", tableName);
Map<String, Object> tableInfo = sqlSession.selectOne(NS + "select_table_type", params);
Map<String, Object> tableInfo = sqlSession.selectOne(NS + "selectTableType", params);
if (tableInfo == null || !"VIEW".equals(tableInfo.get("table_type"))) {
return tableName;
}
Map<String, Object> viewDef = sqlSession.selectOne(NS + "select_view_definition", params);
Map<String, Object> viewDef = sqlSession.selectOne(NS + "selectViewDefinition", params);
if (viewDef != null) {
String definition = (String) viewDef.get("view_definition");
if (definition != null) {
@@ -71,7 +71,7 @@ public class DynamicFormService extends BaseService {
*/
private List<String> getColumnNames(String tableName) {
Map<String, Object> params = Map.of("table_name", tableName);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_column_names", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectColumnNames", params);
return rows.stream()
.map(r -> (String) r.get("column_name"))
.collect(Collectors.toList());
@@ -82,7 +82,7 @@ public class DynamicFormService extends BaseService {
*/
private Map<String, String> getColumnTypeMap(String tableName) {
Map<String, Object> params = Map.of("table_name", tableName);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_column_types", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectColumnTypes", params);
Map<String, String> result = new LinkedHashMap<>();
for (Map<String, Object> row : rows) {
result.put((String) row.get("column_name"), (String) row.get("data_type"));
@@ -95,7 +95,7 @@ public class DynamicFormService extends BaseService {
*/
private List<String> getPrimaryKeyList(String tableName) {
Map<String, Object> params = Map.of("table_name", tableName);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_primary_keys", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectPrimaryKeys", params);
return rows.stream()
.map(r -> (String) r.get("column_name"))
.collect(Collectors.toList());
@@ -533,7 +533,7 @@ public class DynamicFormService extends BaseService {
String actualTable = resolveBaseTable(tableName);
validateName(actualTable);
Map<String, Object> pkInfo = sqlSession.selectOne(NS + "select_primary_key_with_type", Map.of("table_name", actualTable));
Map<String, Object> pkInfo = sqlSession.selectOne(NS + "selectPrimaryKeyWithType", Map.of("table_name", actualTable));
if (pkInfo == null) {
throw new IllegalStateException("테이블 " + actualTable + "의 기본키를 찾을 수 없습니다.");
}
@@ -556,7 +556,7 @@ public class DynamicFormService extends BaseService {
public Map<String, Object> getFormData(int id) {
Map<String, Object> params = Map.of("id", id);
Map<String, Object> row = sqlSession.selectOne(NS + "select_form_data", params);
Map<String, Object> row = sqlSession.selectOne(NS + "selectFormData", params);
if (row == null) return null;
// form_data jsonb를 Map으로 파싱
@@ -599,8 +599,8 @@ public class DynamicFormService extends BaseService {
params.put("size", size);
params.put("offset", offset);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_form_data_list", params);
Integer totalObj = sqlSession.selectOne(NS + "count_form_data_list", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectFormDataList", params);
Integer totalObj = sqlSession.selectOne(NS + "countFormDataList", params);
int total = totalObj != null ? totalObj : 0;
// form_data 파싱
@@ -648,8 +648,8 @@ public class DynamicFormService extends BaseService {
public List<Map<String, Object>> getTableColumns(String tableName) {
Map<String, Object> params = Map.of("table_name", tableName);
List<Map<String, Object>> columns = sqlSession.selectList(NS + "select_table_columns", params);
List<Map<String, Object>> pks = sqlSession.selectList(NS + "select_primary_keys", params);
List<Map<String, Object>> columns = sqlSession.selectList(NS + "selectTableColumns", params);
List<Map<String, Object>> pks = sqlSession.selectList(NS + "selectPrimaryKeys", params);
Set<String> pkSet = pks.stream().map(r -> (String) r.get("column_name")).collect(Collectors.toSet());
return columns.stream().map(col -> {
@@ -732,7 +732,7 @@ public class DynamicFormService extends BaseService {
}
if (!params.containsKey("trip_status")) params.put("trip_status", "active");
sqlSession.insert(NS + "insert_location_history", params);
sqlSession.insert(NS + "insertLocationHistory", params);
Map<String, Object> result = new LinkedHashMap<>();
result.put("id", params.get("id"));
@@ -744,7 +744,7 @@ public class DynamicFormService extends BaseService {
// startDate / endDate String Date if present
convertDateParam(params, "start_date");
convertDateParam(params, "end_date");
return sqlSession.selectList(NS + "select_location_history", params);
return sqlSession.selectList(NS + "selectLocationHistory", params);
}
private void convertDateParam(Map<String, Object> params, String key) {
@@ -107,13 +107,13 @@ public class EntityJoinService extends BaseService {
params.put("table_name", tableName);
params.put("company_code", companyCode);
List<Map<String, Object>> entityColumns = sqlSession.selectList(NS + "select_entity_columns", params);
List<Map<String, Object>> entityColumns = sqlSession.selectList(NS + "selectEntityColumns", params);
List<Map<String, Object>> joinConfigs = new ArrayList<>();
Map<String, Object> writerCheck = new HashMap<>();
writerCheck.put("table_name", tableName);
writerCheck.put("column_name", "writer");
if (sqlSession.selectOne(NS + "select_column_exists", writerCheck) != null) {
if (sqlSession.selectOne(NS + "selectColumnExists", writerCheck) != null) {
Map<String, Object> writerConfig = new LinkedHashMap<>();
writerConfig.put("source_table", tableName);
writerConfig.put("source_column", "writer");
@@ -174,12 +174,12 @@ public class EntityJoinService extends BaseService {
public List<Map<String, Object>> getReferenceTableColumns(String tableName, String companyCode) {
Map<String, Object> schemaParams = new HashMap<>();
schemaParams.put("table_name", tableName);
List<Map<String, Object>> schemaCols = sqlSession.selectList(NS + "select_table_schema_columns", schemaParams);
List<Map<String, Object>> schemaCols = sqlSession.selectList(NS + "selectTableSchemaColumns", schemaParams);
Map<String, Object> metaParams = new HashMap<>();
metaParams.put("table_name", tableName);
metaParams.put("company_code", companyCode);
List<Map<String, Object>> metaCols = sqlSession.selectList(NS + "select_column_metadata", metaParams);
List<Map<String, Object>> metaCols = sqlSession.selectList(NS + "selectColumnMetadata", metaParams);
Map<String, Map<String, Object>> metaByCol = metaCols.stream()
.collect(Collectors.toMap(
m -> (String) m.get("column_name"),
@@ -210,7 +210,7 @@ public class EntityJoinService extends BaseService {
params.put("table_name", tableName);
params.put("column_name", columnName);
params.put("company_code", companyCode);
sqlSession.update(NS + "upsert_column_entity_settings", params);
sqlSession.update(NS + "upsertColumnEntitySettings", params);
log.info("Entity 설정 업데이트: {}.{}", tableName, columnName);
}
@@ -376,7 +376,7 @@ public class EntityJoinService extends BaseService {
Map<String, Object> p = new HashMap<>();
p.put("table_name", refTable);
if (sqlSession.selectOne(NS + "select_table_exists", p) == null) {
if (sqlSession.selectOne(NS + "selectTableExists", p) == null) {
log.warn("참조 테이블 없음: {}", refTable);
return false;
}
@@ -384,9 +384,9 @@ public class EntityJoinService extends BaseService {
Map<String, Object> cp = new HashMap<>();
cp.put("table_name", refTable);
cp.put("column_name", refCol);
if (sqlSession.selectOne(NS + "select_column_exists", cp) == null) {
if (sqlSession.selectOne(NS + "selectColumnExists", cp) == null) {
cp.put("column_name", "id");
if (sqlSession.selectOne(NS + "select_column_exists", cp) != null) {
if (sqlSession.selectOne(NS + "selectColumnExists", cp) != null) {
config.put("reference_column", "id");
} else {
log.warn("참조 컬럼 없음: {}.{}", refTable, refCol);
@@ -398,7 +398,7 @@ public class EntityJoinService extends BaseService {
Map<String, Object> dp = new HashMap<>();
dp.put("table_name", refTable);
dp.put("column_name", displayCol);
if (sqlSession.selectOne(NS + "select_column_exists", dp) == null) {
if (sqlSession.selectOne(NS + "selectColumnExists", dp) == null) {
log.warn("표시 컬럼 없음: {}.{}", refTable, displayCol);
return false;
}
@@ -409,7 +409,7 @@ public class EntityJoinService extends BaseService {
private String autoDetectDisplayColumn(String refTable, String refCol) {
Map<String, Object> p = new HashMap<>();
p.put("table_name", refTable);
List<Map<String, Object>> cols = sqlSession.selectList(NS + "select_table_schema_columns", p);
List<Map<String, Object>> cols = sqlSession.selectList(NS + "selectTableSchemaColumns", p);
List<String> colNames = cols.stream()
.map(c -> (String) c.get("column_name"))
.collect(Collectors.toList());
@@ -19,7 +19,7 @@ public class EntityReferenceService extends BaseService {
int limit = toInt(params.getOrDefault("limit", 100));
Object search = params.get("search");
Map<String, Object> columnInfo = sqlSession.selectOne(NS + "select_column_info",
Map<String, Object> columnInfo = sqlSession.selectOne(NS + "selectColumnInfo",
Map.of("table_name", tableName, "column_name", columnName));
if (columnInfo == null) {
@@ -52,14 +52,14 @@ public class EntityReferenceService extends BaseService {
throw new IllegalArgumentException("잘못된 참조 테이블/컬럼 이름입니다.");
}
Integer tableExistsObj = sqlSession.selectOne(NS + "check_table_exists_in_schema",
Integer tableExistsObj = sqlSession.selectOne(NS + "checkTableExistsInSchema",
Map.of("table_name", safeTable));
int tableExists = tableExistsObj != null ? tableExistsObj : 0;
if (tableExists == 0) {
throw new IllegalStateException("참조 테이블 '" + safeTable + "'이 존재하지 않습니다.");
}
Integer hasCompanyCodeObj = sqlSession.selectOne(NS + "check_table_has_company_code",
Integer hasCompanyCodeObj = sqlSession.selectOne(NS + "checkTableHasCompanyCode",
Map.of("table_name", safeTable));
int hasCompanyCode = hasCompanyCodeObj != null ? hasCompanyCodeObj : 0;
@@ -77,7 +77,7 @@ public class EntityReferenceService extends BaseService {
log.info("엔티티 참조 데이터 조회: {}.{} -> {}.{} (display: {}), company={}",
tableName, columnName, safeTable, safeRefCol, safeDispCol, companyCode);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_reference_data", queryParams);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectReferenceData", queryParams);
List<Map<String, Object>> options = new ArrayList<>();
for (Map<String, Object> row : rows) {
@@ -116,7 +116,7 @@ public class EntityReferenceService extends BaseService {
log.info("공통 코드 데이터 조회: category={}, company={}", codeCategory, companyCode);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_code_data", queryParams);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectCodeData", queryParams);
List<Map<String, Object>> options = new ArrayList<>();
for (Map<String, Object> row : rows) {
@@ -32,7 +32,7 @@ public class EntitySearchService extends BaseService {
private Set<String> fetchColumns(String tableName) {
Map<String, Object> p = new HashMap<>();
p.put("table_name", tableName);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_table_column_list", p);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getTableColumnList", p);
return rows.stream()
.map(r -> (String) r.get("column_name"))
.filter(Objects::nonNull)
@@ -238,7 +238,7 @@ public class EntitySearchService extends BaseService {
try {
Map<String, Object> pkp = new HashMap<>();
pkp.put("table_name", tableName);
Map<String, Object> pk = sqlSession.selectOne(NS + "get_primary_key_info", pkp);
Map<String, Object> pk = sqlSession.selectOne(NS + "getPrimaryKeyInfo", pkp);
if (pk != null && pk.get("column_name") != null) {
orderByColumn = "\"" + sanitize((String) pk.get("column_name")) + "\"";
}
@@ -257,8 +257,8 @@ public class EntitySearchService extends BaseService {
qp.put("page_limit", limit);
qp.put("page_offset", offset);
List<Map<String, Object>> data = sqlSession.selectList(NS + "get_entity_search_list", qp);
Integer totalObj = sqlSession.selectOne(NS + "get_entity_search_list_cnt", qp);
List<Map<String, Object>> data = sqlSession.selectList(NS + "getEntitySearchList", qp);
Integer totalObj = sqlSession.selectOne(NS + "getEntitySearchListCnt", qp);
int total = totalObj != null ? totalObj : 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -325,7 +325,7 @@ public class EntitySearchService extends BaseService {
qp.put("where_clause", whereClause.toString());
qp.put("label_column", "\"" + labelCol + "\"");
return sqlSession.selectList(NS + "get_entity_option_list", qp);
return sqlSession.selectList(NS + "getEntityOptionList", qp);
}
public List<Map<String, Object>> getDistinctColumnValues(Map<String, Object> params) {
@@ -366,7 +366,7 @@ public class EntitySearchService extends BaseService {
qp.put("label_column", "\"" + effectiveLabelCol + "\"");
qp.put("where_clause", whereClause.toString());
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_distinct_value_list", qp);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getDistinctValueList", qp);
if (rows.isEmpty()) return rows;
@@ -382,7 +382,7 @@ public class EntitySearchService extends BaseService {
cvp.put("column_name", columnName);
cvp.put("raw_values", rawValues);
cvp.put("company_code", companyCode);
List<Map<String, Object>> cvRows = sqlSession.selectList(NS + "get_category_value_list", cvp);
List<Map<String, Object>> cvRows = sqlSession.selectList(NS + "getCategoryValueList", cvp);
for (Map<String, Object> r : cvRows) {
labelMap.put((String) r.get("value_code"), (String) r.get("value_label"));
}
@@ -394,7 +394,7 @@ public class EntitySearchService extends BaseService {
Map<String, Object> ttcp = new HashMap<>();
ttcp.put("table_name", tableName);
ttcp.put("column_name", columnName);
Map<String, Object> ttcRow = sqlSession.selectOne(NS + "get_code_category_info", ttcp);
Map<String, Object> ttcRow = sqlSession.selectOne(NS + "getCodeCategoryInfo", ttcp);
String codeCategory = ttcRow != null ? (String) ttcRow.get("code_category") : null;
if (codeCategory != null) {
@@ -402,7 +402,7 @@ public class EntitySearchService extends BaseService {
cip.put("code_category", codeCategory);
cip.put("raw_values", rawValues);
cip.put("company_code", companyCode);
List<Map<String, Object>> ciRows = sqlSession.selectList(NS + "get_code_info_list", cip);
List<Map<String, Object>> ciRows = sqlSession.selectList(NS + "getCodeInfoList", cip);
for (Map<String, Object> r : ciRows) {
String codeValue = (String) r.get("code_value");
if (!labelMap.containsKey(codeValue)) {
@@ -35,9 +35,9 @@ public class FileService extends BaseService {
public Map<String, Object> getFileList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
Integer totalObj = sqlSession.selectOne(NS + "get_file_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getFileListCnt", params);
int totalCount = totalObj != null ? totalObj : 0;
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_file_list", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getFileList", params);
return commonService.buildListResponse(list, totalCount, params);
}
@@ -45,19 +45,19 @@ public class FileService extends BaseService {
public Map<String, Object> getFileInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_file_info", params);
return sqlSession.selectOne(NS + "getFileInfo", params);
}
public Map<String, Object> getFileInfoPublic(Map<String, Object> params) {
// public 접근 company_code 필터 없음
return sqlSession.selectOne(NS + "get_file_info", params);
return sqlSession.selectOne(NS + "getFileInfo", params);
}
// 타겟별 파일 목록
public List<Map<String, Object>> getFilesByTarget(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_files_by_target", params);
return sqlSession.selectList(NS + "getFilesByTarget", params);
}
// 업로드
@@ -118,7 +118,7 @@ public class FileService extends BaseService {
fileParams.put("status", "ACTIVE");
fileParams.put("is_representative", false);
sqlSession.insert(NS + "insert_file", fileParams);
sqlSession.insert(NS + "insertFile", fileParams);
Map<String, Object> result = new HashMap<>();
result.put("objid", objid);
@@ -149,6 +149,6 @@ public class FileService extends BaseService {
@Transactional
public void deleteFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "soft_delete_file", params);
sqlSession.update(NS + "softDeleteFile", params);
}
}
@@ -19,34 +19,34 @@ public class MailAccountFileService extends BaseService {
public Map<String, Object> getMailAccountFileList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_mail_account_file_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_mail_account_file_list", params);
int totalCount = sqlSession.selectOne(NS + "getMailAccountFileListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getMailAccountFileList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getMailAccountFileInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_account_file_info", params);
return sqlSession.selectOne(NS + "getMailAccountFileInfo", params);
}
@Transactional
public Map<String, Object> insertMailAccountFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_mail_account_file", params);
sqlSession.insert(NS + "insertMailAccountFile", params);
return params;
}
@Transactional
public Map<String, Object> updateMailAccountFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_mail_account_file", params);
sqlSession.update(NS + "updateMailAccountFile", params);
return params;
}
@Transactional
public Map<String, Object> deleteMailAccountFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_mail_account_file", params);
sqlSession.delete(NS + "deleteMailAccountFile", params);
return params;
}
}
@@ -22,43 +22,43 @@ public class MailReceiveBasicService extends BaseService {
public Map<String, Object> getMailReceiveBasicList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_mail_receive_basic_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_mail_receive_basic_list", params);
int totalCount = sqlSession.selectOne(NS + "getMailReceiveBasicListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getMailReceiveBasicList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public int getMailReceiveBasicTodayCount(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_receive_basic_today_count", params);
return sqlSession.selectOne(NS + "getMailReceiveBasicTodayCount", params);
}
public Map<String, Object> getMailReceiveBasicInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_receive_basic_info", params);
return sqlSession.selectOne(NS + "getMailReceiveBasicInfo", params);
}
@Transactional
public Map<String, Object> markMailReceiveBasicAsRead(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_mail_receive_basic_as_read", params);
sqlSession.update(NS + "updateMailReceiveBasicAsRead", params);
return params;
}
@Transactional
public Map<String, Object> deleteMailReceiveBasic(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "delete_mail_receive_basic", params);
sqlSession.update(NS + "deleteMailReceiveBasic", params);
return params;
}
public Map<String, Object> getMailReceiveBasicAttachment(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_receive_basic_attachment", params);
return sqlSession.selectOne(NS + "getMailReceiveBasicAttachment", params);
}
public Map<String, Object> testMailReceiveBasicImapConnection(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> account = sqlSession.selectOne(NS + "get_mail_receive_basic_account_info", params);
Map<String, Object> account = sqlSession.selectOne(NS + "getMailReceiveBasicAccountInfo", params);
if (account == null) {
Map<String, Object> result = new HashMap<>();
result.put("success", false);
@@ -37,14 +37,14 @@ public class MailSentHistoryService extends BaseService {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_mail_sent_history_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_mail_sent_history_list", params);
int totalCount = sqlSession.selectOne(NS + "getMailSentHistoryListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getMailSentHistoryList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getMailSentHistoryInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_sent_history_info", params);
return sqlSession.selectOne(NS + "getMailSentHistoryInfo", params);
}
@Transactional
@@ -63,41 +63,41 @@ public class MailSentHistoryService extends BaseService {
Map<String, Object> lookupParams = new HashMap<>();
lookupParams.put("id", id);
lookupParams.put("company_code", params.get("company_code"));
Map<String, Object> existing = sqlSession.selectOne(NS + "get_mail_sent_history_info", lookupParams);
Map<String, Object> existing = sqlSession.selectOne(NS + "getMailSentHistoryInfo", lookupParams);
if (existing != null) {
sqlSession.update(NS + "update_mail_sent_history", params);
sqlSession.update(NS + "updateMailSentHistory", params);
} else {
sqlSession.insert(NS + "insert_mail_sent_history", params);
sqlSession.insert(NS + "insertMailSentHistory", params);
}
return sqlSession.selectOne(NS + "get_mail_sent_history_info", lookupParams);
return sqlSession.selectOne(NS + "getMailSentHistoryInfo", lookupParams);
}
@Transactional
public Map<String, Object> updateMailSentHistoryDraft(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_mail_sent_history", params);
return sqlSession.selectOne(NS + "get_mail_sent_history_info", params);
sqlSession.update(NS + "updateMailSentHistory", params);
return sqlSession.selectOne(NS + "getMailSentHistoryInfo", params);
}
@Transactional
public Map<String, Object> deleteMailSentHistory(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "soft_delete_mail_sent_history", params);
sqlSession.update(NS + "softDeleteMailSentHistory", params);
return params;
}
@Transactional
public Map<String, Object> permanentlyDeleteMailSentHistory(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "permanent_delete_mail_sent_history", params);
sqlSession.delete(NS + "permanentDeleteMailSentHistory", params);
return params;
}
@Transactional
public Map<String, Object> restoreMailSentHistory(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "restore_mail_sent_history", params);
sqlSession.update(NS + "restoreMailSentHistory", params);
return params;
}
@@ -108,7 +108,7 @@ public class MailSentHistoryService extends BaseService {
if (ids == null || ids.isEmpty()) {
return Map.of("success_count", 0, "fail_count", 0);
}
int successCount = sqlSession.update(NS + "bulk_soft_delete_mail_sent_history", params);
int successCount = sqlSession.update(NS + "bulkSoftDeleteMailSentHistory", params);
return Map.of("success_count", successCount, "fail_count", Math.max(0, ids.size() - successCount));
}
@@ -119,7 +119,7 @@ public class MailSentHistoryService extends BaseService {
if (ids == null || ids.isEmpty()) {
return Map.of("success_count", 0, "fail_count", 0);
}
int successCount = sqlSession.delete(NS + "bulk_permanent_delete_mail_sent_history", params);
int successCount = sqlSession.delete(NS + "bulkPermanentDeleteMailSentHistory", params);
return Map.of("success_count", successCount, "fail_count", Math.max(0, ids.size() - successCount));
}
@@ -130,13 +130,13 @@ public class MailSentHistoryService extends BaseService {
if (ids == null || ids.isEmpty()) {
return Map.of("success_count", 0, "fail_count", 0);
}
int successCount = sqlSession.update(NS + "bulk_restore_mail_sent_history", params);
int successCount = sqlSession.update(NS + "bulkRestoreMailSentHistory", params);
return Map.of("success_count", successCount, "fail_count", Math.max(0, ids.size() - successCount));
}
public Map<String, Object> getMailSentHistoryStatistics(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> stats = sqlSession.selectOne(NS + "get_mail_sent_history_statistics", params);
Map<String, Object> stats = sqlSession.selectOne(NS + "getMailSentHistoryStatistics", params);
if (stats == null) stats = new HashMap<>();
long totalSent = toLong(stats.get("total_sent"));
@@ -155,7 +155,7 @@ public class MailSentHistoryService extends BaseService {
if (params.get("sent_at") == null) {
params.put("sent_at", new Timestamp(System.currentTimeMillis()));
}
sqlSession.insert(NS + "insert_mail_sent_history", params);
sqlSession.insert(NS + "insertMailSentHistory", params);
return params;
}
@@ -24,21 +24,21 @@ public class MailTemplateFileService extends BaseService {
public Map<String, Object> getMailTemplateFileList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_mail_template_file_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_mail_template_file_list", params);
int totalCount = sqlSession.selectOne(NS + "getMailTemplateFileListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getMailTemplateFileList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getMailTemplateFileInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_mail_template_file_info", params);
return sqlSession.selectOne(NS + "getMailTemplateFileInfo", params);
}
@Transactional
public Map<String, Object> insertMailTemplateFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
serializeJsonFields(params);
sqlSession.insert(NS + "insert_mail_template_file", params);
sqlSession.insert(NS + "insertMailTemplateFile", params);
return params;
}
@@ -46,21 +46,21 @@ public class MailTemplateFileService extends BaseService {
public Map<String, Object> updateMailTemplateFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
serializeJsonFields(params);
sqlSession.update(NS + "update_mail_template_file", params);
sqlSession.update(NS + "updateMailTemplateFile", params);
return params;
}
@Transactional
public Map<String, Object> deleteMailTemplateFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_mail_template_file", params);
sqlSession.delete(NS + "deleteMailTemplateFile", params);
return params;
}
@SuppressWarnings("unchecked")
public Map<String, Object> previewMailTemplateFile(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> template = sqlSession.selectOne(NS + "get_mail_template_file_info", params);
Map<String, Object> template = sqlSession.selectOne(NS + "getMailTemplateFileInfo", params);
if (template == null) {
return Collections.emptyMap();
}
@@ -14,34 +14,34 @@ public class MultilangService extends BaseService {
private static final String NS = "multilang.";
public List<Map<String, Object>> getLanguages() {
return sqlSession.selectList(NS + "get_multilang_language_list", new HashMap<>());
return sqlSession.selectList(NS + "getMultilangLanguageList", new HashMap<>());
}
public Map<String, Object> createLanguage(Map<String, Object> params) {
String langCode = str(params.get("lang_code"));
Map<String, Object> check = Map.of("lang_code", langCode);
if (sqlSession.selectOne(NS + "get_multilang_language_info", check) != null) {
if (sqlSession.selectOne(NS + "getMultilangLanguageInfo", check) != null) {
throw new IllegalArgumentException("이미 존재하는 언어 코드입니다: " + langCode);
}
if (params.get("is_active") == null) params.put("is_active", "Y");
if (params.get("sort_order") == null) params.put("sort_order", 0);
sqlSession.insert(NS + "insert_multilang_language", params);
return sqlSession.selectOne(NS + "get_multilang_language_info", check);
sqlSession.insert(NS + "insertMultilangLanguage", params);
return sqlSession.selectOne(NS + "getMultilangLanguageInfo", check);
}
public Map<String, Object> updateLanguage(String langCode, Map<String, Object> params) {
params.put("lang_code", langCode);
Map<String, Object> check = Map.of("lang_code", langCode);
if (sqlSession.selectOne(NS + "get_multilang_language_info", check) == null) {
if (sqlSession.selectOne(NS + "getMultilangLanguageInfo", check) == null) {
throw new IllegalArgumentException("언어를 찾을 수 없습니다: " + langCode);
}
sqlSession.update(NS + "update_multilang_language", params);
return sqlSession.selectOne(NS + "get_multilang_language_info", check);
sqlSession.update(NS + "updateMultilangLanguage", params);
return sqlSession.selectOne(NS + "getMultilangLanguageInfo", check);
}
public String toggleLanguage(String langCode) {
Map<String, Object> check = Map.of("lang_code", langCode);
Map<String, Object> current = sqlSession.selectOne(NS + "get_multilang_language_info", check);
Map<String, Object> current = sqlSession.selectOne(NS + "getMultilangLanguageInfo", check);
if (current == null) {
throw new IllegalArgumentException("언어를 찾을 수 없습니다: " + langCode);
}
@@ -50,72 +50,72 @@ public class MultilangService extends BaseService {
params.put("lang_code", langCode);
params.put("new_status", newStatus);
params.put("updated_by", "system");
sqlSession.update(NS + "update_multilang_language_status", params);
sqlSession.update(NS + "updateMultilangLanguageStatus", params);
return "Y".equals(newStatus) ? "활성화" : "비활성화";
}
@Transactional
public void deleteLanguage(String langCode) {
Map<String, Object> check = Map.of("lang_code", langCode);
if (sqlSession.selectOne(NS + "get_multilang_language_info", check) == null) {
if (sqlSession.selectOne(NS + "getMultilangLanguageInfo", check) == null) {
throw new IllegalArgumentException("언어를 찾을 수 없습니다: " + langCode);
}
Map<String, Object> params = Map.of("lang_code", langCode);
sqlSession.delete(NS + "delete_multilang_text_by_lang_code", params);
sqlSession.delete(NS + "delete_multilang_language", params);
sqlSession.delete(NS + "deleteMultilangTextByLangCode", params);
sqlSession.delete(NS + "deleteMultilangLanguage", params);
}
public List<Map<String, Object>> getLangKeys(Map<String, Object> params) {
if (params.containsKey("company_code")) {
params.put("filter_company_code", params.get("company_code"));
}
return sqlSession.selectList(NS + "get_multilang_key_list", params);
return sqlSession.selectList(NS + "getMultilangKeyList", params);
}
public List<Map<String, Object>> getLangTexts(int keyId) {
return sqlSession.selectList(NS + "get_multilang_text_list", Map.of("key_id", keyId));
return sqlSession.selectList(NS + "getMultilangTextList", Map.of("key_id", keyId));
}
public int createLangKey(Map<String, Object> params) {
String companyCode = str(params.get("company_code"));
String langKey = str(params.get("lang_key"));
Map<String, Object> dupCheck = Map.of("company_code", companyCode, "lang_key", langKey);
if (sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", dupCheck) != null) {
if (sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", dupCheck) != null) {
throw new IllegalArgumentException("동일한 회사에 이미 존재하는 언어키입니다: " + langKey);
}
if (params.get("is_active") == null) params.put("is_active", "Y");
sqlSession.insert(NS + "insert_multilang_key", params);
sqlSession.insert(NS + "insertMultilangKey", params);
return toInt(params.get("key_id"));
}
public void updateLangKey(int keyId, Map<String, Object> params) {
params.put("key_id", keyId);
if (sqlSession.selectOne(NS + "get_multilang_key_info", Map.of("key_id", keyId)) == null) {
if (sqlSession.selectOne(NS + "getMultilangKeyInfo", Map.of("key_id", keyId)) == null) {
throw new IllegalArgumentException("다국어 키를 찾을 수 없습니다: " + keyId);
}
String companyCode = str(params.get("company_code"));
String langKey = str(params.get("lang_key"));
if (!companyCode.isEmpty() && !langKey.isEmpty()) {
Map<String, Object> dupCheck = Map.of("company_code", companyCode, "lang_key", langKey, "key_id", keyId);
if (sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key_exclude", dupCheck) != null) {
if (sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKeyExclude", dupCheck) != null) {
throw new IllegalArgumentException("동일한 회사에 이미 존재하는 언어키입니다: " + langKey);
}
}
sqlSession.update(NS + "update_multilang_key", params);
sqlSession.update(NS + "updateMultilangKey", params);
}
@Transactional
public void deleteLangKey(int keyId) {
if (sqlSession.selectOne(NS + "get_multilang_key_info", Map.of("key_id", keyId)) == null) {
if (sqlSession.selectOne(NS + "getMultilangKeyInfo", Map.of("key_id", keyId)) == null) {
throw new IllegalArgumentException("다국어 키를 찾을 수 없습니다: " + keyId);
}
Map<String, Object> params = Map.of("key_id", keyId);
sqlSession.delete(NS + "delete_multilang_text_by_key_id", params);
sqlSession.delete(NS + "delete_multilang_key", params);
sqlSession.delete(NS + "deleteMultilangTextByKeyId", params);
sqlSession.delete(NS + "deleteMultilangKey", params);
}
public String toggleLangKey(int keyId) {
Map<String, Object> current = sqlSession.selectOne(NS + "get_multilang_key_info", Map.of("key_id", keyId));
Map<String, Object> current = sqlSession.selectOne(NS + "getMultilangKeyInfo", Map.of("key_id", keyId));
if (current == null) {
throw new IllegalArgumentException("다국어 키를 찾을 수 없습니다: " + keyId);
}
@@ -124,21 +124,21 @@ public class MultilangService extends BaseService {
params.put("key_id", keyId);
params.put("new_status", newStatus);
params.put("updated_by", "system");
sqlSession.update(NS + "update_multilang_key_status", params);
sqlSession.update(NS + "updateMultilangKeyStatus", params);
return "Y".equals(newStatus) ? "활성화" : "비활성화";
}
@Transactional
public void saveLangTexts(int keyId, List<Map<String, Object>> texts) {
if (sqlSession.selectOne(NS + "get_multilang_key_info", Map.of("key_id", keyId)) == null) {
if (sqlSession.selectOne(NS + "getMultilangKeyInfo", Map.of("key_id", keyId)) == null) {
throw new IllegalArgumentException("다국어 키를 찾을 수 없습니다: " + keyId);
}
sqlSession.delete(NS + "delete_multilang_text_by_key_id", Map.of("key_id", keyId));
sqlSession.delete(NS + "deleteMultilangTextByKeyId", Map.of("key_id", keyId));
for (Map<String, Object> text : texts) {
Map<String, Object> params = new HashMap<>(text);
params.put("key_id", keyId);
if (params.get("is_active") == null) params.put("is_active", "Y");
sqlSession.insert(NS + "insert_multilang_text", params);
sqlSession.insert(NS + "insertMultilangText", params);
}
}
@@ -146,14 +146,14 @@ public class MultilangService extends BaseService {
Map<String, Object> params = Map.of(
"company_code", companyCode, "menu_code", menuCode,
"lang_key", langKey, "user_lang", userLang);
Map<String, Object> result = sqlSession.selectOne(NS + "get_multilang_user_text", params);
Map<String, Object> result = sqlSession.selectOne(NS + "getMultilangUserText", params);
return result != null ? str(result.get("lang_text")) : langKey;
}
public String getLangText(String companyCode, String langKey, String langCode) {
Map<String, Object> params = Map.of(
"company_code", companyCode, "lang_key", langKey, "lang_code", langCode);
Map<String, Object> result = sqlSession.selectOne(NS + "get_multilang_single_text", params);
Map<String, Object> result = sqlSession.selectOne(NS + "getMultilangSingleText", params);
return result != null ? str(result.get("lang_text")) : langKey;
}
@@ -165,7 +165,7 @@ public class MultilangService extends BaseService {
params.put("menu_code", menuCode);
params.put("user_lang", userLang);
params.put("lang_keys", langKeys);
List<Map<String, Object>> translations = sqlSession.selectList(NS + "get_multilang_batch_translation_list", params);
List<Map<String, Object>> translations = sqlSession.selectList(NS + "getMultilangBatchTranslationList", params);
Map<String, String> result = new LinkedHashMap<>();
Set<String> processed = new HashSet<>();
for (Map<String, Object> t : translations) {
@@ -180,7 +180,7 @@ public class MultilangService extends BaseService {
Map<String, Object> fallbackParams = new HashMap<>();
fallbackParams.put("company_code", companyCode);
fallbackParams.put("missing_keys", missingKeys);
List<Map<String, Object>> fallback = sqlSession.selectList(NS + "get_multilang_fallback_translation_list", fallbackParams);
List<Map<String, Object>> fallback = sqlSession.selectList(NS + "getMultilangFallbackTranslationList", fallbackParams);
Set<String> fbProcessed = new HashSet<>();
for (Map<String, Object> t : fallback) {
String key = str(t.get("lang_key"));
@@ -195,16 +195,16 @@ public class MultilangService extends BaseService {
}
public List<Map<String, Object>> getCategories() {
List<Map<String, Object>> flat = sqlSession.selectList(NS + "get_multilang_category_list", new HashMap<>());
List<Map<String, Object>> flat = sqlSession.selectList(NS + "getMultilangCategoryList", new HashMap<>());
return buildCategoryTree(flat);
}
public Map<String, Object> getCategoryById(int categoryId) {
return sqlSession.selectOne(NS + "get_multilang_category_info", Map.of("category_id", categoryId));
return sqlSession.selectOne(NS + "getMultilangCategoryInfo", Map.of("category_id", categoryId));
}
public List<Map<String, Object>> getCategoryPath(int categoryId) {
return sqlSession.selectList(NS + "get_multilang_category_path", Map.of("category_id", categoryId));
return sqlSession.selectList(NS + "getMultilangCategoryPath", Map.of("category_id", categoryId));
}
private List<Map<String, Object>> buildCategoryTree(List<Map<String, Object>> flat) {
@@ -242,7 +242,7 @@ public class MultilangService extends BaseService {
List<Map<String, Object>> categoryPath = getCategoryPath(categoryId);
if (categoryPath.isEmpty()) throw new IllegalArgumentException("존재하지 않는 카테고리입니다");
String langKey = buildLangKey(categoryPath, keyMeaning);
if (sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", Map.of("company_code", companyCode, "lang_key", langKey)) != null) {
if (sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("company_code", companyCode, "lang_key", langKey)) != null) {
throw new IllegalArgumentException("이미 존재하는 키입니다: " + langKey);
}
Map<String, Object> insertParams = new HashMap<>();
@@ -253,7 +253,7 @@ public class MultilangService extends BaseService {
insertParams.put("usage_note", params.get("usage_note"));
insertParams.put("description", params.get("usage_note"));
insertParams.put("created_by", params.getOrDefault("created_by", "system"));
sqlSession.insert(NS + "insert_multilang_key_with_category", insertParams);
sqlSession.insert(NS + "insertMultilangKeyWithCategory", insertParams);
int keyId = toInt(insertParams.get("key_id"));
@SuppressWarnings("unchecked")
List<Map<String, Object>> texts = (List<Map<String, Object>>) params.get("texts");
@@ -264,7 +264,7 @@ public class MultilangService extends BaseService {
if (tp.get("is_active") == null) tp.put("is_active", "Y");
if (tp.get("created_by") == null) tp.put("created_by", params.getOrDefault("created_by", "system"));
if (tp.get("updated_by") == null) tp.put("updated_by", params.getOrDefault("created_by", "system"));
sqlSession.insert(NS + "insert_multilang_text", tp);
sqlSession.insert(NS + "insertMultilangText", tp);
}
}
return keyId;
@@ -274,8 +274,8 @@ public class MultilangService extends BaseService {
List<Map<String, Object>> categoryPath = getCategoryPath(categoryId);
if (categoryPath.isEmpty()) throw new IllegalArgumentException("존재하지 않는 카테고리입니다");
String langKey = buildLangKey(categoryPath, keyMeaning);
Map<String, Object> commonKey = sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", Map.of("company_code", "*", "lang_key", langKey));
Map<String, Object> companyKey = sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", Map.of("company_code", companyCode, "lang_key", langKey));
Map<String, Object> commonKey = sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("company_code", "*", "lang_key", langKey));
Map<String, Object> companyKey = sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("company_code", companyCode, "lang_key", langKey));
Map<String, Object> result = new LinkedHashMap<>();
result.put("lang_key", langKey);
result.put("exists", companyKey != null);
@@ -288,11 +288,11 @@ public class MultilangService extends BaseService {
public int createOverrideKey(Map<String, Object> params) {
int baseKeyId = toInt(params.get("base_key_id"));
String companyCode = str(params.get("company_code"));
Map<String, Object> baseKey = sqlSession.selectOne(NS + "get_multilang_base_key_info", Map.of("key_id", baseKeyId));
Map<String, Object> baseKey = sqlSession.selectOne(NS + "getMultilangBaseKeyInfo", Map.of("key_id", baseKeyId));
if (baseKey == null) throw new IllegalArgumentException("원본 키를 찾을 수 없습니다");
if (!"*".equals(str(baseKey.get("company_code")))) throw new IllegalArgumentException("공통 키(*)만 오버라이드 할 수 있습니다");
String langKey = str(baseKey.get("lang_key"));
if (sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", Map.of("company_code", companyCode, "lang_key", langKey)) != null) {
if (sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("company_code", companyCode, "lang_key", langKey)) != null) {
throw new IllegalArgumentException("이미 해당 회사의 오버라이드 키가 존재합니다");
}
Map<String, Object> insertParams = new HashMap<>();
@@ -302,7 +302,7 @@ public class MultilangService extends BaseService {
insertParams.put("key_meaning", baseKey.get("key_meaning"));
insertParams.put("base_key_id", baseKeyId);
insertParams.put("created_by", params.getOrDefault("created_by", "system"));
sqlSession.insert(NS + "insert_multilang_override_key", insertParams);
sqlSession.insert(NS + "insertMultilangOverrideKey", insertParams);
int keyId = toInt(insertParams.get("key_id"));
@SuppressWarnings("unchecked")
List<Map<String, Object>> texts = (List<Map<String, Object>>) params.get("texts");
@@ -313,27 +313,27 @@ public class MultilangService extends BaseService {
if (tp.get("is_active") == null) tp.put("is_active", "Y");
if (tp.get("created_by") == null) tp.put("created_by", params.getOrDefault("created_by", "system"));
if (tp.get("updated_by") == null) tp.put("updated_by", params.getOrDefault("created_by", "system"));
sqlSession.insert(NS + "insert_multilang_text", tp);
sqlSession.insert(NS + "insertMultilangText", tp);
}
}
return keyId;
}
public List<Map<String, Object>> getOverrideKeys(String companyCode) {
return sqlSession.selectList(NS + "get_multilang_override_key_list", Map.of("company_code", companyCode));
return sqlSession.selectList(NS + "getMultilangOverrideKeyList", Map.of("company_code", companyCode));
}
@Transactional
public List<Map<String, Object>> generateScreenLabelKeys(Map<String, Object> params) {
int screenId = toInt(params.get("screen_id"));
Map<String, Object> screenInfo = sqlSession.selectOne(NS + "get_multilang_screen_company_code", Map.of("screen_id", screenId));
Map<String, Object> screenInfo = sqlSession.selectOne(NS + "getMultilangScreenCompanyCode", Map.of("screen_id", screenId));
String companyCode = (screenInfo != null && !str(screenInfo.get("company_code")).isEmpty())
? str(screenInfo.get("company_code")) : str(params.getOrDefault("company_code", "*"));
String companyName;
if ("*".equals(companyCode)) {
companyName = "공통";
} else {
Map<String, Object> companyInfo = sqlSession.selectOne(NS + "get_multilang_company_name", Map.of("company_code", companyCode));
Map<String, Object> companyInfo = sqlSession.selectOne(NS + "getMultilangCompanyName", Map.of("company_code", companyCode));
companyName = (companyInfo != null) ? str(companyInfo.get("company_name")) : companyCode;
}
List<String> groupPath = getScreenGroupPath(screenId);
@@ -351,7 +351,7 @@ public class MultilangService extends BaseService {
List<String> parts = new ArrayList<>(keyPrefixParts);
parts.add(keyMeaning);
String langKey = String.join(".", parts);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_multilang_key_by_company_and_key", Map.of("company_code", companyCode, "lang_key", langKey));
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangKeyByCompanyAndKey", Map.of("company_code", companyCode, "lang_key", langKey));
int keyId;
if (existing != null) {
keyId = toInt(existing.get("key_id"));
@@ -363,9 +363,9 @@ public class MultilangService extends BaseService {
insertParams.put("is_active", "Y");
insertParams.put("category_id", categoryId);
insertParams.put("key_meaning", keyMeaning);
sqlSession.insert(NS + "insert_multilang_key_with_category", insertParams);
sqlSession.insert(NS + "insertMultilangKeyWithCategory", insertParams);
keyId = toInt(insertParams.get("key_id"));
sqlSession.update(NS + "upsert_multilang_text", Map.of("key_id", keyId, "lang_code", "KR", "lang_text", label));
sqlSession.update(NS + "upsertMultilangText", Map.of("key_id", keyId, "lang_code", "KR", "lang_text", label));
}
Map<String, Object> entry = new LinkedHashMap<>();
entry.put("component_id", componentId);
@@ -377,10 +377,10 @@ public class MultilangService extends BaseService {
}
private List<String> getScreenGroupPath(int screenId) {
Map<String, Object> groupRow = sqlSession.selectOne(NS + "get_multilang_screen_group_id", Map.of("screen_id", screenId));
Map<String, Object> groupRow = sqlSession.selectOne(NS + "getMultilangScreenGroupId", Map.of("screen_id", screenId));
if (groupRow == null) return Collections.emptyList();
int groupId = toInt(groupRow.get("group_id"));
List<Map<String, Object>> groups = sqlSession.selectList(NS + "get_multilang_screen_group_path", Map.of("group_id", groupId));
List<Map<String, Object>> groups = sqlSession.selectList(NS + "getMultilangScreenGroupPath", Map.of("group_id", groupId));
List<String> path = new ArrayList<>();
for (Map<String, Object> g : groups) path.add(str(g.get("group_name")));
return path;
@@ -391,7 +391,7 @@ public class MultilangService extends BaseService {
int parentId = ensureCompanyCategory(companyCode, companyName);
int currentLevel = 3;
for (String groupName : groupPath) {
Map<String, Object> existing = sqlSession.selectOne(NS + "get_multilang_category_by_name_and_parent", Map.of("category_name", groupName, "parent_id", parentId));
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangCategoryByNameAndParent", Map.of("category_name", groupName, "parent_id", parentId));
if (existing != null) {
parentId = toInt(existing.get("category_id"));
} else {
@@ -403,7 +403,7 @@ public class MultilangService extends BaseService {
insertParams.put("key_prefix", groupName.toLowerCase().replace("\\s+", "_"));
insertParams.put("description", groupName + " 화면 그룹의 다국어");
insertParams.put("sort_order", 0);
sqlSession.insert(NS + "insert_multilang_category", insertParams);
sqlSession.insert(NS + "insertMultilangCategory", insertParams);
parentId = toInt(insertParams.get("category_id"));
}
currentLevel++;
@@ -413,7 +413,7 @@ public class MultilangService extends BaseService {
private int ensureCompanyCategory(String companyCode, String companyName) {
int screenRootId = ensureScreenRootCategory();
Map<String, Object> existing = sqlSession.selectOne(NS + "get_multilang_category_by_code_and_parent", Map.of("category_code", companyCode, "parent_id", screenRootId));
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangCategoryByCodeAndParent", Map.of("category_code", companyCode, "parent_id", screenRootId));
if (existing != null) return toInt(existing.get("category_id"));
String displayName = "*".equals(companyCode) ? "공통" : companyName;
String keyPrefix = "*".equals(companyCode) ? "common" : companyCode.toLowerCase();
@@ -425,12 +425,12 @@ public class MultilangService extends BaseService {
insertParams.put("key_prefix", keyPrefix);
insertParams.put("description", displayName + " 회사의 화면 다국어");
insertParams.put("sort_order", "*".equals(companyCode) ? 0 : 10);
sqlSession.insert(NS + "insert_multilang_category", insertParams);
sqlSession.insert(NS + "insertMultilangCategory", insertParams);
return toInt(insertParams.get("category_id"));
}
private int ensureScreenRootCategory() {
Map<String, Object> existing = sqlSession.selectOne(NS + "get_multilang_root_category_by_code", Map.of("category_code", "screen"));
Map<String, Object> existing = sqlSession.selectOne(NS + "getMultilangRootCategoryByCode", Map.of("category_code", "screen"));
if (existing != null) return toInt(existing.get("category_id"));
Map<String, Object> insertParams = new HashMap<>();
insertParams.put("category_code", "screen");
@@ -440,7 +440,7 @@ public class MultilangService extends BaseService {
insertParams.put("key_prefix", "screen");
insertParams.put("description", "화면 디자이너에서 자동 생성된 다국어 키");
insertParams.put("sort_order", 100);
sqlSession.insert(NS + "insert_multilang_category", insertParams);
sqlSession.insert(NS + "insertMultilangCategory", insertParams);
return toInt(insertParams.get("category_id"));
}
@@ -30,7 +30,7 @@ public class NumberingRuleService extends BaseService {
public List<Map<String, Object>> getRuleList(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "get_rule_list", params);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "getRuleList", params);
loadPartsForRules(rules, companyCode);
return rules;
}
@@ -40,7 +40,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
Map<String, Object> rule = sqlSession.selectOne(NS + "get_rule_by_id", params);
Map<String, Object> rule = sqlSession.selectOne(NS + "getRuleById", params);
if (rule == null) return null;
loadPartsForRule(rule, companyCode);
return rule;
@@ -63,7 +63,7 @@ public class NumberingRuleService extends BaseService {
params.put("category_value_id", body.get("category_value_id"));
params.put("created_by", body.get("user_id"));
sqlSession.insert(NS + "insert_rule", params);
sqlSession.insert(NS + "insertRule", params);
// parts 삽입
Object partsObj = body.get("parts");
@@ -82,7 +82,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> params = new HashMap<>(body);
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
int updated = sqlSession.update(NS + "update_rule", params);
int updated = sqlSession.update(NS + "updateRule", params);
if (updated == 0) throw new RuntimeException("규칙을 찾을 수 없거나 권한이 없습니다");
// parts 교체 (있는 경우)
@@ -91,7 +91,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> delParams = new HashMap<>();
delParams.put("rule_id", ruleId);
delParams.put("company_code", companyCode);
sqlSession.delete(NS + "delete_rule_parts_by_rule_id", delParams);
sqlSession.delete(NS + "deleteRulePartsByRuleId", delParams);
@SuppressWarnings("unchecked")
List<Map<String, Object>> parts = (List<Map<String, Object>>) partsObj;
@@ -108,9 +108,9 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
sqlSession.delete(NS + "delete_rule_parts_by_rule_id", params);
sqlSession.delete(NS + "delete_sequences_by_rule_id", params);
int deleted = sqlSession.delete(NS + "delete_rule", params);
sqlSession.delete(NS + "deleteRulePartsByRuleId", params);
sqlSession.delete(NS + "deleteSequencesByRuleId", params);
int deleted = sqlSession.delete(NS + "deleteRule", params);
if (deleted == 0) throw new RuntimeException("규칙을 찾을 수 없거나 권한이 없습니다");
}
@@ -172,7 +172,7 @@ public class NumberingRuleService extends BaseService {
seqParams.put("rule_id", ruleId);
seqParams.put("company_code", companyCode);
seqParams.put("current_sequence", allocatedSequence);
sqlSession.update(NS + "update_current_sequence_in_rule", seqParams);
sqlSession.update(NS + "updateCurrentSequenceInRule", seqParams);
}
// 수동 파트 적용
@@ -196,8 +196,8 @@ public class NumberingRuleService extends BaseService {
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
params.put("current_sequence", 0);
sqlSession.delete(NS + "delete_sequences_by_rule_id", params);
sqlSession.update(NS + "update_current_sequence_in_rule", params);
sqlSession.delete(NS + "deleteSequencesByRuleId", params);
sqlSession.update(NS + "updateCurrentSequenceInRule", params);
log.info("시퀀스 초기화 완료: ruleId={}, companyCode={}", ruleId, companyCode);
}
@@ -206,11 +206,11 @@ public class NumberingRuleService extends BaseService {
// ================================================================
/** GET /available/:menuObjid? → 메뉴별 사용 가능한 규칙 목록 */
public List<Map<String, Object>> getAvailableRulesForMenu(String companyCode, Integer menuObjid) {
public List<Map<String, Object>> getAvailableRulesForMenu(String companyCode, String menuObjid) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
if (menuObjid != null) params.put("menu_objid", menuObjid);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "get_available_rules_for_menu", params);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "getAvailableRulesForMenu", params);
loadPartsForRules(rules, companyCode);
return rules;
}
@@ -220,7 +220,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
params.put("table_name", tableName);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "get_available_rules_for_screen", params);
List<Map<String, Object>> rules = sqlSession.selectList(NS + "getAvailableRulesForScreen", params);
loadPartsForRules(rules, companyCode);
return rules;
}
@@ -238,18 +238,18 @@ public class NumberingRuleService extends BaseService {
params.put("table_name", tableName);
params.put("column_name", columnName);
Map<String, Object> rule = sqlSession.selectOne(NS + "get_rule_by_column", params);
Map<String, Object> rule = sqlSession.selectOne(NS + "getRuleByColumn", params);
// fallback: column_name이 비어있는 레거시 규칙
if (rule == null) {
rule = sqlSession.selectOne(NS + "get_rule_by_column_fallback", params);
rule = sqlSession.selectOne(NS + "getRuleByColumnFallback", params);
if (rule != null) {
// column_name 자동 업데이트 (레거시 마이그레이션)
Map<String, Object> upParams = new HashMap<>();
upParams.put("rule_id", rule.get("rule_id"));
upParams.put("company_code", companyCode);
upParams.put("column_name", columnName);
sqlSession.update(NS + "update_rule_column_name", upParams);
sqlSession.update(NS + "updateRuleColumnName", upParams);
rule.put("column_name", columnName);
}
}
@@ -265,7 +265,7 @@ public class NumberingRuleService extends BaseService {
// ================================================================
/** GET /test/list/:menuObjid? → 테스트용 규칙 목록 */
public List<Map<String, Object>> getRulesFromTest(String companyCode, Integer menuObjid) {
public List<Map<String, Object>> getRulesFromTest(String companyCode, String menuObjid) {
return getAvailableRulesForMenu(companyCode, menuObjid);
}
@@ -277,17 +277,17 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> lookupParams = new HashMap<>();
lookupParams.put("rule_id", ruleId);
lookupParams.put("company_code", companyCode);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_rule_by_id", lookupParams);
Map<String, Object> existing = sqlSession.selectOne(NS + "getRuleById", lookupParams);
if (existing != null) {
// 업데이트
Map<String, Object> upParams = new HashMap<>(body);
upParams.put("rule_id", ruleId);
upParams.put("company_code", companyCode);
sqlSession.update(NS + "update_rule", upParams);
sqlSession.update(NS + "updateRule", upParams);
// parts 교체
sqlSession.delete(NS + "delete_rule_parts_by_rule_id", lookupParams);
sqlSession.delete(NS + "deleteRulePartsByRuleId", lookupParams);
} else {
// 신규 등록
createRule(body, companyCode);
@@ -320,7 +320,7 @@ public class NumberingRuleService extends BaseService {
String targetCompanyCode) {
Map<String, Object> srcParams = new HashMap<>();
srcParams.put("company_code", sourceCompanyCode);
List<Map<String, Object>> sourceRules = sqlSession.selectList(NS + "get_rules_for_copy", srcParams);
List<Map<String, Object>> sourceRules = sqlSession.selectList(NS + "getRulesForCopy", srcParams);
int copied = 0;
int skipped = 0;
@@ -332,7 +332,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> checkParams = new HashMap<>();
checkParams.put("rule_id", ruleId);
checkParams.put("company_code", targetCompanyCode);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_rule_by_id", checkParams);
Map<String, Object> existing = sqlSession.selectOne(NS + "getRuleById", checkParams);
if (existing != null) {
skipped++;
@@ -344,13 +344,13 @@ public class NumberingRuleService extends BaseService {
insertParams.put("company_code", targetCompanyCode);
insertParams.put("current_sequence", 0);
insertParams.put("created_by", "system");
sqlSession.insert(NS + "insert_rule", insertParams);
sqlSession.insert(NS + "insertRule", insertParams);
// parts 복사
Map<String, Object> partsParams = new HashMap<>();
partsParams.put("rule_id", ruleId);
partsParams.put("company_code", sourceCompanyCode);
List<Map<String, Object>> parts = sqlSession.selectList(NS + "get_rule_parts_for_copy", partsParams);
List<Map<String, Object>> parts = sqlSession.selectList(NS + "getRulePartsForCopy", partsParams);
insertParts(parts, ruleId, targetCompanyCode);
copied++;
@@ -382,7 +382,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> manualConfig = parseAutoConfig(part.get("manual_config"));
partParams.put("manual_config", toJsonString(manualConfig));
sqlSession.insert(NS + "insert_rule_part", partParams);
sqlSession.insert(NS + "insertRulePart", partParams);
}
}
@@ -397,7 +397,7 @@ public class NumberingRuleService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
List<Map<String, Object>> parts = sqlSession.selectList(NS + "get_rule_parts_by_rule_id", params);
List<Map<String, Object>> parts = sqlSession.selectList(NS + "getRulePartsByRuleId", params);
// autoConfig에서 separatorAfter 추출
for (Map<String, Object> part : parts) {
Map<String, Object> ac = parseAutoConfig(part.get("auto_config"));
@@ -420,7 +420,7 @@ public class NumberingRuleService extends BaseService {
params.put("rule_id", ruleId);
params.put("company_code", companyCode);
params.put("prefix_key", prefixKey);
Map<String, Object> row = sqlSession.selectOne(NS + "get_sequence_for_prefix", params);
Map<String, Object> row = sqlSession.selectOne(NS + "getSequenceForPrefix", params);
if (row == null) return 0L;
Object seq = row.get("current_sequence");
return seq == null ? 0L : ((Number) seq).longValue();
@@ -22,28 +22,28 @@ public class PackagingService extends BaseService {
public List<Map<String, Object>> getPkgUnits(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_pkg_units", params);
return sqlSession.selectList(NS + "getPkgUnits", params);
}
@Transactional
public Map<String, Object> createPkgUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_pkg_unit", params);
sqlSession.insert(NS + "insertPkgUnit", params);
return params;
}
@Transactional
public Map<String, Object> updatePkgUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_pkg_unit", params);
sqlSession.update(NS + "updatePkgUnit", params);
return params;
}
@Transactional
public Map<String, Object> deletePkgUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_pkg_unit_items_by_unit_id", params);
sqlSession.delete(NS + "delete_pkg_unit", params);
sqlSession.delete(NS + "deletePkgUnitItemsByUnitId", params);
sqlSession.delete(NS + "deletePkgUnit", params);
return params;
}
@@ -51,20 +51,20 @@ public class PackagingService extends BaseService {
public List<Map<String, Object>> getPkgUnitItems(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_pkg_unit_items", params);
return sqlSession.selectList(NS + "getPkgUnitItems", params);
}
@Transactional
public Map<String, Object> createPkgUnitItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_pkg_unit_item", params);
sqlSession.insert(NS + "insertPkgUnitItem", params);
return params;
}
@Transactional
public Map<String, Object> deletePkgUnitItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_pkg_unit_item", params);
sqlSession.delete(NS + "deletePkgUnitItem", params);
return params;
}
@@ -72,28 +72,28 @@ public class PackagingService extends BaseService {
public List<Map<String, Object>> getLoadingUnits(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_loading_units", params);
return sqlSession.selectList(NS + "getLoadingUnits", params);
}
@Transactional
public Map<String, Object> createLoadingUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_loading_unit", params);
sqlSession.insert(NS + "insertLoadingUnit", params);
return params;
}
@Transactional
public Map<String, Object> updateLoadingUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_loading_unit", params);
sqlSession.update(NS + "updateLoadingUnit", params);
return params;
}
@Transactional
public Map<String, Object> deleteLoadingUnit(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_loading_unit_pkgs_by_unit_id", params);
sqlSession.delete(NS + "delete_loading_unit", params);
sqlSession.delete(NS + "deleteLoadingUnitPkgsByUnitId", params);
sqlSession.delete(NS + "deleteLoadingUnit", params);
return params;
}
@@ -101,20 +101,20 @@ public class PackagingService extends BaseService {
public List<Map<String, Object>> getLoadingUnitPkgs(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_loading_unit_pkgs", params);
return sqlSession.selectList(NS + "getLoadingUnitPkgs", params);
}
@Transactional
public Map<String, Object> createLoadingUnitPkg(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_loading_unit_pkg", params);
sqlSession.insert(NS + "insertLoadingUnitPkg", params);
return params;
}
@Transactional
public Map<String, Object> deleteLoadingUnitPkg(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_loading_unit_pkg", params);
sqlSession.delete(NS + "deleteLoadingUnitPkg", params);
return params;
}
}
@@ -19,80 +19,80 @@ public class ProcessWorkStandardService extends BaseService {
public Map<String, Object> getProcessWorkStandardItemList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
Integer totalObj = sqlSession.selectOne(NS + "get_process_work_standard_item_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getProcessWorkStandardItemListCnt", params);
int totalCount = totalObj != null ? totalObj : 0;
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_process_work_standard_item_list", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getProcessWorkStandardItemList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public List<Map<String, Object>> getProcessWorkStandardRoutingList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_process_work_standard_routing_list", params);
return sqlSession.selectList(NS + "getProcessWorkStandardRoutingList", params);
}
@Transactional
public Map<String, Object> setProcessWorkStandardDefaultVersion(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "set_process_work_standard_default_version", params);
sqlSession.update(NS + "setProcessWorkStandardDefaultVersion", params);
return params;
}
@Transactional
public Map<String, Object> unsetProcessWorkStandardDefaultVersion(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "unset_process_work_standard_default_version", params);
sqlSession.update(NS + "unsetProcessWorkStandardDefaultVersion", params);
return params;
}
public List<Map<String, Object>> getProcessWorkStandardWorkItemList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_process_work_standard_work_item_list", params);
return sqlSession.selectList(NS + "getProcessWorkStandardWorkItemList", params);
}
@Transactional
public Map<String, Object> insertProcessWorkStandardWorkItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_process_work_standard_work_item", params);
sqlSession.insert(NS + "insertProcessWorkStandardWorkItem", params);
return params;
}
@Transactional
public Map<String, Object> updateProcessWorkStandardWorkItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_process_work_standard_work_item", params);
sqlSession.update(NS + "updateProcessWorkStandardWorkItem", params);
return params;
}
@Transactional
public Map<String, Object> deleteProcessWorkStandardWorkItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_process_work_standard_work_item", params);
sqlSession.delete(NS + "deleteProcessWorkStandardWorkItem", params);
return params;
}
public List<Map<String, Object>> getProcessWorkStandardWorkItemDetailList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_process_work_standard_work_item_detail_list", params);
return sqlSession.selectList(NS + "getProcessWorkStandardWorkItemDetailList", params);
}
@Transactional
public Map<String, Object> insertProcessWorkStandardWorkItemDetail(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_process_work_standard_work_item_detail", params);
sqlSession.insert(NS + "insertProcessWorkStandardWorkItemDetail", params);
return params;
}
@Transactional
public Map<String, Object> updateProcessWorkStandardWorkItemDetail(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.update(NS + "update_process_work_standard_work_item_detail", params);
sqlSession.update(NS + "updateProcessWorkStandardWorkItemDetail", params);
return params;
}
@Transactional
public Map<String, Object> deleteProcessWorkStandardWorkItemDetail(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_process_work_standard_work_item_detail", params);
sqlSession.delete(NS + "deleteProcessWorkStandardWorkItemDetail", params);
return params;
}
@@ -105,9 +105,9 @@ public class ProcessWorkStandardService extends BaseService {
for (Map<String, Object> workItem : workItems) {
workItem.put("company_code", params.get("company_code"));
if (workItem.get("id") != null) {
sqlSession.update(NS + "update_process_work_standard_work_item", workItem);
sqlSession.update(NS + "updateProcessWorkStandardWorkItem", workItem);
} else {
sqlSession.insert(NS + "insert_process_work_standard_work_item", workItem);
sqlSession.insert(NS + "insertProcessWorkStandardWorkItem", workItem);
}
List<Map<String, Object>> details = (List<Map<String, Object>>) workItem.get("details");
if (details != null) {
@@ -115,9 +115,9 @@ public class ProcessWorkStandardService extends BaseService {
detail.put("company_code", params.get("company_code"));
detail.put("work_item_id", workItem.get("id"));
if (detail.get("id") != null) {
sqlSession.update(NS + "update_process_work_standard_work_item_detail", detail);
sqlSession.update(NS + "updateProcessWorkStandardWorkItemDetail", detail);
} else {
sqlSession.insert(NS + "insert_process_work_standard_work_item_detail", detail);
sqlSession.insert(NS + "insertProcessWorkStandardWorkItemDetail", detail);
}
}
}
@@ -128,13 +128,13 @@ public class ProcessWorkStandardService extends BaseService {
public List<Map<String, Object>> getProcessWorkStandardRegisteredItemList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_process_work_standard_registered_item_list", params);
return sqlSession.selectList(NS + "getProcessWorkStandardRegisteredItemList", params);
}
@Transactional
public Map<String, Object> insertProcessWorkStandardRegisteredItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.insert(NS + "insert_process_work_standard_registered_item", params);
sqlSession.insert(NS + "insertProcessWorkStandardRegisteredItem", params);
return params;
}
@@ -148,14 +148,14 @@ public class ProcessWorkStandardService extends BaseService {
item.put("company_code", params.get("company_code"));
}
}
sqlSession.insert(NS + "insert_process_work_standard_registered_item_batch", params);
sqlSession.insert(NS + "insertProcessWorkStandardRegisteredItemBatch", params);
return params;
}
@Transactional
public Map<String, Object> deleteProcessWorkStandardRegisteredItem(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
sqlSession.delete(NS + "delete_process_work_standard_registered_item", params);
sqlSession.delete(NS + "deleteProcessWorkStandardRegisteredItem", params);
return params;
}
}
@@ -50,10 +50,6 @@ public class RoleService extends BaseService {
memberParams.put("master_objid", objid);
sqlSession.delete("role.deleteAllRoleMembers", memberParams);
Map<String, Object> menuParams = new HashMap<>();
menuParams.put("auth_objid", objid);
sqlSession.delete("role.deleteMenuPermissions", menuParams);
sqlSession.delete("role.deleteRoleGroup", params);
log.info("권한 그룹 삭제 완료: objid={}", objid);
}
@@ -23,8 +23,8 @@ public class SalesReportService extends BaseService {
public Map<String, Object> getSalesReportList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_sales_report_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_sales_report_list", params);
int totalCount = sqlSession.selectOne(NS + "getSalesReportListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getSalesReportList", params);
for (Map<String, Object> row : list) {
row.put("unit_price", DecimalUtils.toBigDecimal(row.get("unit_price")));
row.put("order_amt", DecimalUtils.toBigDecimal(row.get("order_amt")));
@@ -36,7 +36,7 @@ public class SalesReportService extends BaseService {
public Map<String, Object> getSalesReportSummary(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> summary = sqlSession.selectOne(NS + "get_sales_report_summary", params);
Map<String, Object> summary = sqlSession.selectOne(NS + "getSalesReportSummary", params);
if (summary != null) {
summary.put("total_amount", DecimalUtils.toBigDecimal(summary.get("total_amount")));
summary.put("avg_unit_price", DecimalUtils.toBigDecimal(summary.get("avg_unit_price")));
@@ -48,15 +48,15 @@ public class SalesReportService extends BaseService {
public Map<String, Object> getSalesReportData(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_sales_report_data_rows", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getSalesReportDataRows", params);
for (Map<String, Object> row : rows) {
row.put("unit_price", DecimalUtils.toBigDecimal(row.get("unit_price")));
row.put("order_amt", DecimalUtils.toBigDecimal(row.get("order_amt")));
row.put("order_qty", DecimalUtils.toBigDecimal(row.get("order_qty")));
row.put("ship_qty", DecimalUtils.toBigDecimal(row.get("ship_qty")));
}
List<Map<String, Object>> customers = sqlSession.selectList(NS + "get_sales_report_customers", params);
List<Map<String, Object>> statuses = sqlSession.selectList(NS + "get_sales_report_statuses", params);
List<Map<String, Object>> customers = sqlSession.selectList(NS + "getSalesReportCustomers", params);
List<Map<String, Object>> statuses = sqlSession.selectList(NS + "getSalesReportStatuses", params);
// 데이터에서 품목 목록 추출 (중복 제거)
Map<String, String> itemSet = new LinkedHashMap<>();
@@ -21,12 +21,12 @@ public class ScheduleService extends BaseService {
public List<Map<String, Object>> getScheduleList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectList(NS + "get_schedule_list", params);
return sqlSession.selectList(NS + "getScheduleList", params);
}
public Map<String, Object> getScheduleInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.selectOne(NS + "get_schedule_info", params);
return sqlSession.selectOne(NS + "getScheduleInfo", params);
}
/**
@@ -150,7 +150,7 @@ public class ScheduleService extends BaseService {
existParams.put("period_start", period.get("start"));
existParams.put("period_end", period.get("end"));
try {
toDelete = sqlSession.selectList(NS + "get_existing_schedule_list", existParams);
toDelete = sqlSession.selectList(NS + "getExistingScheduleList", existParams);
} catch (Exception e) {
log.warn("기존 스케줄 조회 실패: {}", e.getMessage());
}
@@ -201,7 +201,7 @@ public class ScheduleService extends BaseService {
Map<String, Object> deleteParams = new HashMap<>();
deleteParams.put("company_code", companyCode);
deleteParams.put("id_list", deleteIds);
sqlSession.delete(NS + "delete_schedules_by_id_list", deleteParams);
sqlSession.delete(NS + "deleteSchedulesByIdList", deleteParams);
deleted = deleteIds.size();
}
}
@@ -213,7 +213,7 @@ public class ScheduleService extends BaseService {
insertParams.put("generated_by", userId);
insertParams.put("created_by", userId);
insertParams.put("updated_by", userId);
sqlSession.insert(NS + "insert_schedule", insertParams);
sqlSession.insert(NS + "insertSchedule", insertParams);
created++;
}
@@ -226,19 +226,19 @@ public class ScheduleService extends BaseService {
@Transactional
public int insertSchedule(Map<String, Object> params) {
return sqlSession.insert(NS + "insert_schedule", params);
return sqlSession.insert(NS + "insertSchedule", params);
}
@Transactional
public int updateSchedule(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
return sqlSession.update(NS + "update_schedule", params);
return sqlSession.update(NS + "updateSchedule", params);
}
@Transactional
public Map<String, Object> deleteSchedule(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
int affected = sqlSession.delete(NS + "delete_schedule", params);
int affected = sqlSession.delete(NS + "deleteSchedule", params);
if (affected == 0) {
Map<String, Object> result = new HashMap<>();
result.put("success", false);
@@ -251,7 +251,7 @@ public class ScheduleService extends BaseService {
historyParams.put("schedule_id", params.get("schedule_id"));
historyParams.put("action", "DELETE");
historyParams.put("changed_by", params.getOrDefault("user_id", "system"));
sqlSession.insert(NS + "insert_schedule_history", historyParams);
sqlSession.insert(NS + "insertScheduleHistory", historyParams);
} catch (Exception e) {
log.warn("스케줄 이력 저장 실패 (무시): {}", e.getMessage());
}
@@ -26,8 +26,8 @@ public class ScreenGroupService extends BaseService {
params.put("limit", size);
params.put("offset", (page - 1) * size);
int total = sqlSession.selectOne(NS + "count_screen_groups", params);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "select_screen_groups", params);
int total = sqlSession.selectOne(NS + "countScreenGroups", params);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "selectScreenGroups", params);
// screens 조립 (별도 쿼리)
if (!groups.isEmpty()) {
@@ -36,7 +36,7 @@ public class ScreenGroupService extends BaseService {
.collect(Collectors.toList());
Map<String, Object> screenParams = new HashMap<>();
screenParams.put("group_ids", groupIds);
List<Map<String, Object>> allScreens = sqlSession.selectList(NS + "select_group_screens_by_group_ids", screenParams);
List<Map<String, Object>> allScreens = sqlSession.selectList(NS + "selectGroupScreensByGroupIds", screenParams);
Map<Object, List<Map<String, Object>>> byGroup = allScreens.stream()
.collect(Collectors.groupingBy(s -> s.get("group_id")));
for (Map<String, Object> g : groups) {
@@ -55,13 +55,13 @@ public class ScreenGroupService extends BaseService {
}
public Map<String, Object> getScreenGroup(Map<String, Object> params) {
Map<String, Object> group = sqlSession.selectOne(NS + "select_screen_group_by_id", params);
Map<String, Object> group = sqlSession.selectOne(NS + "selectScreenGroupById", params);
if (group == null) return null;
List<Object> groupIds = Collections.singletonList(group.get("id"));
Map<String, Object> sp = new HashMap<>();
sp.put("group_ids", groupIds);
List<Map<String, Object>> screens = sqlSession.selectList(NS + "select_group_screens_by_group_ids", sp);
List<Map<String, Object>> screens = sqlSession.selectList(NS + "selectGroupScreensByGroupIds", sp);
group.put("screens", screens);
return group;
}
@@ -75,7 +75,7 @@ public class ScreenGroupService extends BaseService {
if (parentGroupId != null) {
Map<String, Object> pp = new HashMap<>();
pp.put("parent_group_id", parentGroupId);
Map<String, Object> parent = sqlSession.selectOne(NS + "select_parent_group_by_id", pp);
Map<String, Object> parent = sqlSession.selectOne(NS + "selectParentGroupById", pp);
if (parent != null) {
groupLevel = toInt(parent.getOrDefault("group_level", 0)) + 1;
parentHierarchyPath = (String) parent.getOrDefault("hierarchy_path",
@@ -84,7 +84,7 @@ public class ScreenGroupService extends BaseService {
}
params.put("group_level", groupLevel);
sqlSession.insert(NS + "insert_screen_group", params);
sqlSession.insert(NS + "insertScreenGroup", params);
Object newId = params.get("id");
// hierarchy_path 업데이트
@@ -97,11 +97,11 @@ public class ScreenGroupService extends BaseService {
Map<String, Object> hp = new HashMap<>();
hp.put("id", newId);
hp.put("hierarchy_path", hierarchyPath);
sqlSession.update(NS + "update_screen_group_hierarchy_path", hp);
sqlSession.update(NS + "updateScreenGroupHierarchyPath", hp);
Map<String, Object> sp = new HashMap<>();
sp.put("id", newId);
return sqlSession.selectOne(NS + "select_screen_group_by_id", sp);
return sqlSession.selectOne(NS + "selectScreenGroupById", sp);
}
@Transactional
@@ -121,7 +121,7 @@ public class ScreenGroupService extends BaseService {
if (parentGroupId != null) {
Map<String, Object> pp = new HashMap<>();
pp.put("parent_group_id", parentGroupId);
Map<String, Object> parent = sqlSession.selectOne(NS + "select_parent_group_by_id", pp);
Map<String, Object> parent = sqlSession.selectOne(NS + "selectParentGroupById", pp);
if (parent != null) {
String parentPath = (String) parent.getOrDefault("hierarchy_path",
"/" + parentGroupId + "/");
@@ -140,16 +140,16 @@ public class ScreenGroupService extends BaseService {
Object targetCompanyCode = params.get("target_company_code");
int rows;
if ("*".equals(userCompanyCode) && targetCompanyCode != null) {
rows = sqlSession.update(NS + "update_screen_group_with_company", params);
rows = sqlSession.update(NS + "updateScreenGroupWithCompany", params);
} else {
rows = sqlSession.update(NS + "update_screen_group", params);
rows = sqlSession.update(NS + "updateScreenGroup", params);
}
if (rows == 0) {
throw new NoSuchElementException("화면 그룹을 찾을 수 없거나 권한이 없습니다.");
}
Map<String, Object> sp = new HashMap<>();
sp.put("id", id);
return sqlSession.selectOne(NS + "select_screen_group_by_id", sp);
return sqlSession.selectOne(NS + "selectScreenGroupById", sp);
}
@Transactional
@@ -159,7 +159,7 @@ public class ScreenGroupService extends BaseService {
boolean deleteNumberingRules = Boolean.TRUE.equals(params.get("delete_numbering_rules"));
// 대상 그룹의 company_code 확인
Map<String, Object> target = sqlSession.selectOne(NS + "select_screen_group_for_delete", params);
Map<String, Object> target = sqlSession.selectOne(NS + "selectScreenGroupForDelete", params);
if (target == null) {
throw new NoSuchElementException("화면 그룹을 찾을 수 없습니다.");
}
@@ -174,7 +174,7 @@ public class ScreenGroupService extends BaseService {
Map<String, Object> cp = new HashMap<>();
cp.put("id", id);
cp.put("target_company_code", targetCompanyCode);
List<Map<String, Object>> children = sqlSession.selectList(NS + "select_all_child_group_ids", cp);
List<Map<String, Object>> children = sqlSession.selectList(NS + "selectAllChildGroupIds", cp);
List<Object> groupIds = children.stream().map(c -> c.get("id")).collect(Collectors.toList());
if (!groupIds.isEmpty()) {
@@ -182,33 +182,33 @@ public class ScreenGroupService extends BaseService {
Map<String, Object> mp = new HashMap<>();
mp.put("group_ids", groupIds);
mp.put("target_company_code", targetCompanyCode);
List<Map<String, Object>> menus = sqlSession.selectList(NS + "select_menus_by_group_ids", mp);
List<Map<String, Object>> menus = sqlSession.selectList(NS + "selectMenusByGroupIds", mp);
List<Object> menuObjids = menus.stream().map(m -> m.get("objid")).collect(Collectors.toList());
if (!menuObjids.isEmpty()) {
Map<String, Object> delp = new HashMap<>();
delp.put("menu_objids", menuObjids);
delp.put("target_company_code", targetCompanyCode);
sqlSession.delete(NS + "delete_screen_menu_assignments_by_menu_objids", delp);
sqlSession.delete(NS + "delete_menus_by_group_ids", mp);
sqlSession.delete(NS + "deleteScreenMenuAssignmentsByMenuObjids", delp);
sqlSession.delete(NS + "deleteMenusByGroupIds", mp);
}
// 채번 규칙 삭제 (최상위 그룹 + 명시 요청)
if (deleteNumberingRules) {
Map<String, Object> rp = new HashMap<>();
rp.put("id", id);
int isRoot = sqlSession.selectOne(NS + "is_root_group_by_id", rp);
int isRoot = sqlSession.selectOne(NS + "isRootGroupById", rp);
if (isRoot > 0) {
Map<String, Object> nrp = new HashMap<>();
nrp.put("target_company_code", targetCompanyCode);
sqlSession.delete(NS + "delete_numbering_rule_parts", nrp);
sqlSession.delete(NS + "delete_numbering_rules", nrp);
sqlSession.delete(NS + "deleteNumberingRuleParts", nrp);
sqlSession.delete(NS + "deleteNumberingRules", nrp);
}
}
}
// 그룹 삭제
int deleted = sqlSession.delete(NS + "delete_screen_group_by_id", cp);
int deleted = sqlSession.delete(NS + "deleteScreenGroupById", cp);
if (deleted == 0) {
throw new NoSuchElementException("화면 그룹을 찾을 수 없거나 권한이 없습니다.");
}
@@ -220,12 +220,12 @@ public class ScreenGroupService extends BaseService {
@Transactional
public Map<String, Object> addScreenToGroup(Map<String, Object> params) {
sqlSession.insert(NS + "insert_group_screen", params);
sqlSession.insert(NS + "insertGroupScreen", params);
// 삽입 조회
List<Object> ids = Collections.singletonList(params.get("group_id"));
Map<String, Object> sp = new HashMap<>();
sp.put("group_ids", ids);
List<Map<String, Object>> screens = sqlSession.selectList(NS + "select_group_screens_by_group_ids", sp);
List<Map<String, Object>> screens = sqlSession.selectList(NS + "selectGroupScreensByGroupIds", sp);
return screens.stream()
.filter(s -> Objects.equals(s.get("screen_id"), params.get("screen_id")))
.findFirst()
@@ -234,14 +234,14 @@ public class ScreenGroupService extends BaseService {
@Transactional
public Map<String, Object> updateScreenInGroup(Map<String, Object> params) {
int rows = sqlSession.update(NS + "update_group_screen", params);
int rows = sqlSession.update(NS + "updateGroupScreen", params);
if (rows == 0) throw new NoSuchElementException("연결을 찾을 수 없거나 권한이 없습니다.");
return params;
}
@Transactional
public void removeScreenFromGroup(Map<String, Object> params) {
int rows = sqlSession.delete(NS + "delete_group_screen", params);
int rows = sqlSession.delete(NS + "deleteGroupScreen", params);
if (rows == 0) throw new NoSuchElementException("연결을 찾을 수 없거나 권한이 없습니다.");
}
@@ -250,25 +250,25 @@ public class ScreenGroupService extends BaseService {
//
public List<Map<String, Object>> getFieldJoins(Map<String, Object> params) {
return sqlSession.selectList(NS + "select_field_joins", params);
return sqlSession.selectList(NS + "selectFieldJoins", params);
}
@Transactional
public Map<String, Object> createFieldJoin(Map<String, Object> params) {
sqlSession.insert(NS + "insert_field_join", params);
sqlSession.insert(NS + "insertFieldJoin", params);
return params;
}
@Transactional
public Map<String, Object> updateFieldJoin(Map<String, Object> params) {
int rows = sqlSession.update(NS + "update_field_join", params);
int rows = sqlSession.update(NS + "updateFieldJoin", params);
if (rows == 0) throw new NoSuchElementException("필드 조인을 찾을 수 없거나 권한이 없습니다.");
return params;
}
@Transactional
public void deleteFieldJoin(Map<String, Object> params) {
int rows = sqlSession.delete(NS + "delete_field_join", params);
int rows = sqlSession.delete(NS + "deleteFieldJoin", params);
if (rows == 0) throw new NoSuchElementException("필드 조인을 찾을 수 없거나 권한이 없습니다.");
}
@@ -277,28 +277,28 @@ public class ScreenGroupService extends BaseService {
//
public List<Map<String, Object>> getDataFlows(Map<String, Object> params) {
return sqlSession.selectList(NS + "select_data_flows", params);
return sqlSession.selectList(NS + "selectDataFlows", params);
}
@Transactional
public Map<String, Object> createDataFlow(Map<String, Object> params) {
// data_mapping을 JSON 문자열로 변환
convertToJsonString(params, "data_mapping");
sqlSession.insert(NS + "insert_data_flow", params);
sqlSession.insert(NS + "insertDataFlow", params);
return params;
}
@Transactional
public Map<String, Object> updateDataFlow(Map<String, Object> params) {
convertToJsonString(params, "data_mapping");
int rows = sqlSession.update(NS + "update_data_flow", params);
int rows = sqlSession.update(NS + "updateDataFlow", params);
if (rows == 0) throw new NoSuchElementException("데이터 흐름을 찾을 수 없거나 권한이 없습니다.");
return params;
}
@Transactional
public void deleteDataFlow(Map<String, Object> params) {
int rows = sqlSession.delete(NS + "delete_data_flow", params);
int rows = sqlSession.delete(NS + "deleteDataFlow", params);
if (rows == 0) throw new NoSuchElementException("데이터 흐름을 찾을 수 없거나 권한이 없습니다.");
}
@@ -307,25 +307,25 @@ public class ScreenGroupService extends BaseService {
//
public List<Map<String, Object>> getTableRelations(Map<String, Object> params) {
return sqlSession.selectList(NS + "select_table_relations", params);
return sqlSession.selectList(NS + "selectTableRelations", params);
}
@Transactional
public Map<String, Object> createTableRelation(Map<String, Object> params) {
sqlSession.insert(NS + "insert_table_relation", params);
sqlSession.insert(NS + "insertTableRelation", params);
return params;
}
@Transactional
public Map<String, Object> updateTableRelation(Map<String, Object> params) {
int rows = sqlSession.update(NS + "update_table_relation", params);
int rows = sqlSession.update(NS + "updateTableRelation", params);
if (rows == 0) throw new NoSuchElementException("화면-테이블 관계를 찾을 수 없거나 권한이 없습니다.");
return params;
}
@Transactional
public void deleteTableRelation(Map<String, Object> params) {
int rows = sqlSession.delete(NS + "delete_table_relation", params);
int rows = sqlSession.delete(NS + "deleteTableRelation", params);
if (rows == 0) throw new NoSuchElementException("화면-테이블 관계를 찾을 수 없거나 권한이 없습니다.");
}
@@ -334,7 +334,7 @@ public class ScreenGroupService extends BaseService {
//
public Map<String, Object> getScreenLayoutSummary(Map<String, Object> params) {
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_layout_components", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectLayoutComponents", params);
Map<String, Integer> widgetCounts = new LinkedHashMap<>();
List<String> labels = new ArrayList<>();
@@ -380,7 +380,7 @@ public class ScreenGroupService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_ids", screenIds);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "select_multiple_layout_components", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "selectMultipleLayoutComponents", params);
// 화면별 summary 초기화
Map<Integer, Map<String, Object>> summaryMap = new LinkedHashMap<>();
@@ -462,7 +462,7 @@ public class ScreenGroupService extends BaseService {
p.put("screen_ids", screenIds);
// 1. 컴포넌트 config 기반 서브 테이블 수집
List<Map<String, Object>> compRows = sqlSession.selectList(NS + "select_sub_table_component_configs", p);
List<Map<String, Object>> compRows = sqlSession.selectList(NS + "selectSubTableComponentConfigs", p);
// column label lookup 수집
List<Map<String, Object>> columnPairs = new ArrayList<>();
@@ -489,7 +489,7 @@ public class ScreenGroupService extends BaseService {
if (!columnPairs.isEmpty()) {
Map<String, Object> lp = new HashMap<>();
lp.put("pairs", columnPairs);
sqlSession.<Map<String, Object>>selectList(NS + "select_column_labels_by_pairs", lp)
sqlSession.<Map<String, Object>>selectList(NS + "selectColumnLabelsByPairs", lp)
.forEach(r -> colLabelMap.put(r.get("table_name") + "." + r.get("column_name"),
(String) r.get("column_label")));
}
@@ -523,7 +523,7 @@ public class ScreenGroupService extends BaseService {
});
// 2. reference_table 기반 참조 서브 테이블
sqlSession.<Map<String, Object>>selectList(NS + "select_reference_columns", p).forEach(row -> {
sqlSession.<Map<String, Object>>selectList(NS + "selectReferenceColumns", p).forEach(row -> {
int sid = toInt(row.get("screen_id"));
String mainTable = (String) row.get("main_table");
String refTable = (String) row.get("reference_table");
@@ -562,7 +562,7 @@ public class ScreenGroupService extends BaseService {
});
// 3. parentDataMapping
sqlSession.<Map<String, Object>>selectList(NS + "select_parent_data_mapping_configs", p).forEach(row -> {
sqlSession.<Map<String, Object>>selectList(NS + "selectParentDataMappingConfigs", p).forEach(row -> {
int sid = toInt(row.get("screen_id"));
String mainTable = (String) row.get("main_table");
String compType = (String) row.get("component_type");
@@ -611,7 +611,7 @@ public class ScreenGroupService extends BaseService {
});
// 4. rightPanel.relation
List<Map<String, Object>> rpRows = sqlSession.selectList(NS + "select_right_panel_relations", p);
List<Map<String, Object>> rpRows = sqlSession.selectList(NS + "selectRightPanelRelations", p);
// rightPanel columns에서 dot-notation 참조 테이블 수집
Map<String, Set<String>> rpJoinedTables = new HashMap<>();
rpRows.forEach(row -> {
@@ -734,7 +734,7 @@ public class ScreenGroupService extends BaseService {
fkp.put("sub_table_names", new ArrayList<>(subTableNamesSet));
fkp.put("ref_table_names", new ArrayList<>(refTableNamesSet));
Map<String, List<Map<String, Object>>> joinColRefs = new HashMap<>();
sqlSession.<Map<String, Object>>selectList(NS + "select_fk_columns_for_joined_tables", fkp).forEach(row -> {
sqlSession.<Map<String, Object>>selectList(NS + "selectFkColumnsForJoinedTables", fkp).forEach(row -> {
String tbl = (String) row.get("table_name");
joinColRefs.computeIfAbsent(tbl, k -> new ArrayList<>());
String col = (String) row.get("column_name");
@@ -823,7 +823,7 @@ public class ScreenGroupService extends BaseService {
});
// 8. Save Tables
sqlSession.<Map<String, Object>>selectList(NS + "select_save_table_actions", p).forEach(row -> {
sqlSession.<Map<String, Object>>selectList(NS + "selectSaveTableActions", p).forEach(row -> {
int sid = toInt(row.get("screen_id"));
String mainTable = (String) row.get("main_table");
String actionType = (String) row.get("action_type");
@@ -853,7 +853,7 @@ public class ScreenGroupService extends BaseService {
});
// 9. 전역 메인 테이블 목록
List<String> globalMainTables = sqlSession.<Map<String, Object>>selectList(NS + "select_global_main_tables", p).stream()
List<String> globalMainTables = sqlSession.<Map<String, Object>>selectList(NS + "selectGlobalMainTables", p).stream()
.map(r -> (String) r.get("main_table"))
.filter(t -> t != null && !t.isEmpty())
.collect(Collectors.toList());
@@ -869,12 +869,12 @@ public class ScreenGroupService extends BaseService {
//
public List<Map<String, Object>> getPopScreenGroups(Map<String, Object> params) {
List<Map<String, Object>> groups = sqlSession.selectList(NS + "select_pop_screen_groups", params);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "selectPopScreenGroups", params);
if (!groups.isEmpty()) {
List<Object> groupIds = groups.stream().map(g -> g.get("id")).collect(Collectors.toList());
Map<String, Object> sp = new HashMap<>();
sp.put("group_ids", groupIds);
List<Map<String, Object>> allScreens = sqlSession.selectList(NS + "select_pop_group_screens", sp);
List<Map<String, Object>> allScreens = sqlSession.selectList(NS + "selectPopGroupScreens", sp);
Map<Object, List<Map<String, Object>>> byGroup = allScreens.stream()
.collect(Collectors.groupingBy(s -> s.get("group_id")));
groups.forEach(g -> g.put("screens", byGroup.getOrDefault(g.get("id"), Collections.emptyList())));
@@ -897,7 +897,7 @@ public class ScreenGroupService extends BaseService {
if (parentGroupId != null) {
Map<String, Object> pp = new HashMap<>();
pp.put("parent_group_id", parentGroupId);
Map<String, Object> parent = sqlSession.selectOne(NS + "select_parent_group_by_id", pp);
Map<String, Object> parent = sqlSession.selectOne(NS + "selectParentGroupById", pp);
if (parent != null) {
hierarchyPath = parent.get("hierarchy_path") + "/" + params.get("group_code");
} else {
@@ -909,37 +909,37 @@ public class ScreenGroupService extends BaseService {
params.put("hierarchy_path", hierarchyPath);
// 중복 체크
int dupCount = sqlSession.selectOne(NS + "count_group_by_code", params);
int dupCount = sqlSession.selectOne(NS + "countGroupByCode", params);
if (dupCount > 0) {
throw new IllegalArgumentException("동일한 그룹코드가 이미 존재합니다.");
}
sqlSession.insert(NS + "insert_pop_screen_group", params);
sqlSession.insert(NS + "insertPopScreenGroup", params);
Map<String, Object> sp = new HashMap<>();
sp.put("id", params.get("id"));
return sqlSession.selectOne(NS + "select_screen_group_by_id", sp);
return sqlSession.selectOne(NS + "selectScreenGroupById", sp);
}
@Transactional
public Map<String, Object> updatePopScreenGroup(Map<String, Object> params) {
Map<String, Object> existing = sqlSession.selectOne(NS + "select_screen_group_for_update", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectScreenGroupForUpdate", params);
if (existing == null) throw new NoSuchElementException("그룹을 찾을 수 없습니다.");
String hierarchyPath = (String) existing.get("hierarchy_path");
if (hierarchyPath == null || !hierarchyPath.startsWith("POP")) {
throw new IllegalArgumentException("POP 그룹만 수정할 수 있습니다.");
}
sqlSession.update(NS + "update_pop_screen_group", params);
sqlSession.update(NS + "updatePopScreenGroup", params);
Map<String, Object> sp = new HashMap<>();
sp.put("id", params.get("id"));
return sqlSession.selectOne(NS + "select_screen_group_by_id", sp);
return sqlSession.selectOne(NS + "selectScreenGroupById", sp);
}
@Transactional
public void deletePopScreenGroup(Map<String, Object> params) {
Map<String, Object> existing = sqlSession.selectOne(NS + "select_screen_group_for_update", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectScreenGroupForUpdate", params);
if (existing == null) {
Map<String, Object> any = sqlSession.selectOne(NS + "select_any_screen_group_by_id", params);
Map<String, Object> any = sqlSession.selectOne(NS + "selectAnyScreenGroupById", params);
if (any != null) {
String ownerCode = (String) any.get("company_code");
throw new SecurityException("이 그룹은 " + ("*".equals(ownerCode) ? "최고관리자" : ownerCode)
@@ -951,26 +951,26 @@ public class ScreenGroupService extends BaseService {
if (hierarchyPath == null || !hierarchyPath.startsWith("POP")) {
throw new IllegalArgumentException("POP 그룹만 삭제할 수 있습니다.");
}
int childCount = sqlSession.selectOne(NS + "count_child_groups_by_parent_id", params);
int childCount = sqlSession.selectOne(NS + "countChildGroupsByParentId", params);
if (childCount > 0) throw new IllegalArgumentException("하위 그룹이 " + childCount + "개 있어 삭제할 수 없습니다. 하위 그룹을 먼저 삭제해주세요.");
int screenCount = sqlSession.selectOne(NS + "count_group_screens_by_group_id", params);
int screenCount = sqlSession.selectOne(NS + "countGroupScreensByGroupId", params);
if (screenCount > 0) throw new IllegalArgumentException("그룹에 연결된 화면이 " + screenCount + "개 있어 삭제할 수 없습니다. 화면을 먼저 제거해주세요.");
Map<String, Object> dp = new HashMap<>();
dp.put("id", params.get("id"));
dp.put("target_company_code", existing.get("company_code"));
sqlSession.delete(NS + "delete_screen_group_by_id", dp);
sqlSession.delete(NS + "deleteScreenGroupById", dp);
}
public Map<String, Object> ensurePopRootGroup(Map<String, Object> params) {
String companyCode = (String) params.get("company_code");
Map<String, Object> existing = sqlSession.selectOne(NS + "select_pop_root_group", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectPopRootGroup", params);
if (existing != null) return existing;
if (!"*".equals(companyCode)) return null;
sqlSession.insert(NS + "insert_pop_root_group", params);
return sqlSession.selectOne(NS + "select_pop_root_group", params);
sqlSession.insert(NS + "insertPopRootGroup", params);
return sqlSession.selectOne(NS + "selectPopRootGroup", params);
}
//
@@ -986,8 +986,8 @@ public class ScreenGroupService extends BaseService {
try {
Map<String, Object> p = new HashMap<>();
p.put("company_code", companyCode);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "select_screen_groups_for_sync", p);
List<Map<String, Object>> existingMenus = sqlSession.selectList(NS + "select_existing_menus_for_sync", p);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "selectScreenGroupsForSync", p);
List<Map<String, Object>> existingMenus = sqlSession.selectList(NS + "selectExistingMenusForSync", p);
// path/name menu 매핑 (screen_group_id 없는 것만)
Map<String, Map<String, Object>> menuByPath = new LinkedHashMap<>();
@@ -1005,7 +1005,7 @@ public class ScreenGroupService extends BaseService {
});
// 사용자 메뉴 루트 확보
Map<String, Object> rootMenu = sqlSession.selectOne(NS + "select_user_menu_root", p);
Map<String, Object> rootMenu = sqlSession.selectOne(NS + "selectUserMenuRoot", p);
long userMenuRootObjid;
if (rootMenu != null) {
userMenuRootObjid = toLong(rootMenu.get("objid"));
@@ -1015,7 +1015,7 @@ public class ScreenGroupService extends BaseService {
rp.put("objid", rootObjid);
rp.put("company_code", companyCode);
rp.put("user_id", userId);
sqlSession.insert(NS + "insert_user_menu_root", rp);
sqlSession.insert(NS + "insertUserMenuRoot", rp);
userMenuRootObjid = rootObjid;
}
@@ -1053,7 +1053,7 @@ public class ScreenGroupService extends BaseService {
continue;
} else {
Map<String, Object> cp = new HashMap<>(); cp.put("id", gid);
sqlSession.update(NS + "clear_screen_group_menu_objid", cp);
sqlSession.update(NS + "clearScreenGroupMenuObjid", cp);
}
}
@@ -1068,18 +1068,18 @@ public class ScreenGroupService extends BaseService {
if (matchedMenu != null) {
long mObjid = toLong(matchedMenu.get("objid"));
Map<String, Object> up = new HashMap<>(); up.put("menu_objid", mObjid); up.put("id", gid);
sqlSession.update(NS + "update_screen_group_menu_objid", up);
sqlSession.update(NS + "updateScreenGroupMenuObjid", up);
Map<String, Object> up2 = new HashMap<>(); up2.put("group_id", gid); up2.put("objid", mObjid);
sqlSession.update(NS + "update_menu_screen_group_id", up2);
sqlSession.update(NS + "updateMenuScreenGroupId", up2);
// URL 업데이트
Map<String, Object> dp = new HashMap<>(); dp.put("group_id", gid); dp.put("company_code", companyCode);
Map<String, Object> defaultScreen = sqlSession.selectOne(NS + "select_default_screen_for_group", dp);
Map<String, Object> defaultScreen = sqlSession.selectOne(NS + "selectDefaultScreenForGroup", dp);
if (defaultScreen != null) {
Map<String, Object> urlp = new HashMap<>();
urlp.put("menu_url", "/screens/" + defaultScreen.get("screen_id"));
urlp.put("screen_code", defaultScreen.get("screen_code"));
urlp.put("objid", mObjid);
sqlSession.update(NS + "update_menu_url_and_screen_code", urlp);
sqlSession.update(NS + "updateMenuUrlAndScreenCode", urlp);
}
groupToMenuMap.put(gid, mObjid);
linked++;
@@ -1101,10 +1101,10 @@ public class ScreenGroupService extends BaseService {
Map<String, Object> seqp = new HashMap<>();
seqp.put("parent_objid", parentMenuObjid);
seqp.put("company_code", companyCode);
int seq = sqlSession.selectOne(NS + "get_next_menu_seq_under_parent", seqp);
int seq = sqlSession.selectOne(NS + "getNextMenuSeqUnderParent", seqp);
Map<String, Object> dp = new HashMap<>(); dp.put("group_id", gid); dp.put("company_code", companyCode);
Map<String, Object> defScreen = sqlSession.selectOne(NS + "select_default_screen_for_group", dp);
Map<String, Object> defScreen = sqlSession.selectOne(NS + "selectDefaultScreenForGroup", dp);
String menuUrl = defScreen != null ? "/screens/" + defScreen.get("screen_id") : null;
String screenCode = defScreen != null ? (String) defScreen.get("screen_code") : null;
@@ -1114,10 +1114,10 @@ public class ScreenGroupService extends BaseService {
ins.put("seq", seq); ins.put("company_code", companyCode); ins.put("user_id", userId);
ins.put("group_id", gid); ins.put("description", group.get("description"));
ins.put("menu_url", menuUrl); ins.put("screen_code", screenCode); ins.put("icon", group.get("icon"));
sqlSession.insert(NS + "insert_menu_for_group", ins);
sqlSession.insert(NS + "insertMenuForGroup", ins);
Map<String, Object> up = new HashMap<>(); up.put("menu_objid", newObjid); up.put("id", gid);
sqlSession.update(NS + "update_screen_group_menu_objid", up);
sqlSession.update(NS + "updateScreenGroupMenuObjid", up);
groupToMenuMap.put(gid, newObjid);
created++;
@@ -1154,11 +1154,11 @@ public class ScreenGroupService extends BaseService {
p.put("company_code", companyCode);
// 회사명 조회
Map<String, Object> companyRow = sqlSession.selectOne(NS + "select_company_name", p);
Map<String, Object> companyRow = sqlSession.selectOne(NS + "selectCompanyName", p);
String companyName = companyRow != null ? toStr(companyRow.get("company_name")) : companyCode;
List<Map<String, Object>> menus = sqlSession.selectList(NS + "select_menus_for_sync", p);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "select_groups_for_sync", p);
List<Map<String, Object>> menus = sqlSession.selectList(NS + "selectMenusForSync", p);
List<Map<String, Object>> groups = sqlSession.selectList(NS + "selectGroupsForSync", p);
// path/name group 매핑 (menu_objid 없는 것만)
Map<String, Map<String, Object>> groupByPath = new LinkedHashMap<>();
@@ -1176,24 +1176,24 @@ public class ScreenGroupService extends BaseService {
});
// 회사 폴더 확보
Map<String, Object> folderRow = sqlSession.selectOne(NS + "select_root_company_folder", p);
Map<String, Object> folderRow = sqlSession.selectOne(NS + "selectRootCompanyFolder", p);
int companyFolderId;
if (folderRow != null) {
companyFolderId = toInt(folderRow.get("id"));
} else {
int maxOrder = sqlSession.selectOne(NS + "get_max_root_display_order", null);
int maxOrder = sqlSession.selectOne(NS + "getMaxRootDisplayOrder", null);
Map<String, Object> fp = new HashMap<>();
fp.put("company_name", companyName);
fp.put("group_code", companyCode.toLowerCase());
fp.put("display_order", maxOrder);
fp.put("company_code", companyCode);
fp.put("user_id", userId);
sqlSession.insert(NS + "insert_company_folder", fp);
sqlSession.insert(NS + "insertCompanyFolder", fp);
companyFolderId = toInt(fp.get("id"));
Map<String, Object> hp = new HashMap<>();
hp.put("id", companyFolderId);
hp.put("hierarchy_path", "/" + companyFolderId + "/");
sqlSession.update(NS + "update_group_hierarchy_path_by_id", hp);
sqlSession.update(NS + "updateGroupHierarchyPathById", hp);
}
Map<Long, Integer> menuToGroupMap = new LinkedHashMap<>();
@@ -1221,9 +1221,9 @@ public class ScreenGroupService extends BaseService {
if (matchedGroup != null) {
int gid = toInt(matchedGroup.get("id"));
Map<String, Object> up = new HashMap<>(); up.put("menu_objid", mObjid); up.put("id", gid);
sqlSession.update(NS + "update_screen_group_for_menu_sync", up);
sqlSession.update(NS + "updateScreenGroupForMenuSync", up);
Map<String, Object> up2 = new HashMap<>(); up2.put("group_id", gid); up2.put("objid", mObjid);
sqlSession.update(NS + "update_menu_screen_group_id", up2);
sqlSession.update(NS + "updateMenuScreenGroupId", up2);
menuToGroupMap.put(mObjid, gid);
linked++;
details.add(detail("linked", mName, mObjid, gid, null));
@@ -1236,7 +1236,7 @@ public class ScreenGroupService extends BaseService {
// 부모 그룹 level + hierarchy_path 조회
Map<String, Object> pp = new HashMap<>();
pp.put("parent_group_id", parentGid);
Map<String, Object> parentGroup = sqlSession.selectOne(NS + "select_parent_group_by_id", pp);
Map<String, Object> parentGroup = sqlSession.selectOne(NS + "selectParentGroupById", pp);
int parentLevel = parentGroup != null ? toInt(parentGroup.getOrDefault("group_level", 0)) : 0;
String parentPath = parentGroup != null ? toStr(parentGroup.get("hierarchy_path")) : "/" + parentGid + "/";
@@ -1251,17 +1251,17 @@ public class ScreenGroupService extends BaseService {
ins.put("hierarchy_path", parentPath + "0/");
ins.put("menu_objid", mObjid);
ins.put("description", menu.get("menu_desc"));
sqlSession.insert(NS + "insert_screen_group_for_sync", ins);
sqlSession.insert(NS + "insertScreenGroupForSync", ins);
int newGid = toInt(ins.get("id"));
String hp = (parentPath + newGid + "/").replace("//", "/");
Map<String, Object> hpu = new HashMap<>();
hpu.put("id", newGid);
hpu.put("hierarchy_path", hp);
sqlSession.update(NS + "update_group_hierarchy_path_by_id", hpu);
sqlSession.update(NS + "updateGroupHierarchyPathById", hpu);
Map<String, Object> up2 = new HashMap<>(); up2.put("group_id", newGid); up2.put("objid", mObjid);
sqlSession.update(NS + "update_menu_screen_group_id", up2);
sqlSession.update(NS + "updateMenuScreenGroupId", up2);
menuToGroupMap.put(mObjid, newGid);
existingGroupIds.add(newGid);
@@ -1291,8 +1291,8 @@ public class ScreenGroupService extends BaseService {
public Map<String, Object> getSyncStatus(String companyCode) {
Map<String, Object> p = new HashMap<>();
p.put("company_code", companyCode);
List<Map<String, Object>> groupStats = sqlSession.selectList(NS + "select_sync_status_groups", p);
List<Map<String, Object>> menuStats = sqlSession.selectList(NS + "select_sync_status_menus", p);
List<Map<String, Object>> groupStats = sqlSession.selectList(NS + "selectSyncStatusGroups", p);
List<Map<String, Object>> menuStats = sqlSession.selectList(NS + "selectSyncStatusMenus", p);
Map<String, Object> status = new LinkedHashMap<>();
status.put("company_code", companyCode);
status.put("groups", groupStats);
@@ -1305,7 +1305,7 @@ public class ScreenGroupService extends BaseService {
//
public Map<String, Object> syncAllCompanies(String userId) {
List<Map<String, Object>> companies = sqlSession.selectList(NS + "select_all_company_codes", null);
List<Map<String, Object>> companies = sqlSession.selectList(NS + "selectAllCompanyCodes", null);
List<Map<String, Object>> results = new ArrayList<>();
int successCount = 0, failedCount = 0;
@@ -49,8 +49,8 @@ public class ScreenManagementService extends BaseService {
params.put("exclude_pop", "true".equalsIgnoreCase(epRaw.toString()));
}
List<Map<String, Object>> data = sqlSession.selectList(NS + "select_screen_list", params);
int total = sqlSession.selectOne(NS + "count_screen_list", params);
List<Map<String, Object>> data = sqlSession.selectList(NS + "selectScreenList", params);
int total = sqlSession.selectOne(NS + "countScreenList", params);
// 테이블 레이블 병합
enrichWithTableLabels(data);
@@ -68,7 +68,7 @@ public class ScreenManagementService extends BaseService {
public Map<String, Object> getScreenById(Integer screenId) {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
return sqlSession.selectOne(NS + "select_screen_by_id", params);
return sqlSession.selectOne(NS + "selectScreenById", params);
}
/** 화면에 할당된 메뉴 조회 */
@@ -76,38 +76,38 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
return sqlSession.selectOne(NS + "select_menu_by_screen", params);
return sqlSession.selectOne(NS + "selectMenuByScreen", params);
}
/** 화면 생성 */
@Transactional
public Map<String, Object> createScreen(Map<String, Object> body, String companyCode, String userId) {
// 화면 코드 중복 체크
String screenCode = (String) body.get("screen_code");
String screenCode = (String) bp(body, "screen_code", "screenCode");
if (screenCode != null) {
Map<String, Object> ckParams = new HashMap<>();
ckParams.put("screen_code", screenCode);
int cnt = sqlSession.selectOne(NS + "check_screen_code_exists", ckParams);
int cnt = sqlSession.selectOne(NS + "checkScreenCodeExists", ckParams);
if (cnt > 0) {
throw new IllegalStateException("DUPLICATE_SCREEN_CODE");
}
}
Map<String, Object> params = new HashMap<>();
params.put("screen_name", body.get("screen_name"));
params.put("screen_name", bp(body, "screen_name", "screenName"));
params.put("screen_code", screenCode);
params.put("table_name", body.get("table_name"));
params.put("table_name", bp(body, "table_name", "tableName"));
params.put("company_code", companyCode);
params.put("description", body.get("description"));
params.put("created_by", userId);
params.put("db_source_type", body.get("db_source_type"));
params.put("db_connection_id", body.get("db_connection_id"));
params.put("data_source_type", body.get("data_source_type"));
params.put("rest_api_connection_id", body.get("rest_api_connection_id"));
params.put("rest_api_endpoint", body.get("rest_api_endpoint"));
params.put("rest_api_json_path", body.get("rest_api_json_path"));
params.put("db_source_type", bp(body, "db_source_type", "dbSourceType"));
params.put("db_connection_id", bp(body, "db_connection_id", "dbConnectionId"));
params.put("data_source_type", bp(body, "data_source_type", "dataSourceType"));
params.put("rest_api_connection_id", bp(body, "rest_api_connection_id", "restApiConnectionId"));
params.put("rest_api_endpoint", bp(body, "rest_api_endpoint", "restApiEndpoint"));
params.put("rest_api_json_path", bp(body, "rest_api_json_path", "restApiJsonPath"));
return sqlSession.selectOne(NS + "insert_screen", params);
return sqlSession.selectOne(NS + "insertScreen", params);
}
/** 화면 수정 */
@@ -121,7 +121,7 @@ public class ScreenManagementService extends BaseService {
params.put("is_active", body.getOrDefault("is_active", "Y"));
params.put("updated_by", userId);
int updated = sqlSession.update(NS + "update_screen", params);
int updated = sqlSession.update(NS + "updateScreen", params);
if (updated == 0) return null;
return getScreenById(screenId);
}
@@ -143,7 +143,7 @@ public class ScreenManagementService extends BaseService {
params.put("rest_api_endpoint", body.get("rest_api_endpoint"));
params.put("rest_api_json_path", body.get("rest_api_json_path"));
int updated = sqlSession.update(NS + "update_screen_info", params);
int updated = sqlSession.update(NS + "updateScreenInfo", params);
if (updated == 0) return null;
return getScreenById(screenId);
}
@@ -154,7 +154,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("table_name", tableName);
int updated = sqlSession.update(NS + "update_screen_table_name", params);
int updated = sqlSession.update(NS + "updateScreenTableName", params);
if (updated == 0) return null;
return getScreenById(screenId);
}
@@ -165,8 +165,8 @@ public class ScreenManagementService extends BaseService {
params.put("screen_id", screenId);
params.put("company_code", companyCode);
List<Map<String, Object>> menuDeps = sqlSession.selectList(NS + "select_menu_assignment_deps", params);
List<Map<String, Object>> layoutDeps = sqlSession.selectList(NS + "select_screens_with_layouts", params);
List<Map<String, Object>> menuDeps = sqlSession.selectList(NS + "selectMenuAssignmentDeps", params);
List<Map<String, Object>> layoutDeps = sqlSession.selectList(NS + "selectScreensWithLayouts", params);
// 화면을 모달로 사용하는 레이아웃 탐색
List<Map<String, Object>> linkedScreens = detectLinkedScreensInternal(screenId, companyCode);
@@ -205,15 +205,15 @@ public class ScreenManagementService extends BaseService {
usageParams.put("screen_id", screenId);
usageParams.put("company_code", companyCode);
usageParams.put("flow_id", flowId);
int usageCount = sqlSession.selectOne(NS + "count_flow_usage_in_other_screens", usageParams);
int usageCount = sqlSession.selectOne(NS + "countFlowUsageInOtherScreens", usageParams);
if (usageCount == 0) {
Map<String, Object> fp = new HashMap<>();
fp.put("flow_id", flowId);
fp.put("company_code", companyCode);
sqlSession.delete(NS + "delete_flow_step_connections", fp);
sqlSession.delete(NS + "delete_flow_steps", fp);
sqlSession.delete(NS + "delete_flow_definition", fp);
sqlSession.delete(NS + "delete_node_flows_by_flow_id", fp);
sqlSession.delete(NS + "deleteFlowStepConnections", fp);
sqlSession.delete(NS + "deleteFlowSteps", fp);
sqlSession.delete(NS + "deleteFlowDefinition", fp);
sqlSession.delete(NS + "deleteNodeFlowsByFlowId", fp);
log.info("화면 삭제 시 플로우 삭제: screenId={}, flowId={}", screenId, flowId);
}
}
@@ -223,9 +223,9 @@ public class ScreenManagementService extends BaseService {
params.put("screen_id", screenId);
params.put("deleted_by", userId);
params.put("delete_reason", deleteReason);
sqlSession.update(NS + "soft_delete_screen", params);
sqlSession.update(NS + "deactivate_menu_assignments_by_screen", params);
sqlSession.delete(NS + "delete_screen_group_links", params);
sqlSession.update(NS + "softDeleteScreen", params);
sqlSession.update(NS + "deactivateMenuAssignmentsByScreen", params);
sqlSession.delete(NS + "deleteScreenGroupLinks", params);
}
/** 화면 일괄 소프트 삭제 */
@@ -241,7 +241,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_name", screenName);
params.put("company_code", companyCode);
int cnt = sqlSession.selectOne(NS + "check_duplicate_screen_name", params);
int cnt = sqlSession.selectOne(NS + "checkDuplicateScreenName", params);
return cnt > 0;
}
@@ -256,9 +256,9 @@ public class ScreenManagementService extends BaseService {
params.put("size", size);
params.put("offset", (page - 1) * size);
List<Map<String, Object>> data = sqlSession.selectList(NS + "select_deleted_screen_list", params);
int total = sqlSession.selectOne(NS + "count_deleted_screen_list", params);
data = commonService.toCamelCaseKeysList(data);
List<Map<String, Object>> data = sqlSession.selectList(NS + "selectDeletedScreenList", params);
int total = sqlSession.selectOne(NS + "countDeletedScreenList", params);
// snake_case 통일: camelCase 변환 제거
Map<String, Object> result = new LinkedHashMap<>();
result.put("data", data);
@@ -281,7 +281,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> ckParams = new HashMap<>();
ckParams.put("screen_code", screenCode);
ckParams.put("screen_id", screenId);
int cnt = sqlSession.selectOne(NS + "check_screen_code_for_restore", ckParams);
int cnt = sqlSession.selectOne(NS + "checkScreenCodeForRestore", ckParams);
if (cnt > 0) {
throw new IllegalStateException("SCREEN_CODE_CONFLICT");
}
@@ -290,8 +290,8 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("restored_by", userId);
sqlSession.update(NS + "restore_screen", params);
sqlSession.update(NS + "reactivate_menu_assignments_by_screen", params);
sqlSession.update(NS + "restoreScreen", params);
sqlSession.update(NS + "reactivateMenuAssignmentsByScreen", params);
return getScreenById(screenId);
}
@@ -301,8 +301,8 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
sqlSession.delete(NS + "permanentDeleteLayoutV1", params);
sqlSession.delete(NS + "permanent_delete_menu_assignments_by_screen", params);
sqlSession.delete(NS + "permanent_delete_screen", params);
sqlSession.delete(NS + "permanentDeleteMenuAssignmentsByScreen", params);
sqlSession.delete(NS + "permanentDeleteScreen", params);
}
/** 영구 삭제 (일괄) */
@@ -324,7 +324,7 @@ public class ScreenManagementService extends BaseService {
int lockId = companyCode.chars().sum();
Map<String, Object> lockParams = new HashMap<>();
lockParams.put("lock_id", (long) lockId);
sqlSession.selectOne(NS + "pg_advisory_xact_lock", lockParams);
sqlSession.selectOne(NS + "pgAdvisoryXactLock", lockParams);
return calcNextScreenCode(companyCode);
}
@@ -335,11 +335,11 @@ public class ScreenManagementService extends BaseService {
int lockId = companyCode.chars().sum();
Map<String, Object> lockParams = new HashMap<>();
lockParams.put("lock_id", (long) lockId);
sqlSession.selectOne(NS + "pg_advisory_xact_lock", lockParams);
sqlSession.selectOne(NS + "pgAdvisoryXactLock", lockParams);
Map<String, Object> params = new HashMap<>();
params.put("pattern", companyCode + "_%");
List<Map<String, Object>> existing = sqlSession.selectList(NS + "select_screen_codes_by_pattern", params);
List<Map<String, Object>> existing = sqlSession.selectList(NS + "selectScreenCodesByPattern", params);
Pattern numPattern = Pattern.compile("^" + Pattern.quote(companyCode) + "_(\\d+)$");
int maxNumber = existing.stream()
@@ -366,7 +366,7 @@ public class ScreenManagementService extends BaseService {
@Transactional
public Map<String, Object> copyScreen(Integer screenId, String newName,
String companyCode, String userId) {
Map<String, Object> original = sqlSession.selectOne(NS + "select_screen_for_copy", Map.of("screen_id", screenId));
Map<String, Object> original = sqlSession.selectOne(NS + "selectScreenForCopy", Map.of("screen_id", screenId));
if (original == null) throw new IllegalArgumentException("복사할 화면을 찾을 수 없습니다.");
String newCode = generateScreenCode(companyCode);
@@ -385,7 +385,7 @@ public class ScreenManagementService extends BaseService {
insertParams.put("rest_api_endpoint", original.get("rest_api_endpoint"));
insertParams.put("rest_api_json_path", original.get("rest_api_json_path"));
Map<String, Object> newScreen = sqlSession.selectOne(NS + "insert_screen_copy", insertParams);
Map<String, Object> newScreen = sqlSession.selectOne(NS + "insertScreenCopy", insertParams);
Integer newScreenId = toInteger(newScreen.get("screen_id"));
// Layout V1 복사
@@ -449,13 +449,13 @@ public class ScreenManagementService extends BaseService {
//
public List<Map<String, Object>> getTables() {
return sqlSession.selectList(NS + "select_public_tables", new HashMap<>());
return sqlSession.selectList(NS + "selectPublicTables", new HashMap<>());
}
public Map<String, Object> getTableInfo(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
return sqlSession.selectOne(NS + "select_table_info_by_name", params);
return sqlSession.selectOne(NS + "selectTableInfoByName", params);
}
public Map<String, Object> getTableColumns(String tableName, String companyCode) {
@@ -463,8 +463,8 @@ public class ScreenManagementService extends BaseService {
params.put("table_name", tableName);
params.put("company_code", companyCode);
List<Map<String, Object>> columns = sqlSession.selectList(NS + "select_table_columns_info", params);
List<Map<String, Object>> typeColumns = sqlSession.selectList(NS + "select_table_type_columns_info", params);
List<Map<String, Object>> columns = sqlSession.selectList(NS + "selectTableColumnsInfo", params);
List<Map<String, Object>> typeColumns = sqlSession.selectList(NS + "selectTableTypeColumnsInfo", params);
Map<String, Object> result = new LinkedHashMap<>();
result.put("columns", columns);
@@ -704,7 +704,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> tp = new HashMap<>();
tp.put("screen_id", screenId);
tp.put("table_name", tableName);
sqlSession.update(NS + "update_screen_main_table", tp);
sqlSession.update(NS + "updateScreenMainTable", tp);
}
}
@@ -716,7 +716,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
return sqlSession.selectOne(NS + "select_layout_pop", params);
return sqlSession.selectOne(NS + "selectLayoutPop", params);
}
@Transactional
@@ -728,7 +728,7 @@ public class ScreenManagementService extends BaseService {
params.put("company_code", companyCode);
params.put("layout_data", layoutData);
params.put("user_id", userId);
sqlSession.insert(NS + "upsert_layout_pop", params);
sqlSession.insert(NS + "upsertLayoutPop", params);
}
@Transactional
@@ -736,13 +736,13 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
sqlSession.delete(NS + "delete_layout_pop_by_screen", params);
sqlSession.delete(NS + "deleteLayoutPopByScreen", params);
}
public List<Map<String, Object>> getScreenIdsWithPopLayout(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "select_screen_ids_with_pop_layout", params);
return sqlSession.selectList(NS + "selectScreenIdsWithPopLayout", params);
}
//
@@ -753,7 +753,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "select_layers_by_screen", params);
return sqlSession.selectList(NS + "selectLayersByScreen", params);
}
public Map<String, Object> getLayerLayout(Integer screenId, Integer layerId, String companyCode) {
@@ -761,7 +761,7 @@ public class ScreenManagementService extends BaseService {
params.put("screen_id", screenId);
params.put("layer_id", layerId);
params.put("company_code", companyCode);
return sqlSession.selectOne(NS + "select_layer_layout", params);
return sqlSession.selectOne(NS + "selectLayerLayout", params);
}
@Transactional
@@ -770,7 +770,7 @@ public class ScreenManagementService extends BaseService {
params.put("screen_id", screenId);
params.put("layer_id", layerId);
params.put("company_code", companyCode);
return sqlSession.delete(NS + "delete_layer_by_id", params) > 0;
return sqlSession.delete(NS + "deleteLayerById", params) > 0;
}
@Transactional
@@ -782,7 +782,7 @@ public class ScreenManagementService extends BaseService {
params.put("company_code", companyCode);
params.put("condition_config", toJsonString(body.get("condition_config")));
if (body.containsKey("layer_name")) params.put("layer_name", body.get("layer_name"));
sqlSession.update(NS + "update_layer_condition", params);
sqlSession.update(NS + "updateLayerCondition", params);
}
//
@@ -793,7 +793,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "select_zones_by_screen", params);
return sqlSession.selectList(NS + "selectZonesByScreen", params);
}
@Transactional
@@ -809,7 +809,7 @@ public class ScreenManagementService extends BaseService {
params.put("trigger_component_id", body.get("trigger_component_id"));
params.put("trigger_operator", body.get("trigger_operator"));
Map<String, Object> zone = sqlSession.selectOne(NS + "insert_zone", params);
Map<String, Object> zone = sqlSession.selectOne(NS + "insertZone", params);
// 레이어 생성 (zone에 연결)
Integer newLayerId = calcNextLayerId(screenId, companyCode);
@@ -820,7 +820,7 @@ public class ScreenManagementService extends BaseService {
layerParams.put("layer_name", body.getOrDefault("zone_name", "새 레이어"));
layerParams.put("layout_data", "{\"components\":[]}");
layerParams.put("condition_config", "{}");
sqlSession.insert(NS + "insert_layer_for_zone", layerParams);
sqlSession.insert(NS + "insertLayerForZone", layerParams);
Map<String, Object> result = new LinkedHashMap<>();
result.put("zone", zone);
@@ -833,7 +833,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>(body);
params.put("zone_id", zoneId);
params.put("company_code", companyCode);
return sqlSession.update(NS + "update_zone", params) > 0;
return sqlSession.update(NS + "updateZone", params) > 0;
}
@Transactional
@@ -842,12 +842,12 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> clearParams = new HashMap<>();
clearParams.put("zone_id_str", String.valueOf(zoneId));
clearParams.put("company_code", companyCode);
sqlSession.update(NS + "clear_zone_condition_configs", clearParams);
sqlSession.update(NS + "clearZoneConditionConfigs", clearParams);
Map<String, Object> params = new HashMap<>();
params.put("zone_id", zoneId);
params.put("company_code", companyCode);
return sqlSession.delete(NS + "delete_zone_by_id", params) > 0;
return sqlSession.delete(NS + "deleteZoneById", params) > 0;
}
@Transactional
@@ -861,7 +861,7 @@ public class ScreenManagementService extends BaseService {
params.put("layer_name", body.getOrDefault("layer_name", "새 레이어"));
params.put("layout_data", "{\"components\":[]}");
params.put("condition_config", toJsonString(body.getOrDefault("condition_config", new HashMap<>())));
sqlSession.insert(NS + "insert_layer_for_zone", params);
sqlSession.insert(NS + "insertLayerForZone", params);
Map<String, Object> result = new LinkedHashMap<>();
result.put("layer_id", newLayerId);
@@ -876,14 +876,14 @@ public class ScreenManagementService extends BaseService {
@Transactional
public Map<String, Object> assignScreenToMenu(Integer screenId, Map<String, Object> body,
String companyCode, String userId) {
Integer menuObjid = toInteger(body.get("menu_objid"));
String menuObjid = String.valueOf(body.get("menu_objid"));
// 기존 할당 체크
Map<String, Object> ckParams = new HashMap<>();
ckParams.put("screen_id", screenId);
ckParams.put("menu_objid", menuObjid);
ckParams.put("company_code", companyCode);
Map<String, Object> existing = sqlSession.selectOne(NS + "check_menu_assignment_exists", ckParams);
Map<String, Object> existing = sqlSession.selectOne(NS + "checkMenuAssignmentExists", ckParams);
if (existing != null) throw new IllegalStateException("ALREADY_ASSIGNED");
Map<String, Object> params = new HashMap<>();
@@ -892,13 +892,13 @@ public class ScreenManagementService extends BaseService {
params.put("company_code", companyCode);
params.put("display_order", body.getOrDefault("display_order", 0));
params.put("created_by", userId);
sqlSession.insert(NS + "insert_menu_assignment", params);
sqlSession.insert(NS + "insertMenuAssignment", params);
// screen_code 조회 menu_info 업데이트
Map<String, Object> screenCodeRow = sqlSession.selectOne(NS + "select_screen_code", Map.of("screen_id", screenId));
Map<String, Object> screenCodeRow = sqlSession.selectOne(NS + "selectScreenCode", Map.of("screen_id", screenId));
String screenCode = screenCodeRow != null ? (String) screenCodeRow.get("screen_code") : null;
Map<String, Object> menuTypeRow = sqlSession.selectOne(NS + "select_menu_type", Map.of("menu_objid", menuObjid));
Map<String, Object> menuTypeRow = sqlSession.selectOne(NS + "selectMenuType", Map.of("menu_objid", menuObjid));
String menuType = menuTypeRow != null ? (String) menuTypeRow.get("menu_type") : null;
if (screenCode != null) {
@@ -907,7 +907,7 @@ public class ScreenManagementService extends BaseService {
updateParams.put("menu_objid", menuObjid);
updateParams.put("menu_url", menuUrl);
updateParams.put("screen_code", screenCode);
sqlSession.update(NS + "update_menu_info_assign", updateParams);
sqlSession.update(NS + "updateMenuInfoAssign", updateParams);
}
Map<String, Object> result = new LinkedHashMap<>();
@@ -918,26 +918,26 @@ public class ScreenManagementService extends BaseService {
return result;
}
public List<Map<String, Object>> getScreensByMenu(Integer menuObjid, String companyCode) {
public List<Map<String, Object>> getScreensByMenu(String menuObjid, String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("menu_objid", menuObjid);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "select_screens_by_menu", params);
return sqlSession.selectList(NS + "selectScreensByMenu", params);
}
@Transactional
public void unassignScreenFromMenu(Integer screenId, Integer menuObjid, String companyCode) {
public void unassignScreenFromMenu(Integer screenId, String menuObjid, String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("menu_objid", menuObjid);
params.put("company_code", companyCode);
sqlSession.delete(NS + "delete_menu_assignment", params);
sqlSession.update(NS + "update_menu_info_unassign", Map.of("menu_objid", menuObjid));
sqlSession.delete(NS + "deleteMenuAssignment", params);
sqlSession.update(NS + "updateMenuInfoUnassign", Map.of("menu_objid", menuObjid));
}
@Transactional
public int cleanupDeletedMenuAssignments() {
return sqlSession.update(NS + "cleanup_deleted_menu_assignments", new HashMap<>());
return sqlSession.update(NS + "cleanupDeletedMenuAssignments", new HashMap<>());
}
//
@@ -977,7 +977,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_ids", screenIds);
params.put("source_company_code", sourceCompanyCode);
List<Map<String, Object>> assignments = sqlSession.selectList(NS + "select_menu_assignments_for_copy", params);
List<Map<String, Object>> assignments = sqlSession.selectList(NS + "selectMenuAssignmentsForCopy", params);
int count = 0;
for (Map<String, Object> a : assignments) {
@@ -987,7 +987,7 @@ public class ScreenManagementService extends BaseService {
ip.put("company_code", targetCompanyCode);
ip.put("display_order", a.get("display_order"));
ip.put("created_by", userId);
sqlSession.insert(NS + "insert_menu_assignment_copy", ip);
sqlSession.insert(NS + "insertMenuAssignmentCopy", ip);
count++;
}
return count;
@@ -1002,21 +1002,21 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("source_company_code", sourceCompanyCode);
List<Map<String, Object>> categories = sqlSession.selectList(NS + "select_code_category_for_copy", params);
List<Map<String, Object>> categories = sqlSession.selectList(NS + "selectCodeCategoryForCopy", params);
int count = 0;
for (Map<String, Object> cat : categories) {
Map<String, Object> cp = new HashMap<>(cat);
cp.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_code_category", cp);
sqlSession.insert(NS + "upsertCodeCategory", cp);
Map<String, Object> codeParams = new HashMap<>();
codeParams.put("source_company_code", sourceCompanyCode);
codeParams.put("code_category", cat.get("category_code"));
List<Map<String, Object>> codes = sqlSession.selectList(NS + "select_code_info_for_copy", codeParams);
List<Map<String, Object>> codes = sqlSession.selectList(NS + "selectCodeInfoForCopy", codeParams);
for (Map<String, Object> code : codes) {
Map<String, Object> cop = new HashMap<>(code);
cop.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_code_info", cop);
sqlSession.insert(NS + "upsertCodeInfo", cop);
count++;
}
}
@@ -1031,18 +1031,18 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("source_company_code", sourceCompanyCode);
List<Map<String, Object>> trees = sqlSession.selectList(NS + "select_category_tree_for_copy", params);
List<Map<String, Object>> trees = sqlSession.selectList(NS + "selectCategoryTreeForCopy", params);
for (Map<String, Object> t : trees) {
Map<String, Object> tp = new HashMap<>(t);
tp.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_category_tree", tp);
sqlSession.insert(NS + "upsertCategoryTree", tp);
}
List<Map<String, Object>> values = sqlSession.selectList(NS + "select_category_value_for_copy", params);
List<Map<String, Object>> values = sqlSession.selectList(NS + "selectCategoryValueForCopy", params);
for (Map<String, Object> v : values) {
Map<String, Object> vp = new HashMap<>(v);
vp.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_category_value", vp);
sqlSession.insert(NS + "upsertCategoryValue", vp);
}
return trees.size() + values.size();
}
@@ -1055,11 +1055,11 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("source_company_code", sourceCompanyCode);
List<Map<String, Object>> cols = sqlSession.selectList(NS + "select_table_type_columns_for_copy", params);
List<Map<String, Object>> cols = sqlSession.selectList(NS + "selectTableTypeColumnsForCopy", params);
for (Map<String, Object> col : cols) {
Map<String, Object> cp = new HashMap<>(col);
cp.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_table_type_column", cp);
sqlSession.insert(NS + "upsertTableTypeColumn", cp);
}
return cols.size();
}
@@ -1072,11 +1072,11 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("source_company_code", sourceCompanyCode);
List<Map<String, Object>> rels = sqlSession.selectList(NS + "select_cascading_relation_for_copy", params);
List<Map<String, Object>> rels = sqlSession.selectList(NS + "selectCascadingRelationForCopy", params);
for (Map<String, Object> rel : rels) {
Map<String, Object> rp = new HashMap<>(rel);
rp.put("target_company_code", targetCompanyCode);
sqlSession.insert(NS + "upsert_cascading_relation", rp);
sqlSession.insert(NS + "upsertCascadingRelation", rp);
}
return rels.size();
}
@@ -1089,7 +1089,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
Map<String, Object> popLayout = sqlSession.selectOne(NS + "select_layout_pop", params);
Map<String, Object> popLayout = sqlSession.selectOne(NS + "selectLayoutPop", params);
List<Integer> linkedScreenIds = new ArrayList<>();
if (popLayout != null) {
@@ -1101,7 +1101,7 @@ public class ScreenManagementService extends BaseService {
if (!linkedScreenIds.isEmpty()) {
Map<String, Object> idsParams = new HashMap<>();
idsParams.put("ids", linkedScreenIds);
linkedScreens = sqlSession.selectList(NS + "select_screens_by_ids", idsParams);
linkedScreens = sqlSession.selectList(NS + "selectScreensByIds", idsParams);
}
Map<String, Object> result = new LinkedHashMap<>();
@@ -1125,7 +1125,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> existsParams = new HashMap<>();
existsParams.put("screen_code", screenCode);
existsParams.put("company_code", targetCompanyCode);
Map<String, Object> existing = sqlSession.selectOne(NS + "select_screen_by_code", existsParams);
Map<String, Object> existing = sqlSession.selectOne(NS + "selectScreenByCode", existsParams);
Integer targetScreenId;
if (existing == null) {
@@ -1139,7 +1139,7 @@ public class ScreenManagementService extends BaseService {
insertParams.put("created_by", userId);
insertParams.put("db_source_type", screenDef.get("db_source_type"));
insertParams.put("data_source_type", screenDef.get("data_source_type"));
Map<String, Object> created = sqlSession.selectOne(NS + "insert_screen_for_deploy", insertParams);
Map<String, Object> created = sqlSession.selectOne(NS + "insertScreenForDeploy", insertParams);
targetScreenId = toInteger(created.get("screen_id"));
} else {
targetScreenId = toInteger(existing.get("screen_id"));
@@ -1149,7 +1149,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> sourceParams = new HashMap<>();
sourceParams.put("screen_id", toInteger(screenDef.get("screen_id")));
sourceParams.put("company_code", sourceCompanyCode);
Map<String, Object> sourceLayout = sqlSession.selectOne(NS + "select_layout_pop", sourceParams);
Map<String, Object> sourceLayout = sqlSession.selectOne(NS + "selectLayoutPop", sourceParams);
if (sourceLayout != null) {
Map<String, Object> deployParams = new HashMap<>();
@@ -1157,7 +1157,7 @@ public class ScreenManagementService extends BaseService {
deployParams.put("company_code", targetCompanyCode);
deployParams.put("layout_data", toJsonString(sourceLayout.get("layout_data")));
deployParams.put("user_id", userId);
sqlSession.insert(NS + "upsert_pop_layout_deploy", deployParams);
sqlSession.insert(NS + "upsertPopLayoutDeploy", deployParams);
}
Map<String, Object> result = new LinkedHashMap<>();
@@ -1181,7 +1181,7 @@ public class ScreenManagementService extends BaseService {
private List<Map<String, Object>> detectLinkedScreensInternal(Integer screenId, String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
List<Map<String, Object>> layouts = sqlSession.selectList(NS + "select_layouts_for_linked_modal", params);
List<Map<String, Object>> layouts = sqlSession.selectList(NS + "selectLayoutsForLinkedModal", params);
Set<Integer> linkedIds = new LinkedHashSet<>();
for (Map<String, Object> layout : layouts) {
@@ -1198,7 +1198,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> idsParams = new HashMap<>();
idsParams.put("ids", new ArrayList<>(linkedIds));
return sqlSession.selectList(NS + "select_screens_by_ids", idsParams);
return sqlSession.selectList(NS + "selectScreensByIds", idsParams);
}
/** JSON 노드 트리를 재귀 탐색하여 screenId 참조 수집 */
@@ -1353,7 +1353,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_names", new ArrayList<>(tableNames));
try {
List<Map<String, Object>> labels = sqlSession.selectList(NS + "select_table_labels_by_names", params);
List<Map<String, Object>> labels = sqlSession.selectList(NS + "selectTableLabelsByNames", params);
Map<String, String> labelMap = new HashMap<>();
for (Map<String, Object> row : labels) {
labelMap.put((String) row.get("table_name"), (String) row.get("table_label"));
@@ -1369,7 +1369,7 @@ public class ScreenManagementService extends BaseService {
private String calcNextScreenCode(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("pattern", companyCode + "_%");
List<Map<String, Object>> existing = sqlSession.selectList(NS + "select_screen_codes_by_pattern", params);
List<Map<String, Object>> existing = sqlSession.selectList(NS + "selectScreenCodesByPattern", params);
Pattern numPattern = Pattern.compile("^" + Pattern.quote(companyCode) + "_(\\d+)$");
int maxNumber = existing.stream()
@@ -1389,7 +1389,7 @@ public class ScreenManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("screen_id", screenId);
params.put("company_code", companyCode);
Map<String, Object> row = sqlSession.selectOne(NS + "select_max_layer_id", params);
Map<String, Object> row = sqlSession.selectOne(NS + "selectMaxLayerId", params);
int maxId = row != null ? toInt(row.getOrDefault("max_id", 1), 1) : 1;
return maxId + 1;
}
@@ -1416,4 +1416,10 @@ public class ScreenManagementService extends BaseService {
try { return Integer.parseInt(val.toString()); }
catch (NumberFormatException e) { return null; }
}
/** snake_case 우선, camelCase fallback으로 request body 파라미터 추출 */
private Object bp(Map<String, Object> body, String snakeKey, String camelKey) {
Object val = body.get(snakeKey);
return val != null ? val : body.get(camelKey);
}
}
@@ -21,12 +21,12 @@ public class TableCategoryValueService extends BaseService {
public List<Map<String, Object>> getCategoryColumns(Map<String, Object> params) {
log.info("카테고리 컬럼 목록 조회: tableName={}, companyCode={}",
params.get("table_name"), params.get("company_code"));
return sqlSession.selectList(NS + "get_category_column_list", params);
return sqlSession.selectList(NS + "getCategoryColumnList", params);
}
public List<Map<String, Object>> getAllCategoryColumns(Map<String, Object> params) {
log.info("전체 카테고리 컬럼 목록 조회: companyCode={}", params.get("company_code"));
return sqlSession.selectList(NS + "get_all_category_column_list", params);
return sqlSession.selectList(NS + "getAllCategoryColumnList", params);
}
//
@@ -37,7 +37,7 @@ public class TableCategoryValueService extends BaseService {
log.info("카테고리 값 목록 조회: tableName={}, columnName={}, companyCode={}",
params.get("table_name"), params.get("column_name"), params.get("company_code"));
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "get_category_value_list", params);
List<Map<String, Object>> flatList = sqlSession.selectList(NS + "getCategoryValueList", params);
List<Map<String, Object>> hierarchy = buildHierarchy(flatList, null);
log.info("카테고리 값 {}개 조회 완료 (평면)", flatList.size());
@@ -59,12 +59,12 @@ public class TableCategoryValueService extends BaseService {
log.info("카테고리 값 추가: tableName={}, columnName={}, valueCode={}, companyCode={}",
tableName, columnName, valueCode, companyCode);
Integer codeDup = sqlSession.selectOne(NS + "count_duplicate_code", params);
Integer codeDup = sqlSession.selectOne(NS + "countDuplicateCode", params);
if (codeDup != null && codeDup > 0) {
throw new IllegalArgumentException("이미 존재하는 코드입니다");
}
Integer labelDup = sqlSession.selectOne(NS + "count_duplicate_label", params);
Integer labelDup = sqlSession.selectOne(NS + "countDuplicateLabel", params);
if (labelDup != null && labelDup > 0) {
throw new IllegalArgumentException(
"이미 동일한 이름의 카테고리 값이 존재합니다: \"" + valueLabel + "\"");
@@ -75,14 +75,14 @@ public class TableCategoryValueService extends BaseService {
if (params.get("is_active") == null) params.put("is_active", true);
if (params.get("is_default") == null) params.put("is_default", false);
sqlSession.insert(NS + "insert_category_value", params);
sqlSession.insert(NS + "insertCategoryValue", params);
long valueId = toLong(params.get("value_id"));
log.info("카테고리 값 추가 완료: valueId={}", valueId);
Map<String, Object> fetchP = new HashMap<>();
fetchP.put("value_id", valueId);
return sqlSession.selectOne(NS + "get_category_value_info", fetchP);
return sqlSession.selectOne(NS + "getCategoryValueInfo", fetchP);
}
@Transactional
@@ -93,7 +93,7 @@ public class TableCategoryValueService extends BaseService {
log.info("카테고리 값 수정: valueId={}, companyCode={}", valueId, companyCode);
if (params.get("value_label") != null) {
Map<String, Object> current = sqlSession.selectOne(NS + "get_category_value_label_info",
Map<String, Object> current = sqlSession.selectOne(NS + "getCategoryValueLabelInfo",
Map.of("value_id", valueId));
if (current != null) {
Map<String, Object> labelP = new HashMap<>();
@@ -102,7 +102,7 @@ public class TableCategoryValueService extends BaseService {
labelP.put("company_code", current.get("company_code"));
labelP.put("value_label", params.get("value_label"));
labelP.put("value_id", valueId);
Integer dup = sqlSession.selectOne(NS + "count_duplicate_label_exclude_self", labelP);
Integer dup = sqlSession.selectOne(NS + "countDuplicateLabelExcludeSelf", labelP);
if (dup != null && dup > 0) {
throw new IllegalArgumentException(
"이미 동일한 이름의 카테고리 값이 존재합니다: \""
@@ -112,15 +112,15 @@ public class TableCategoryValueService extends BaseService {
}
params.put("value_id", valueId);
Integer rows = sqlSession.selectOne(NS + "update_category_value", params);
Integer rows = sqlSession.selectOne(NS + "updateCategoryValue", params);
if (rows == null || rows == 0) {
// update returns affected rows via selectOne workaround; use update method instead
sqlSession.update(NS + "update_category_value", params);
sqlSession.update(NS + "updateCategoryValue", params);
}
Map<String, Object> fetchP = new HashMap<>();
fetchP.put("value_id", valueId);
return sqlSession.selectOne(NS + "get_category_value_info", fetchP);
return sqlSession.selectOne(NS + "getCategoryValueInfo", fetchP);
}
//
@@ -134,7 +134,7 @@ public class TableCategoryValueService extends BaseService {
log.info("카테고리 값 삭제: valueId={}, companyCode={}", valueId, companyCode);
List<Map<String, Object>> childRows = sqlSession.selectList(NS + "get_child_value_id_list", params);
List<Map<String, Object>> childRows = sqlSession.selectList(NS + "getChildValueIdList", params);
List<Long> allIds = new ArrayList<>();
allIds.add(valueId);
childRows.forEach(r -> allIds.add(toLong(r.get("value_id"))));
@@ -151,7 +151,7 @@ public class TableCategoryValueService extends BaseService {
Map<String, Object> delP = new HashMap<>();
delP.put("value_id", id);
delP.put("company_code", companyCode);
sqlSession.delete(NS + "delete_value_by_id", delP);
sqlSession.delete(NS + "deleteValueById", delP);
}
log.info("카테고리 값 삭제 완료: totalDeleted={}", allIds.size());
@@ -161,7 +161,7 @@ public class TableCategoryValueService extends BaseService {
public void bulkDeleteCategoryValues(Map<String, Object> params) {
log.info("카테고리 값 일괄 삭제: count={}, companyCode={}",
((List<?>) params.get("value_ids")).size(), params.get("company_code"));
sqlSession.update(NS + "bulk_soft_delete_values", params);
sqlSession.update(NS + "bulkSoftDeleteValues", params);
}
@Transactional
@@ -176,7 +176,7 @@ public class TableCategoryValueService extends BaseService {
p.put("value_id", toLong(rawIds.get(i)));
p.put("value_order", i + 1);
p.put("company_code", companyCode);
sqlSession.update(NS + "update_value_order", p);
sqlSession.update(NS + "updateValueOrder", p);
}
}
@@ -188,7 +188,7 @@ public class TableCategoryValueService extends BaseService {
log.info("컬럼 매핑 조회: tableName={}, menuObjid={}, companyCode={}",
params.get("table_name"), params.get("menu_objid"), params.get("company_code"));
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_column_mapping_list", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getColumnMappingList", params);
Map<String, Object> mapping = new LinkedHashMap<>();
for (Map<String, Object> row : rows) {
@@ -208,14 +208,14 @@ public class TableCategoryValueService extends BaseService {
log.info("컬럼 매핑 생성: tableName={}, logical={}, physical={}, companyCode={}",
tableName, logicalColumnName, physicalColumnName, params.get("company_code"));
Integer colExists = sqlSession.selectOne(NS + "check_physical_column_exists", params);
Integer colExists = sqlSession.selectOne(NS + "checkPhysicalColumnExists", params);
if (colExists == null || colExists == 0) {
throw new IllegalArgumentException(
"테이블 " + tableName + "에 컬럼 " + physicalColumnName + "이(가) 존재하지 않습니다");
}
sqlSession.insert(NS + "upsert_column_mapping", params);
Map<String, Object> result = sqlSession.selectOne(NS + "get_column_mapping_info", params);
sqlSession.insert(NS + "upsertColumnMapping", params);
Map<String, Object> result = sqlSession.selectOne(NS + "getColumnMappingInfo", params);
log.info("컬럼 매핑 생성 완료: mappingId={}", result != null ? result.get("mapping_id") : "?");
return result;
@@ -224,12 +224,12 @@ public class TableCategoryValueService extends BaseService {
public List<Map<String, Object>> getLogicalColumns(Map<String, Object> params) {
log.info("논리적 컬럼 목록 조회: tableName={}, menuObjid={}, companyCode={}",
params.get("table_name"), params.get("menu_objid"), params.get("company_code"));
return sqlSession.selectList(NS + "get_logical_column_list", params);
return sqlSession.selectList(NS + "getLogicalColumnList", params);
}
@Transactional
public void deleteColumnMapping(Map<String, Object> params) {
int deleted = sqlSession.delete(NS + "delete_column_mapping_by_id", params);
int deleted = sqlSession.delete(NS + "deleteColumnMappingById", params);
if (deleted == 0) {
throw new IllegalArgumentException("컬럼 매핑을 찾을 수 없거나 권한이 없습니다");
}
@@ -238,7 +238,7 @@ public class TableCategoryValueService extends BaseService {
@Transactional
public int deleteColumnMappingsByColumn(Map<String, Object> params) {
int deleted = sqlSession.delete(NS + "delete_column_mappings_by_column", params);
int deleted = sqlSession.delete(NS + "deleteColumnMappingsByColumn", params);
log.info("테이블+컬럼 기준 매핑 삭제 완료: tableName={}, columnName={}, deletedCount={}",
params.get("table_name"), params.get("column_name"), deleted);
return deleted;
@@ -257,7 +257,7 @@ public class TableCategoryValueService extends BaseService {
log.info("카테고리 코드로 라벨 조회: count={}, companyCode={}",
((List<?>) rawCodes).size(), params.get("company_code"));
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_label_list_by_codes", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getLabelListByCodes", params);
Map<String, Object> labels = new LinkedHashMap<>();
for (Map<String, Object> row : rows) {
@@ -277,11 +277,11 @@ public class TableCategoryValueService extends BaseService {
public List<Map<String, Object>> getSecondLevelMenus(Map<String, Object> params) {
log.info("2레벨 메뉴 목록 조회: companyCode={}", params.get("company_code"));
Integer hasCC = sqlSession.selectOne(NS + "check_menu_info_has_company_code", null);
Integer hasCC = sqlSession.selectOne(NS + "checkMenuInfoHasCompanyCode", null);
params.put("has_company_code", hasCC != null && hasCC > 0);
log.info("menu_info.company_code 컬럼 존재 여부: {}", hasCC != null && hasCC > 0);
List<Map<String, Object>> menus = sqlSession.selectList(NS + "get_second_level_menu_list", params);
List<Map<String, Object>> menus = sqlSession.selectList(NS + "getSecondLevelMenuList", params);
log.info("2레벨 메뉴 {}개 조회 완료", menus.size());
return menus;
}
@@ -295,7 +295,7 @@ public class TableCategoryValueService extends BaseService {
p.put("value_id", valueId);
p.put("company_code", companyCode);
Map<String, Object> valueInfo = sqlSession.selectOne(NS + "get_category_value_usage_info", p);
Map<String, Object> valueInfo = sqlSession.selectOne(NS + "getCategoryValueUsageInfo", p);
if (valueInfo == null) {
throw new IllegalArgumentException("카테고리 값을 찾을 수 없습니다");
}
@@ -310,7 +310,7 @@ public class TableCategoryValueService extends BaseService {
if (safeTable.isEmpty() || safeColumn.isEmpty()) return;
Integer tableExists = sqlSession.selectOne(NS + "check_table_exists_for_usage",
Integer tableExists = sqlSession.selectOne(NS + "checkTableExistsForUsage",
Map.of("table_name", safeTable));
if (tableExists == null || tableExists == 0) return;
@@ -319,10 +319,10 @@ public class TableCategoryValueService extends BaseService {
countP.put("safe_column_name", safeColumn);
countP.put("value_code", valueCode);
countP.put("company_code", companyCode);
Integer count = sqlSession.selectOne(NS + "count_value_usage_in_table", countP);
Integer count = sqlSession.selectOne(NS + "countValueUsageInTable", countP);
if (count != null && count > 0) {
List<Map<String, Object>> menus = sqlSession.selectList(NS + "get_menu_list_using_table",
List<Map<String, Object>> menus = sqlSession.selectList(NS + "getMenuListUsingTable",
Map.of("table_name", tableName, "company_code", companyCode));
StringBuilder msg = new StringBuilder();
@@ -20,7 +20,7 @@ public class TableHistoryService extends BaseService {
String logTableName = tableName + "_log";
params.put("log_table_name", logTableName);
Map<String, Object> row = sqlSession.selectOne(NS + "check_history_table_exists", params);
Map<String, Object> row = sqlSession.selectOne(NS + "checkHistoryTableExists", params);
boolean exists = Boolean.TRUE.equals(row != null ? row.get("exists") : Boolean.FALSE);
String message = exists ? "이력 테이블이 존재합니다." : "이력 테이블이 존재하지 않습니다.";
@@ -35,7 +35,7 @@ public class TableHistoryService extends BaseService {
public List<Map<String, Object>> getTableHistorySummary(Map<String, Object> params) {
prepareLogTableName(params);
return withTableNotFound(() -> sqlSession.selectList(NS + "select_table_history_summary", params));
return withTableNotFound(() -> sqlSession.selectList(NS + "selectTableHistorySummary", params));
}
public Map<String, Object> getAllTableHistory(Map<String, Object> params) {
@@ -46,8 +46,8 @@ public class TableHistoryService extends BaseService {
int limit = (int) params.get("limit");
int offset = (int) params.get("offset");
List<Map<String, Object>> records = withTableNotFound(() -> sqlSession.selectList(NS + "select_all_table_history", params));
Integer totalObj = withTableNotFound(() -> sqlSession.selectOne(NS + "count_all_table_history", params));
List<Map<String, Object>> records = withTableNotFound(() -> sqlSession.selectList(NS + "selectAllTableHistory", params));
Integer totalObj = withTableNotFound(() -> sqlSession.selectOne(NS + "countAllTableHistory", params));
int total = totalObj != null ? totalObj : 0;
return buildPaginatedResult(records, total, limit, offset, (offset + limit) < total);
@@ -61,8 +61,8 @@ public class TableHistoryService extends BaseService {
int limit = (int) params.get("limit");
int offset = (int) params.get("offset");
List<Map<String, Object>> records = withTableNotFound(() -> sqlSession.selectList(NS + "select_record_history", params));
Integer totalObj = withTableNotFound(() -> sqlSession.selectOne(NS + "count_record_history", params));
List<Map<String, Object>> records = withTableNotFound(() -> sqlSession.selectList(NS + "selectRecordHistory", params));
Integer totalObj = withTableNotFound(() -> sqlSession.selectOne(NS + "countRecordHistory", params));
int total = totalObj != null ? totalObj : 0;
return buildPaginatedResult(records, total, limit, offset, (offset + records.size()) < total);
@@ -70,7 +70,7 @@ public class TableHistoryService extends BaseService {
public List<Map<String, Object>> getRecordTimeline(Map<String, Object> params) {
prepareLogTableName(params);
return withTableNotFound(() -> sqlSession.selectList(NS + "select_record_timeline", params));
return withTableNotFound(() -> sqlSession.selectList(NS + "selectRecordTimeline", params));
}
// Private helpers
@@ -31,7 +31,7 @@ public class TableManagementService extends BaseService {
//
public List<Map<String, Object>> getTableList() {
List<Map<String, Object>> tables = sqlSession.selectList(NS + "get_table_list");
List<Map<String, Object>> tables = sqlSession.selectList(NS + "getTableList");
// columnCount Long Integer 변환 (Node 호환)
for (Map<String, Object> t : tables) {
Object cnt = t.get("column_count");
@@ -52,15 +52,15 @@ public class TableManagementService extends BaseService {
params.put("size", size);
params.put("offset", (long) (page - 1) * size);
Integer totalObj = sqlSession.selectOne(NS + "get_column_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getColumnListCnt", params);
int total = totalObj != null ? totalObj : 0;
List<Map<String, Object>> columns;
if (companyCode != null && !companyCode.isBlank()) {
params.put("company_code", companyCode);
columns = sqlSession.selectList(NS + "get_column_list_with_company", params);
columns = sqlSession.selectList(NS + "getColumnListWithCompany", params);
} else {
columns = sqlSession.selectList(NS + "get_column_list", params);
columns = sqlSession.selectList(NS + "getColumnList", params);
}
int totalPages = total == 0 ? 1 : (int) Math.ceil((double) total / size);
@@ -80,13 +80,13 @@ public class TableManagementService extends BaseService {
public List<Map<String, Object>> getTableSchema(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
return sqlSession.selectList(NS + "get_table_schema_list", params);
return sqlSession.selectList(NS + "getTableSchemaList", params);
}
public boolean checkTableExists(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
Map<String, Object> result = sqlSession.selectOne(NS + "check_table_exists", params);
Map<String, Object> result = sqlSession.selectOne(NS + "checkTableExists", params);
Object exists = result != null ? result.get("exists") : null;
return Boolean.TRUE.equals(exists);
}
@@ -95,7 +95,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", sanitize(tableName));
params.put("column_name", sanitize(columnName));
Integer cntObj = sqlSession.selectOne(NS + "check_table_has_column", params);
Integer cntObj = sqlSession.selectOne(NS + "checkTableHasColumn", params);
return cntObj != null && cntObj > 0;
}
@@ -106,7 +106,7 @@ public class TableManagementService extends BaseService {
public Map<String, Object> getTableLabels(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
return sqlSession.selectOne(NS + "get_table_label_info", params);
return sqlSession.selectOne(NS + "getTableLabelInfo", params);
}
@Transactional
@@ -115,14 +115,14 @@ public class TableManagementService extends BaseService {
params.put("table_name", tableName);
params.put("display_name", displayName);
params.put("description", description != null ? description : "");
sqlSession.update(NS + "upsert_table_label", params);
sqlSession.update(NS + "upsertTableLabel", params);
log.info("테이블 라벨 업데이트: {}", tableName);
}
private void ensureTableInLabels(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
sqlSession.insert(NS + "insert_table_label_if_not_exists", params);
sqlSession.insert(NS + "insertTableLabelIfNotExists", params);
}
//
@@ -133,7 +133,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("column_name", columnName);
return sqlSession.selectOne(NS + "get_column_label_info", params);
return sqlSession.selectOne(NS + "getColumnLabelInfo", params);
}
//
@@ -161,7 +161,7 @@ public class TableManagementService extends BaseService {
params.put("is_visible", settings.getOrDefault("is_visible", true));
params.put("company_code", companyCode);
params.put("category_ref", "category".equals(inputType) ? settings.get("category_ref") : null);
sqlSession.update(NS + "upsert_column_settings", params);
sqlSession.update(NS + "upsertColumnSettings", params);
// 화면 레이아웃 동기화
syncScreenLayouts(tableName, columnName, inputType, companyCode);
@@ -194,7 +194,7 @@ public class TableManagementService extends BaseService {
params.put("clear_entity", false);
params.put("clear_code", false);
params.put("clear_category", false);
sqlSession.update(NS + "upsert_column_input_type", params);
sqlSession.update(NS + "upsertColumnInputType", params);
log.info("컬럼 웹타입 설정: {}.{} = {}", tableName, columnName, finalType);
}
@@ -212,7 +212,7 @@ public class TableManagementService extends BaseService {
params.put("clear_entity", !"entity".equals(finalType));
params.put("clear_code", !"code".equals(finalType));
params.put("clear_category", !"category".equals(finalType));
sqlSession.update(NS + "upsert_column_input_type", params);
sqlSession.update(NS + "upsertColumnInputType", params);
syncScreenLayouts(tableName, columnName, finalType, companyCode);
log.info("컬럼 입력타입 설정: {}.{} = {}, company={}", tableName, columnName, finalType, companyCode);
}
@@ -221,7 +221,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_column_input_type_list", params);
return sqlSession.selectList(NS + "getColumnInputTypeList", params);
}
//
@@ -232,7 +232,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
List<Map<String, Object>> pkResult = sqlSession.selectList(NS + "get_table_primary_key_list", params);
List<Map<String, Object>> pkResult = sqlSession.selectList(NS + "getTablePrimaryKeyList", params);
Map<String, Object> primaryKey = new HashMap<>();
if (!pkResult.isEmpty()) {
Map<String, Object> pk = pkResult.get(0);
@@ -243,7 +243,7 @@ public class TableManagementService extends BaseService {
primaryKey.put("columns", List.of());
}
List<Map<String, Object>> indexResult = sqlSession.selectList(NS + "get_table_index_list", params);
List<Map<String, Object>> indexResult = sqlSession.selectList(NS + "getTableIndexList", params);
List<Map<String, Object>> indexes = indexResult.stream().map(row -> {
Map<String, Object> idx = new HashMap<>();
idx.put("name", row.get("index_name"));
@@ -264,7 +264,7 @@ public class TableManagementService extends BaseService {
// 기존 PK 삭제
Map<String, Object> params = new HashMap<>();
params.put("table_name", safeTable);
List<Map<String, Object>> existingPk = sqlSession.selectList(NS + "get_table_primary_key_list", params);
List<Map<String, Object>> existingPk = sqlSession.selectList(NS + "getTablePrimaryKeyList", params);
if (!existingPk.isEmpty()) {
String constraintName = (String) existingPk.get(0).get("constraint_name");
jdbcTemplate.execute(
@@ -315,7 +315,7 @@ public class TableManagementService extends BaseService {
params.put("column_name", columnName);
params.put("is_nullable", nullable ? "Y" : "N");
params.put("company_code", companyCode);
sqlSession.update(NS + "upsert_nullable", params);
sqlSession.update(NS + "upsertNullable", params);
log.info("NOT NULL 토글: {}.{} nullable={}, company={}", tableName, columnName, nullable, companyCode);
}
@@ -327,7 +327,7 @@ public class TableManagementService extends BaseService {
params.put("column_name", columnName);
params.put("is_unique", unique ? "Y" : "N");
params.put("company_code", companyCode);
sqlSession.update(NS + "upsert_unique", params);
sqlSession.update(NS + "upsertUnique", params);
log.info("UNIQUE 토글: {}.{} unique={}, company={}", tableName, columnName, unique, companyCode);
}
@@ -341,7 +341,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("company_code", companyCode);
List<Map<String, Object>> notNullCols = sqlSession.selectList(NS + "get_not_null_column_list", params);
List<Map<String, Object>> notNullCols = sqlSession.selectList(NS + "getNotNullColumnList", params);
List<String> violations = new ArrayList<>();
for (Map<String, Object> col : notNullCols) {
@@ -361,7 +361,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("company_code", companyCode);
List<Map<String, Object>> uniqueCols = sqlSession.selectList(NS + "get_unique_column_list", params);
List<Map<String, Object>> uniqueCols = sqlSession.selectList(NS + "getUniqueColumnList", params);
String safeTable = sanitize(tableName);
List<String> violations = new ArrayList<>();
@@ -635,7 +635,7 @@ public class TableManagementService extends BaseService {
params.put("table_name", tableName);
params.put("is_active", isActive);
params.put("log_columns", String.join(",", targetCols));
sqlSession.update(NS + "upsert_log_config", params);
sqlSession.update(NS + "upsertLogConfig", params);
log.info("로그 테이블 생성: {}", safeLog);
}
@@ -643,7 +643,7 @@ public class TableManagementService extends BaseService {
public Map<String, Object> getLogConfig(String tableName) {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
return sqlSession.selectOne(NS + "get_log_config_info", params);
return sqlSession.selectOne(NS + "getLogConfigInfo", params);
}
public Map<String, Object> getLogData(String tableName, int page, int size) {
@@ -677,7 +677,7 @@ public class TableManagementService extends BaseService {
params.put("table_name", tableName);
params.put("is_active", isActive);
params.put("log_columns", "");
sqlSession.update(NS + "upsert_log_config", params);
sqlSession.update(NS + "upsertLogConfig", params);
log.info("로그 테이블 토글: {} → {}", tableName, isActive);
}
@@ -687,7 +687,7 @@ public class TableManagementService extends BaseService {
public Map<String, Object> checkDatabaseConnection() {
try {
sqlSession.selectOne(NS + "check_database_connection", null);
sqlSession.selectOne(NS + "checkDatabaseConnection", null);
return Map.of("connected", true, "message", "데이터베이스 연결 정상");
} catch (Exception e) {
log.error("DB 연결 실패", e);
@@ -702,20 +702,20 @@ public class TableManagementService extends BaseService {
public List<Map<String, Object>> getCategoryColumnsByCompany(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_category_column_list_by_company", params);
return sqlSession.selectList(NS + "getCategoryColumnListByCompany", params);
}
public List<Map<String, Object>> getNumberingColumnsByCompany(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_numbering_column_list_by_company", params);
return sqlSession.selectList(NS + "getNumberingColumnListByCompany", params);
}
public List<Map<String, Object>> getCategoryColumnsByMenu(String companyCode, Object menuObjid) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
params.put("menu_objid", menuObjid);
return sqlSession.selectList(NS + "get_category_column_list_by_menu", params);
return sqlSession.selectList(NS + "getCategoryColumnListByMenu", params);
}
//
@@ -728,7 +728,7 @@ public class TableManagementService extends BaseService {
params.put("left_table", leftTable);
params.put("right_table", rightTable);
params.put("company_code", companyCode);
List<Map<String, Object>> relations = sqlSession.selectList(NS + "get_entity_relation_list", params);
List<Map<String, Object>> relations = sqlSession.selectList(NS + "getEntityRelationList", params);
Map<String, Object> result = new HashMap<>();
result.put("left_table", leftTable);
result.put("right_table", rightTable);
@@ -740,7 +740,7 @@ public class TableManagementService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("table_name", tableName);
params.put("company_code", companyCode);
return sqlSession.selectList(NS + "get_referenced_by_table_list", params);
return sqlSession.selectList(NS + "getReferencedByTableList", params);
}
//
@@ -900,7 +900,7 @@ public class TableManagementService extends BaseService {
p.put("input_type", inputType);
p.put("company_code", companyCode);
p.put("component_id", mapInputTypeToComponentId(inputType));
sqlSession.update(NS + "sync_screen_layouts_input_type", p);
sqlSession.update(NS + "syncScreenLayoutsInputType", p);
} catch (Exception e) {
log.warn("화면 레이아웃 동기화 실패 (무시됨): {}.{}", tableName, columnName);
}
@@ -25,16 +25,16 @@ public class TaxInvoiceService extends BaseService {
public Map<String, Object> getTaxInvoiceList(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
commonService.applyPagination(params);
int totalCount = sqlSession.selectOne(NS + "get_tax_invoice_list_cnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_tax_invoice_list", params);
int totalCount = sqlSession.selectOne(NS + "getTaxInvoiceListCnt", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getTaxInvoiceList", params);
return commonService.buildListResponse(list, totalCount, params);
}
public Map<String, Object> getTaxInvoiceInfo(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> invoice = sqlSession.selectOne(NS + "get_tax_invoice_info", params);
Map<String, Object> invoice = sqlSession.selectOne(NS + "getTaxInvoiceInfo", params);
if (invoice == null) return null;
List<Map<String, Object>> items = sqlSession.selectList(NS + "get_tax_invoice_items", params);
List<Map<String, Object>> items = sqlSession.selectList(NS + "getTaxInvoiceItems", params);
Map<String, Object> result = new HashMap<>();
result.put("invoice", invoice);
result.put("items", items);
@@ -48,7 +48,7 @@ public class TaxInvoiceService extends BaseService {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
params.put("prefix", prefix + "%");
String lastNum = sqlSession.selectOne(NS + "get_last_invoice_number", params);
String lastNum = sqlSession.selectOne(NS + "getLastInvoiceNumber", params);
int nextNum = 1;
if (lastNum != null && !lastNum.isEmpty()) {
String[] parts = lastNum.split("-");
@@ -71,7 +71,7 @@ public class TaxInvoiceService extends BaseService {
params.put("total_amount", DecimalUtils.toBigDecimal(params.get("total_amount")));
String invoiceNumber = generateInvoiceNumber((String) params.get("company_code"));
params.put("invoice_number", invoiceNumber);
sqlSession.insert(NS + "insert_tax_invoice", params);
sqlSession.insert(NS + "insertTaxInvoice", params);
Object itemsObj = params.get("items");
if (itemsObj instanceof List<?> itemsList) {
for (int i = 0; i < itemsList.size(); i++) {
@@ -83,7 +83,7 @@ public class TaxInvoiceService extends BaseService {
item.put("supply_amount", DecimalUtils.toBigDecimal(item.get("supply_amount")));
item.put("tax_amount", DecimalUtils.toBigDecimal(item.get("tax_amount")));
item.put("unit_price", DecimalUtils.toBigDecimal(item.get("unit_price")));
sqlSession.insert(NS + "insert_tax_invoice_item", item);
sqlSession.insert(NS + "insertTaxInvoiceItem", item);
}
}
return params;
@@ -92,7 +92,7 @@ public class TaxInvoiceService extends BaseService {
@Transactional
public Map<String, Object> updateTaxInvoice(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_tax_invoice_info", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getTaxInvoiceInfo", params);
if (existing == null) {
throw new RuntimeException("세금계산서를 찾을 수 없습니다.");
}
@@ -102,10 +102,10 @@ public class TaxInvoiceService extends BaseService {
if (params.get("supply_amount") != null) params.put("supply_amount", DecimalUtils.toBigDecimal(params.get("supply_amount")));
if (params.get("tax_amount") != null) params.put("tax_amount", DecimalUtils.toBigDecimal(params.get("tax_amount")));
if (params.get("total_amount") != null) params.put("total_amount", DecimalUtils.toBigDecimal(params.get("total_amount")));
sqlSession.update(NS + "update_tax_invoice", params);
sqlSession.update(NS + "updateTaxInvoice", params);
Object itemsObj = params.get("items");
if (itemsObj != null) {
sqlSession.delete(NS + "delete_tax_invoice_items_by_invoice_id", params);
sqlSession.delete(NS + "deleteTaxInvoiceItemsByInvoiceId", params);
if (itemsObj instanceof List<?> itemsList) {
for (int i = 0; i < itemsList.size(); i++) {
@SuppressWarnings("unchecked")
@@ -116,7 +116,7 @@ public class TaxInvoiceService extends BaseService {
item.put("supply_amount", DecimalUtils.toBigDecimal(item.get("supply_amount")));
item.put("tax_amount", DecimalUtils.toBigDecimal(item.get("tax_amount")));
item.put("unit_price", DecimalUtils.toBigDecimal(item.get("unit_price")));
sqlSession.insert(NS + "insert_tax_invoice_item", item);
sqlSession.insert(NS + "insertTaxInvoiceItem", item);
}
}
}
@@ -126,36 +126,36 @@ public class TaxInvoiceService extends BaseService {
@Transactional
public Map<String, Object> deleteTaxInvoice(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
Map<String, Object> existing = sqlSession.selectOne(NS + "get_tax_invoice_info", params);
Map<String, Object> existing = sqlSession.selectOne(NS + "getTaxInvoiceInfo", params);
if (existing == null) {
throw new RuntimeException("세금계산서를 찾을 수 없습니다.");
}
if (!"draft".equals(existing.get("invoice_status"))) {
throw new RuntimeException("발행된 세금계산서는 삭제할 수 없습니다.");
}
sqlSession.delete(NS + "delete_tax_invoice_items_by_invoice_id", params);
sqlSession.delete(NS + "delete_tax_invoice", params);
sqlSession.delete(NS + "deleteTaxInvoiceItemsByInvoiceId", params);
sqlSession.delete(NS + "deleteTaxInvoice", params);
return params;
}
@Transactional
public Map<String, Object> issueTaxInvoice(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
int updated = sqlSession.update(NS + "issue_tax_invoice", params);
int updated = sqlSession.update(NS + "issueTaxInvoice", params);
if (updated == 0) {
throw new RuntimeException("세금계산서를 찾을 수 없거나 이미 발행된 상태입니다.");
}
return sqlSession.selectOne(NS + "get_tax_invoice_info", params);
return sqlSession.selectOne(NS + "getTaxInvoiceInfo", params);
}
@Transactional
public Map<String, Object> cancelTaxInvoice(Map<String, Object> params) {
commonService.applyCompanyCodeFilter(params);
int updated = sqlSession.update(NS + "cancel_tax_invoice", params);
int updated = sqlSession.update(NS + "cancelTaxInvoice", params);
if (updated == 0) {
throw new RuntimeException("세금계산서를 찾을 수 없거나 취소할 수 없는 상태입니다.");
}
return sqlSession.selectOne(NS + "get_tax_invoice_info", params);
return sqlSession.selectOne(NS + "getTaxInvoiceInfo", params);
}
public Map<String, Object> getMonthlyStats(Map<String, Object> params) {
@@ -167,7 +167,7 @@ public class TaxInvoiceService extends BaseService {
String endDate = firstDay.withDayOfMonth(firstDay.lengthOfMonth()).toString();
params.put("start_date", startDate);
params.put("end_date", endDate);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_monthly_stats", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getMonthlyStats", params);
Map<String, Object> sales = new HashMap<>();
sales.put("count", 0);
sales.put("supply_amount", BigDecimal.ZERO);
@@ -207,9 +207,9 @@ public class TaxInvoiceService extends BaseService {
params.put("start_date", startDate);
params.put("end_date", endDate);
}
List<Map<String, Object>> byCostType = sqlSession.selectList(NS + "get_cost_type_stats", params);
List<Map<String, Object>> byMonth = sqlSession.selectList(NS + "get_cost_type_stats_by_month", params);
Map<String, Object> summary = sqlSession.selectOne(NS + "get_cost_type_stats_summary", params);
List<Map<String, Object>> byCostType = sqlSession.selectList(NS + "getCostTypeStats", params);
List<Map<String, Object>> byMonth = sqlSession.selectList(NS + "getCostTypeStatsByMonth", params);
Map<String, Object> summary = sqlSession.selectOne(NS + "getCostTypeStatsSummary", params);
for (Map<String, Object> row : byCostType) {
row.put("supply_amount", DecimalUtils.toBigDecimal(row.get("supply_amount")));
row.put("tax_amount", DecimalUtils.toBigDecimal(row.get("tax_amount")));
@@ -67,10 +67,10 @@ public class TemplateStandardService extends BaseService {
params.put("limit", limit);
params.put("offset", offset);
List<Map<String, Object>> templates = sqlSession.selectList(NS + "get_template_standard_list", params);
List<Map<String, Object>> templates = sqlSession.selectList(NS + "getTemplateStandardList", params);
templates.forEach(this::deserializeJsonFields);
Integer totalObj = sqlSession.selectOne(NS + "get_template_standard_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getTemplateStandardListCnt", params);
int total = totalObj != null ? totalObj : 0;
Map<String, Object> result = new LinkedHashMap<>();
@@ -87,7 +87,7 @@ public class TemplateStandardService extends BaseService {
public Map<String, Object> getTemplateStandardInfo(String templateCode) {
Map<String, Object> params = new HashMap<>();
params.put("template_code", templateCode);
Map<String, Object> row = sqlSession.selectOne(NS + "get_template_standard_info", params);
Map<String, Object> row = sqlSession.selectOne(NS + "getTemplateStandardInfo", params);
deserializeJsonFields(row);
return row;
}
@@ -101,7 +101,7 @@ public class TemplateStandardService extends BaseService {
Map<String, Object> checkParams = new HashMap<>();
checkParams.put("template_code", templateCode);
if (sqlSession.selectOne(NS + "get_template_standard_info", checkParams) != null) {
if (sqlSession.selectOne(NS + "getTemplateStandardInfo", checkParams) != null) {
throw new IllegalArgumentException("템플릿 코드 '" + templateCode + "'는 이미 존재합니다.");
}
@@ -110,7 +110,7 @@ public class TemplateStandardService extends BaseService {
params.putIfAbsent("is_public", "N");
serializeJsonFields(params);
sqlSession.insert(NS + "insert_template_standard", params);
sqlSession.insert(NS + "insertTemplateStandard", params);
return getTemplateStandardInfo(templateCode);
}
@@ -123,7 +123,7 @@ public class TemplateStandardService extends BaseService {
params.put("template_code", templateCode);
serializeJsonFields(params);
int updated = sqlSession.update(NS + "update_template_standard", params);
int updated = sqlSession.update(NS + "updateTemplateStandard", params);
if (updated == 0) return null;
return getTemplateStandardInfo(templateCode);
@@ -136,7 +136,7 @@ public class TemplateStandardService extends BaseService {
public boolean deleteTemplateStandard(String templateCode) {
Map<String, Object> params = new HashMap<>();
params.put("template_code", templateCode);
return sqlSession.delete(NS + "delete_template_standard", params) > 0;
return sqlSession.delete(NS + "deleteTemplateStandard", params) > 0;
}
/**
@@ -145,7 +145,7 @@ public class TemplateStandardService extends BaseService {
@Transactional
public void updateTemplateStandardSortOrder(List<Map<String, Object>> templates) {
for (Map<String, Object> t : templates) {
sqlSession.update(NS + "update_template_standard_sort_order", t);
sqlSession.update(NS + "updateTemplateStandardSortOrder", t);
}
}
@@ -167,7 +167,7 @@ public class TemplateStandardService extends BaseService {
Map<String, Object> checkParams = new HashMap<>();
checkParams.put("template_code", newCode);
if (sqlSession.selectOne(NS + "get_template_standard_info", checkParams) != null) {
if (sqlSession.selectOne(NS + "getTemplateStandardInfo", checkParams) != null) {
throw new IllegalArgumentException("템플릿 코드 '" + newCode + "'는 이미 존재합니다.");
}
@@ -193,7 +193,7 @@ public class TemplateStandardService extends BaseService {
// layout_config / default_size가 이미 Object이면 직렬화
serializeJsonFields(newTemplate);
sqlSession.insert(NS + "insert_template_standard", newTemplate);
sqlSession.insert(NS + "insertTemplateStandard", newTemplate);
return getTemplateStandardInfo(newCode);
}
@@ -203,7 +203,7 @@ public class TemplateStandardService extends BaseService {
public List<String> getTemplateStandardCategoryList(String companyCode) {
Map<String, Object> params = new HashMap<>();
params.put("company_code", companyCode);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "get_template_standard_category_list", params);
List<Map<String, Object>> rows = sqlSession.selectList(NS + "getTemplateStandardCategoryList", params);
List<String> categories = new ArrayList<>();
for (Map<String, Object> row : rows) {
Object cat = row.get("category");
@@ -18,9 +18,9 @@ public class TodoService extends BaseService {
public Map<String, Object> getTodoList(Map<String, Object> params) {
commonService.applyPagination(params);
Integer totalObj = sqlSession.selectOne(NS + "get_todo_list_cnt", params);
Integer totalObj = sqlSession.selectOne(NS + "getTodoListCnt", params);
int totalCount = totalObj != null ? totalObj : 0;
List<Map<String, Object>> list = sqlSession.selectList(NS + "get_todo_list", params);
List<Map<String, Object>> list = sqlSession.selectList(NS + "getTodoList", params);
// stats 계산
Map<String, Object> stats = new LinkedHashMap<>();
@@ -40,26 +40,26 @@ public class TodoService extends BaseService {
}
public Map<String, Object> getTodoInfo(Map<String, Object> params) {
return sqlSession.selectOne(NS + "get_todo_info", params);
return sqlSession.selectOne(NS + "getTodoInfo", params);
}
@Transactional
public Map<String, Object> insertTodo(Map<String, Object> params) {
String id = UUID.randomUUID().toString();
params.put("id", id);
sqlSession.insert(NS + "insert_todo", params);
return sqlSession.selectOne(NS + "get_todo_info", Map.of("id", id));
sqlSession.insert(NS + "insertTodo", params);
return sqlSession.selectOne(NS + "getTodoInfo", Map.of("id", id));
}
@Transactional
public Map<String, Object> updateTodo(Map<String, Object> params) {
sqlSession.update(NS + "update_todo", params);
return sqlSession.selectOne(NS + "get_todo_info", Map.of("id", params.get("id")));
sqlSession.update(NS + "updateTodo", params);
return sqlSession.selectOne(NS + "getTodoInfo", Map.of("id", params.get("id")));
}
@Transactional
public Map<String, Object> deleteTodo(Map<String, Object> params) {
sqlSession.delete(NS + "delete_todo", params);
sqlSession.delete(NS + "deleteTodo", params);
return params;
}
@@ -69,7 +69,7 @@ public class TodoService extends BaseService {
Map<String, Object> p = new HashMap<>();
p.put("id", todoIds.get(i));
p.put("display_order", i);
sqlSession.update(NS + "update_todo_order", p);
sqlSession.update(NS + "updateTodoOrder", p);
}
}
}