# Pipeline: XML SQL 포맷팅 (덕일 스타일)

## config
- max_retries: 3
- parallel: true
- timeout: 15m
- design_first: false
- model: sonnet
- max_concurrent: 5

## tasks

### task-1: CommonMapper + AdminMapper + AuthMapper XML 포맷팅 [backend]
- depends: none
- done_when: SQL 키워드/컬럼/테이블 전부 대문자, 컬럼별 줄 띄움
- files: backend-spring/src/main/resources/mapper/CommonMapper.xml, backend-spring/src/main/resources/mapper/AdminMapper.xml, backend-spring/src/main/resources/mapper/AuthMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    XML 내부 SQL 쿼리를 덕일 스타일로 포맷팅. 기능 변경 없이 포맷만 변경.

    ★ 규칙 1: 키워드 전부 대문자
    select → SELECT, from → FROM, where → WHERE, and → AND, or → OR,
    left join → LEFT JOIN, inner join → INNER JOIN, order by → ORDER BY,
    group by → GROUP BY, having → HAVING, insert into → INSERT INTO,
    update → UPDATE, set → SET, delete → DELETE, values → VALUES,
    as → AS, on → ON, in → IN, not → NOT, null → NULL,
    is → IS, like → LIKE, ilike → ILIKE, between → BETWEEN,
    exists → EXISTS, not exists → NOT EXISTS,
    case → CASE, when → WHEN, then → THEN, else → ELSE, end → END,
    union all → UNION ALL, with recursive → WITH RECURSIVE,
    cast → CAST, coalesce → COALESCE, count → COUNT, sum → SUM,
    max → MAX, min → MIN, avg → AVG, distinct → DISTINCT,
    limit → LIMIT, offset → OFFSET, asc → ASC, desc → DESC,
    now() → NOW(), upper() → UPPER(), lower() → LOWER(),
    to_char() → TO_CHAR(), array[] → ARRAY[], lpad() → LPAD(),
    true → TRUE, false → FALSE

    ★ 규칙 2: 컬럼명/테이블명/별칭 전부 대문자
    user_id → USER_ID, company_code → COMPANY_CODE, menu_info → MENU_INFO,
    v → V, s → S, cm → CM, menu → MENU 등

    ★ 규칙 3: SELECT 컬럼은 한 줄에 하나, 쉼표는 컬럼 앞에
    변경 전:
    SELECT id, title, description, status FROM todo_items WHERE 1=1

    변경 후:
    SELECT
        ID
        , TITLE
        , DESCRIPTION
        , STATUS
    FROM TODO_ITEMS
    WHERE 1=1

    ★ 규칙 4: INSERT VALUES 한 줄에 하나
    변경 전:
    INSERT INTO table (col1, col2) VALUES (#{val1}, #{val2})

    변경 후:
    INSERT INTO TABLE (
        COL1
        , COL2
    ) VALUES (
        #{val1}
        , #{val2}
    )

    ★ 규칙 5: UPDATE SET 한 줄에 하나
    변경 전:
    UPDATE table SET col1 = #{val1}, col2 = #{val2} WHERE id = #{id}

    변경 후:
    UPDATE TABLE
    SET
        COL1 = #{val1}
        , COL2 = #{val2}
    WHERE ID = #{id}

    ★ 규칙 6: JOIN/WHERE/ORDER BY 절 단위 줄 구분
    변경 전:
    FROM v_menu v LEFT JOIN company_mng cm ON v.company_code = cm.company_code WHERE v.status = 'active' ORDER BY v.seq

    변경 후:
    FROM V_MENU V
    LEFT JOIN COMPANY_MNG CM
        ON V.COMPANY_CODE = CM.COMPANY_CODE
    WHERE V.STATUS = 'active'
    ORDER BY V.SEQ

    ★ 규칙 7: 절대 바꾸면 안 되는 것
    - #{파라미터}는 camelCase 유지: #{companyCode}, #{menuType}, #{userId}
    - MyBatis 태그 test="" 안의 변수명 camelCase 유지
    - SQL 문자열 리터럴 값 유지: 'active', '*', 'SUPER_ADMIN' 등
    - <sql id="">, <select id="">, <insert id=""> 등의 id 값 유지
    - namespace 유지 (이미 변환됨)
    - <include refid=""> 값 유지

    ★ 주의: 쿼리 로직/결과는 절대 변경하지 말 것. 포맷만 변경.

### task-2: Table/Entity XML 포맷팅 (8개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/TableManagementMapper.xml, backend-spring/src/main/resources/mapper/EntityJoinMapper.xml, backend-spring/src/main/resources/mapper/EntityReferenceMapper.xml, backend-spring/src/main/resources/mapper/EntitySearchMapper.xml, backend-spring/src/main/resources/mapper/DdlMapper.xml, backend-spring/src/main/resources/mapper/TableHistoryMapper.xml, backend-spring/src/main/resources/mapper/TableCategoryValueMapper.xml, backend-spring/src/main/resources/mapper/DbTypeCategoryMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-3: Screen/Layout XML 포맷팅 (7개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/ScreenManagementMapper.xml, backend-spring/src/main/resources/mapper/ScreenStandardMapper.xml, backend-spring/src/main/resources/mapper/ScreenFileMapper.xml, backend-spring/src/main/resources/mapper/ScreenGroupMapper.xml, backend-spring/src/main/resources/mapper/ScreenEmbeddingMapper.xml, backend-spring/src/main/resources/mapper/LayoutMapper.xml, backend-spring/src/main/resources/mapper/WebTypeStandardMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-4: Dataflow/Flow XML 포맷팅 (9개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/DataflowMapper.xml, backend-spring/src/main/resources/mapper/DataflowDiagramMapper.xml, backend-spring/src/main/resources/mapper/DataflowExecutionMapper.xml, backend-spring/src/main/resources/mapper/FlowMapper.xml, backend-spring/src/main/resources/mapper/FlowExternalDbConnectionMapper.xml, backend-spring/src/main/resources/mapper/ButtonDataflowMapper.xml, backend-spring/src/main/resources/mapper/TestButtonDataflowMapper.xml, backend-spring/src/main/resources/mapper/NodeFlowMapper.xml, backend-spring/src/main/resources/mapper/NodeExternalConnectionMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-5: CommonCode/Config XML 포맷팅 (7개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/CommonCodeMapper.xml, backend-spring/src/main/resources/mapper/MultilangMapper.xml, backend-spring/src/main/resources/mapper/ComponentStandardMapper.xml, backend-spring/src/main/resources/mapper/TemplateStandardMapper.xml, backend-spring/src/main/resources/mapper/ButtonActionStandardMapper.xml, backend-spring/src/main/resources/mapper/DynamicFormMapper.xml, backend-spring/src/main/resources/mapper/CategoryTreeMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-6: Finance/Tax XML 포맷팅 (7개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/TaxInvoiceMapper.xml, backend-spring/src/main/resources/mapper/BomMapper.xml, backend-spring/src/main/resources/mapper/ProductionMapper.xml, backend-spring/src/main/resources/mapper/SalesReportMapper.xml, backend-spring/src/main/resources/mapper/AnalyticsReportMapper.xml, backend-spring/src/main/resources/mapper/DeliveryMapper.xml, backend-spring/src/main/resources/mapper/PackagingMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-7: External/Connection XML 포맷팅 (6개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/ExternalDbConnectionMapper.xml, backend-spring/src/main/resources/mapper/ExternalRestApiConnectionMapper.xml, backend-spring/src/main/resources/mapper/ExternalCallMapper.xml, backend-spring/src/main/resources/mapper/ExternalCallConfigMapper.xml, backend-spring/src/main/resources/mapper/MultiConnectionMapper.xml, backend-spring/src/main/resources/mapper/OpenApiProxyMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-8: Batch/Schedule/기타 XML 포맷팅 (10개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/BatchMapper.xml, backend-spring/src/main/resources/mapper/BatchManagementMapper.xml, backend-spring/src/main/resources/mapper/BatchExecutionLogMapper.xml, backend-spring/src/main/resources/mapper/ScheduleMapper.xml, backend-spring/src/main/resources/mapper/NumberingRuleMapper.xml, backend-spring/src/main/resources/mapper/ProcessWorkStandardMapper.xml, backend-spring/src/main/resources/mapper/CodeMergeMapper.xml, backend-spring/src/main/resources/mapper/FileMapper.xml, backend-spring/src/main/resources/mapper/TodoMapper.xml, backend-spring/src/main/resources/mapper/AiAssistantProxyMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-9: Mail/Cascading XML 포맷팅 (11개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/MailAccountFileMapper.xml, backend-spring/src/main/resources/mapper/MailReceiveBasicMapper.xml, backend-spring/src/main/resources/mapper/MailSendSimpleMapper.xml, backend-spring/src/main/resources/mapper/MailSentHistoryMapper.xml, backend-spring/src/main/resources/mapper/MailTemplateFileMapper.xml, backend-spring/src/main/resources/mapper/CascadingRelationMapper.xml, backend-spring/src/main/resources/mapper/CascadingAutoFillMapper.xml, backend-spring/src/main/resources/mapper/CascadingConditionMapper.xml, backend-spring/src/main/resources/mapper/CascadingMutualExclusionMapper.xml, backend-spring/src/main/resources/mapper/CascadingHierarchyMapper.xml, backend-spring/src/main/resources/mapper/CategoryValueCascadingMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-10: Logistics/Report/기타 XML 포맷팅 (21개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/ShippingPlanMapper.xml, backend-spring/src/main/resources/mapper/ShippingOrderMapper.xml, backend-spring/src/main/resources/mapper/BookingMapper.xml, backend-spring/src/main/resources/mapper/DriverMapper.xml, backend-spring/src/main/resources/mapper/VehicleMapper.xml, backend-spring/src/main/resources/mapper/VehicleTripMapper.xml, backend-spring/src/main/resources/mapper/YardLayoutMapper.xml, backend-spring/src/main/resources/mapper/DigitalTwinMapper.xml, backend-spring/src/main/resources/mapper/DashboardMapper.xml, backend-spring/src/main/resources/mapper/ReportMapper.xml, backend-spring/src/main/resources/mapper/BarcodeLabelMapper.xml, backend-spring/src/main/resources/mapper/MapDataMapper.xml, backend-spring/src/main/resources/mapper/ExcelMappingMapper.xml, backend-spring/src/main/resources/mapper/RiskAlertMapper.xml, backend-spring/src/main/resources/mapper/PopActionMapper.xml, backend-spring/src/main/resources/mapper/PopProductionMapper.xml, backend-spring/src/main/resources/mapper/WorkHistoryMapper.xml, backend-spring/src/main/resources/mapper/MoldMapper.xml, backend-spring/src/main/resources/mapper/DesignMapper.xml, backend-spring/src/main/resources/mapper/CollectionMapper.xml, backend-spring/src/main/resources/mapper/DataMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-11: 나머지 XML 포맷팅 (9개) [backend]
- depends: none
- done_when: SQL 전부 대문자 + 줄 띄움
- files: backend-spring/src/main/resources/mapper/ApprovalMapper.xml, backend-spring/src/main/resources/mapper/AuditLogMapper.xml, backend-spring/src/main/resources/mapper/RoleMapper.xml, backend-spring/src/main/resources/mapper/DepartmentMapper.xml, backend-spring/src/main/resources/mapper/CompanyManagementMapper.xml, backend-spring/src/main/resources/mapper/SystemNoticeMapper.xml, backend-spring/src/main/resources/mapper/DataAdvancedMapper.xml, backend-spring/src/main/resources/mapper/WorkHistoryMapper.xml, backend-spring/src/main/resources/mapper/CategoryValueCascadingMapper.xml
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- context: |
    task-1과 동일한 포맷팅 규칙 적용. 기능 변경 없이 포맷만 변경.

### task-12: XML 파일명 변경 + application.yml mapper-locations 수정 [backend]
- depends: task-1, task-2, task-3, task-4, task-5, task-6, task-7, task-8, task-9, task-10, task-11
- done_when: 모든 XML 파일명이 소문자 덕일 스타일로 변경
- files: backend-spring/src/main/resources/mapper/, backend-spring/src/main/resources/application.yml
- test: cd backend-spring && ls src/main/resources/mapper/ | grep -c "Mapper" | xargs test 0 -eq
- context: |
    XML 파일명을 PascalCase+Mapper에서 덕일 스타일 소문자로 변경.

    변경 규칙: PascalCase에서 "Mapper" 제거 후 camelCase.
    AdminMapper.xml → admin.xml
    TodoMapper.xml → todo.xml
    CommonMapper.xml → common.xml
    AuthMapper.xml → auth.xml
    DataAdvancedMapper.xml → dataAdvanced.xml
    TableCategoryValueMapper.xml → tableCategoryValue.xml
    ScreenManagementMapper.xml → screenManagement.xml
    ... (96개 전부 동일 규칙)

    application.yml의 mapper-locations는 classpath:mapper/*.xml 이므로
    파일명만 바꾸면 자동으로 인식됨. 변경 불필요.

    ★ 주의: 파일 내부의 namespace, refid 등은 이미 소문자로 변환 완료.
    ★ git mv를 사용하여 이력 보존할 것.

### task-13: 전체 빌드 검증 [backend]
- depends: task-12
- done_when: bootJar 성공
- files: backend-spring/build.gradle
- test: cd backend-spring && ./gradlew compileJava 2>&1 | tail -20
- verify: cd backend-spring && ./gradlew bootJar 2>&1 | tail -20
- context: |
    XML 포맷팅 + 파일명 변경 후 bootJar 빌드 통과 확인.
    SQL 로직이 변경되지 않았으므로 컴파일만 통과하면 정상.
