MapleStory Finger Point

๐Ÿ”˜ ํ”„๋กœ์ ํŠธ

[Proejct] ์ฃผ๋ฌธ ์˜ˆ์•ฝ ์‹œ์Šคํ…œ ๊ตฌํ˜„ [1] (์นดํ…Œ๊ณ ๋ฆฌ ๋ถ€๋ถ„)

HYEJU01 2025. 2. 7. 03:15

 

 

๋ชฉ์ฐจ

 

     

     

     

     

    ํ•ด๋‹น ํ”„๋กœ์ ํŠธ๋Š” ์ฃผ๋ฌธ์ œ์ž‘ ์†Œ์ƒ๊ณต์ธ๋“ค์„ ์œ„ํ•œ ์ฃผ๋ฌธ ํ”Œ๋žซํผ ํ”„๋กœ์ ํŠธ์ž…๋‹ˆ๋‹ค.

    ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๊นƒํ—ˆ๋ธŒ๋ฅผ ์ฐธ๊ณ ํ•ด์ฃผ์„ธ์š” :)

    https://github.com/hyejux/Neez

     

    GitHub - hyejux/Neez: ์˜ˆ์•ฝ ์ด์   ๋” ํŽธ๋ฆฌํ•˜๊ฒŒ, ๊ด€๋ฆฌ๋„ ์†์‰ฝ๊ฒŒ NEEZ ์—์„œ ๊ฒฝํ—˜ํ•ด๋ณด์„ธ์š”! ใ€Œ์ฃผ๋ฌธ ์ œ์ž‘ ์˜ˆ

    ์˜ˆ์•ฝ ์ด์   ๋” ํŽธ๋ฆฌํ•˜๊ฒŒ, ๊ด€๋ฆฌ๋„ ์†์‰ฝ๊ฒŒ NEEZ ์—์„œ ๊ฒฝํ—˜ํ•ด๋ณด์„ธ์š”! ใ€Œ์ฃผ๋ฌธ ์ œ์ž‘ ์˜ˆ์•ฝ ์„œ๋น„์Šค "NEEZ "ใ€ - hyejux/Neez

    github.com

     

     


     

     

     

    ํ•ด๋‹น ๊ฒŒ์‹œ๋ฌผ์€ ๊ธฐ๋Šฅ ๊ตฌํ˜„์— ๋Œ€ํ•œ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•ด๋‘์—ˆ์Šต๋‹ˆ๋‹ค.

     

     

     

     

     

    1) ํŽ˜์ด์ง€ ๋””์ž์ธ ๊ตฌ์ƒ

     

    [๊ด€๋ฆฌ์ž ํŽ˜์ด์ง€ ๋””์ž์ธ]

     

     

    ์ดˆ๊ธฐ ๋””์ž์ธ

     

     

    ์™„์„ฑ ๋””์ž์ธ

     

     


     

    [์œ ์ € ํŽ˜์ด์ง€ ๋””์ž์ธ]

     

     

    ์ดˆ๊ธฐ๋””์ž์ธ

     

    ์™„์„ฑ ๋””์ž์ธ

     

     

     


    ์ผ๋‹จ ์ฃผ๋ฌธ์˜ˆ์•ฝ ํผ ํŽ˜์ด์ง€ ์ดˆ๊ธฐ ๋””์ž์ธ์€ ์ด๋Ÿฌํ–ˆ๋‹ค. 

     

    ๋Œ€์ถฉ ์œ ์ €ํŽ˜์ด์ง€๋Š” ๋ฐฐ๋‹ฌ์˜ ๋ฏผ์กฑ + ๋„ค์ด๋ฒ„ ํ”Œ๋ ˆ์ด์Šค๋ฅผ ์ฐธ๊ณ ํ–ˆ๊ณ 

    ๊ด€๋ฆฌ์ž ์ชฝ์€ ์‚ฌ์šฉํ•ด๋ณด์ง€์•Š์•„์„œ ์–ด๋–ค ๋ฐฉ๋ฒ•์ด ์ข‹์€์ง€ ๋ชฐ๋ผ ๊ทธ๋ƒฅ ๋Œ๋ฆฌ๋Š”๋Œ€๋กœ ์ง์ ‘ ๋””์ž์ธํ–ˆ๋‹ค.

     

     

     


     

     

     

    2) ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๊ตฌ์ƒ (์นดํ…Œ๊ณ ๋ฆฌ ๊ณ„์ธต ๊ตฌ์กฐ) 

     

     

     

    ๊ธฐ๋Šฅ ๊ตฌํ˜„ ๊ตฌ์ƒ์€ ํ”„๋กœ์ ํŠธ ์‹œ์ž‘ ์ „์— .. ์ค‘์š”ํ•œ ๋ฉ”์ธ ๊ธฐ๋Šฅ์„ ๋งก์•˜๋˜ ํ„ฐ๋ผ

    ์–ด๋–ค์‹์œผ๋กœ ๊ตฌํ˜„ํ•ด์•ผํ•˜๋‚˜ ๊ณ ๋ฏผ๋„ ์ปธ๊ณ .. ์ฒ˜์Œ ๊ตฌํ˜„ํ•ด๋ณธ ๊ฒƒ์ด๋ผ์„œ ๊ณ ๋ฏผ์ด ์ปธ๋‹ค.. 

     

    ์•„๋ž˜ ๋„์ ์ธ ๊ฒƒ๋“ค์€ ํŒ€์›๋“ค์—๊ฒŒ ๋ฉ”์ธ ๊ธฐ๋Šฅ ๊ตฌํ˜„์— ๋Œ€ํ•ด  ๊ฒ€ํ†  ๋ฐ ์„ค๋ช…์„ ํ•  ๋•Œ ์ž‘์—…ํ•ด๋‘” ๊ฒƒ์ด๋‹ค.. 

    (์ด๋Ÿฐ ๋Š๋‚Œ~ ์œผ๋กœ ์ž‘์—…ํ•  ๊ฒƒ ๊ฐ™๋‹ค๊ณ  ์„ค๋ช…ํ–ˆ์Œ)

     

     

    ์ดˆ๊ธฐ์—๋Š” 

    ์ฃผ๋ฌธ ํผ๋„ ๋Œ€๋ถ„๋ฅ˜์™€ ์ค‘๋ถ„๋ฅ˜ ์†Œ๋ถ„๋ฅ˜๋กœ ๋‚˜๋‰˜๊ธฐ ๋•Œ๋ฌธ์— ์นดํ…Œ๊ณ ๋ฆฌ ๋Š๋‚Œ์œผ๋กœ ๊ตฌํ˜„ํ•˜๋ฉด ๋˜๊ฒ ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋‹ค.

     

    ๋Œ€๋ถ„๋ฅ˜๋Š” ๊ทธ๋Œ€๋กœ ๊ฐ€๊ณ 

    ์ค‘๋ถ„๋ฅ˜๋Š” ๋Œ€๋ถ„๋ฅ˜ ํ‚ค๋ฅผ ๊ฐ€์ ธ๊ฐ€๊ณ 

    ์†Œ๋ถ„๋ฅ˜๋Š” ์ค‘๋ถ„๋ฅ˜ ํ‚ค๋ฅผ ๊ฐ€์ ธ๊ฐ„๋‹ค.

     

    ์œ„ ๋ฐฉ๋ฒ•๋Œ€๋กœ ์ •์„์ ์ธ(?) ๋Š๋‚Œ์œผ๋กœ ํ…Œ์ด๋ธ” 3๊ฐœ๋ฅผ ๋งŒ๋“ค์–ด์„œ ๊ตฌํ˜„ํ•ด๋ณด๋ ค๊ณ ํ–ˆ๋‹ค. (์ •๊ทœํ™”๋œ ๊ณ„์ธต ๋ชจ๋ธ)

     

    ๊ทธ๋Ÿฐ๋ฐ ์ด๋ ‡๊ฒŒ ๊ตฌํ˜„ํ•  ๊ฒฝ์šฐ ์–ด๋ ค์›€์ด JOIN ์ด ๋งŽ์•„์ ธ์„œ ๋„ˆ๋ฌด ๋ณต์žกํ•ด์ง„๋‹ค๋Š” ๊ฒƒ์ด๋‹ค.

    ๊ทธ๋ž˜์„œ ํ…Œ์ด๋ธ” ํ•˜๋‚˜์— level ์ปฌ๋Ÿผ์„ ๋„ฃ์–ด์„œ ๋ถ„๋ฅ˜ํ•˜๊ธฐ๋กœ ํ–ˆ๋‹ค. (ํŠธ๋ฆฌ ๊ณ„์ธต ๊ตฌ์กฐ)

     


     

     

    ์ตœ์ข…

     

    ์ด๋ ‡๊ฒŒ ํŠธ๋ฆฌ ๊ณ„์ธต ๊ตฌ์กฐ๋กœ ๊ตฌํ˜„ํ•˜๋Š” ๊ฒฝ์šฐ

     

    ์žฅ์ 

    1) JOIN ์ด ์—†์–ด ๋งค์šฐ ํŽธ๋ฆฌํ•˜๊ณ 

    2) ์ „๋ฐ˜์ ์œผ๋กœ ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ๊ฐ€ ์‰ฝ๋‹ค.

    3) 123๋‹จ๊ณ„ ๋ฟ๋งŒ์•„๋‹ˆ๋ผ 45๋‹จ๊ณ„๊นŒ์ง€ ๊นŠ์€ ๊ตฌ์กฐ๊นŒ์ง€ ๊ตฌํ˜„ ๊ฐ€๋Šฅ.

     

    ๋‹จ์ 

    1) ๊ณ„์ธตํ˜• ๋ฐ์ดํ„ฐ๋ผ ์ฟผ๋ฆฌ๊ฐ€ ์–ด๋ ค์›Œ์ง„๋‹ค. (์žฌ๊ท€ ์ฟผ๋ฆฌ๊ฐ€ ํ•„์š”ํ•  ์ˆ˜ ์žˆ์Œ) -> ์˜คํžˆ๋ ค  JOIN ๋ณด๋‹ค ์–ด๋ ค์šด ์ฟผ๋ฆฌ๊ฐ€ ๋ฐœ์ƒํ• ์ง€๋„.. 

    2) ํŠธ๋ฆฌ ๊ตฌ์กฐ๊ฐ€ ๊นŠ์œผ๋ฉด ์žฌ๊ท€ ์ฟผ๋ฆฌ ์„ฑ๋Šฅ์ด ์ €ํ•˜ ์šฐ๋ ค

     

     

    ์นดํ…Œ๊ณ ๋ฆฌ ๊ฐœ์ˆ˜๊ฐ€ ๋งŽ์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋Š” ํ•ด๋‹น ๋ฐฉ๋ฒ•๋„ ๋‚˜์˜์ง€ ์•Š๋‹ค๊ณ  ํŒ๋‹จํ–ˆ๊ณ ..

    ์—ฌ๋Ÿฌํ…Œ์ด๋ธ”๋กœ JOIN ์ด ๋งŽ์•„์ง€๋Š”๊ฒŒ ๋ฒˆ๊ฑฐ๋กœ์› ๊ธฐ ๋•Œ๋ฌธ์—

    ํ•œ ํ…Œ์ด๋ธ”์—์„œ ๊ด€๋ฆฌํ•˜๊ธฐ๋กœ ๋งˆ์Œ ๋จน์—ˆ๋‹ค. 

     

     

     


     

     

    category ํ…Œ์ด๋ธ”

     

     



    ์ž˜ ์•ˆ๋ณด์ด๋‹ˆ ํ™•๋Œ€

     

    ๋จผ์ € ์นดํ…Œ๊ณ ๋ฆฌ์— ๋ชจ๋“  ์นดํ…Œ๊ณ ๋ฆฌ ๋ ˆ๋ฒจ๋“ค์„ ๋„ฃ๊ฒŒ๋œ๋‹ค. 

    category_level ์—๋Š” 1,2,3 ์œผ๋กœ ๋Œ€๋ถ„๋ฅ˜, ์ค‘๋ถ„๋ฅ˜, ์†Œ๋ถ„๋ฅ˜๋ฅผ ๊ตฌ๋ถ„ํ•œ๋‹ค.

     

     

     

     

     

    sub_category_status ํ…Œ์ด๋ธ”

     

     

     

    ๊ทธ๋ฆฌ๊ณ  ์ค‘๋ถ„๋ฅ˜ ์ƒํƒœ๊ฐ’ ํ…Œ์ด๋ธ”์„ ๋”ฐ๋กœ ๋บ๋Š”๋ฐ

    ํ•ด๋‹น ํ…Œ์ด๋ธ”์€ ๋ ˆ๋ฒจ์ด 2์ธ (์ค‘๋ถ„๋ฅ˜) ์— ํ•ด๋‹นํ•˜๋Š” ๊ฐ’๋“ค์˜ TYPE ์„ ํ‘œํ˜„ํ•œ๋‹ค.

     

     

     

     

     

    ์„ ํƒ(ํ•˜๋‚˜,๋‹ค์ค‘) , ์ˆซ์ž, ํ…์ŠคํŠธ  | ์œ ๋ฃŒ,๋ฌด๋ฃŒ | ํ•„์ˆ˜,์„ ํƒ

    ์˜ ์˜ต์…˜ ๊ฐ’์„ ์ €์žฅํ•˜๋Š” ํ…Œ์ด๋ธ”์ด๋ผ๊ณ  ๋ณด๋ฉด ๋˜๊ฒ ๋‹ค. 

     

     

     

     

    category_img ํ…Œ์ด๋ธ”

    ๋Œ€๋ถ„๋ฅ˜์—๋งŒ ์‚ฌ์ง„์„ 1๊ฐœ์”ฉ๋งŒ ๋„ฃ์„ ์ˆ˜ ์žˆ๊ฒŒ ๊ตฌํ˜„ํ–ˆ๋‹ค. 

    ๊ทธ๋ž˜์„œ level 1 ์ธ ๋Œ€๋ถ„๋ฅ˜ ๊ฐ’๊ณผ 1:1 ๋Œ€์‘ํ•œ๋‹ค. 

     


     

    3) ๊ธฐ๋Šฅ ๊ตฌํ˜„ (์ฝ”๋“œ) - ๊ด€๋ฆฌ์ž Part 

     

    INSERT

     

     

     

    ํ”„๋ก ํŠธ์—์„œ๋Š” ์•„๋ž˜์™€ ๊ฐ™์€ JSON ํ˜•ํƒœ๋กœ ์„œ๋ฒ„๋กœ ์š”์ฒญ์ด ์˜จ๋‹ค.

     

     

     

     

     JSON ๊ตฌ์กฐ

     

    `๋Œ€๋ถ„๋ฅ˜` ๊ธฐ์ค€์œผ๋กœ `์ค‘๋ถ„๋ฅ˜ ๋ฐฐ์—ด` ์•ˆ์— `์†Œ๋ถ„๋ฅ˜ ๋ฐฐ์—ด`

    {
        "serviceName": "ํ™”์ดํŠธ ์ดˆ์ฝœ๋ฆฟ ์ผ€์ดํฌ",
        "servicePrice": "12000",
        "serviceContent": "๋‹ฌ์ฝคํ•œ ํ™”์ดํŠธ ์ดˆ์ฝœ๋ฆฟ ์ผ€์ดํฌ",
        "categories": [
            {
                "serviceName": "ํฌ์žฅ์œ ๋ฌด",
                "servicePrice": 0,
                "isPaid": "N",
                "isRequired": "Y",
                "subCategoryType": "SELECT1",
                "subCategories": [
                    {
                        "serviceName": "X",
                        "servicePrice": 0
                    },
                    {
                        "serviceName": "O",
                        "servicePrice": 0
                    }
                ]
            }
        ],
        "serviceStart": "2025-02-07T00:00",
        "dateNumCase": 10,
        "timeNumCase": 0,
        "storeNo": "1"
    }

     

     

     

    DTO 

    package com.example.HiMade.admin.dto;
    
    
    import com.fasterxml.jackson.annotation.JsonProperty;
    import lombok.*;
    
    import java.time.LocalDate;
    import java.time.LocalDateTime;
    import java.util.List;
    
    @AllArgsConstructor
    @NoArgsConstructor
    @Getter
    @Setter
    @ToString
    @Builder
    public class adminReserveAdd {
    
      private String serviceName;
      private int servicePrice;
      private String serviceContent;
      private List<adminRSDTO> categories;
      private LocalDateTime serviceStart;
      private Integer dateNumCase;
      private Integer timeNumCase;
      private Integer storeNo;
      private String storeId;
      private Integer categoryId;
      private LocalDate reservationSlotDate;
    }

     

    package com.example.HiMade.admin.dto;
    
    import lombok.*;
    
    import java.util.List;
    
    @AllArgsConstructor
    @NoArgsConstructor
    @Getter
    @Setter
    @ToString
    public class adminRSDTO {
      private int middleId; // sql
      private int subId;
    
      private int categoryId;
      private int storeNo;
      private int categoryLevel; // 1,2,3
      private int parentCategoryId; // {cateId}
    
      private int categoryStatus; //id
      private String serviceName;
      private int servicePrice;
      private String serviceContent;
    
      private String subCategoryType;
      private String isRequired;
      private String isPaid;
    
      private List<adminReservationDTO> subCategories;
    }

     

    package com.example.HiMade.admin.dto;
    
    import lombok.*;
    
    import java.time.LocalDate;
    import java.time.LocalDateTime;
    
    @AllArgsConstructor
    @NoArgsConstructor
    @Getter
    @Setter
    @ToString
    @Builder
    public class adminReservationDTO {
    
      private int categoryId;
      private int categoryLevel;
      private int parentCategoryId;
      private String serviceName;
      private int servicePrice;
      private String serviceContent;
      private int storeNo;
      private LocalDateTime ServiceStart;
      private String imageUrl;
      private String activated;
      private Integer orderIndex;
    
    }

     

     

     

     

     

    ๋Œ€๋ถ„๋ฅ˜ ์‚ฝ์ž…

     

     

     

     

        <!--  ์„œ๋น„์Šค (๋Œ€๋ถ„๋ฅ˜) ๋“ฑ๋กํ•˜๊ธฐ    -->
        <insert id="setMainCategory" parameterType="com.example.HiMade.admin.dto.adminReservationDTO" useGeneratedKeys="true" keyProperty="categoryId">
            INSERT INTO category (category_level, service_name, service_price, service_content,store_no, service_start, activated)
            VALUES (1, #{serviceName}, #{servicePrice}, #{serviceContent},  #{storeNo}, #{serviceStart} , 'Y')
            RETURNING category_id
        </insert>

     

     

    level 1 ๋กœ ๋“ค์–ด๊ฐˆ ๋Œ€๋ถ„๋ฅ˜์— ํ•„์š”ํ•œ ๊ฐ’๋“ค์„ ๋„ฃ๊ณ  ๋จผ์ € INSTERT ํ›„ `category_id` ๋ฅผ ๋ฐ˜ํ™˜ ๋ฐ›๋Š”๋‹ค.

     

    `useGeneratedKeys="true"` : ์ž๋™์ƒ์„ฑ๋œ ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฝ์ž… ๋ฐ์ดํ„ฐ ์ถ”์ 

    ` keyProperty="categoryId"` : ์ž๋™ ์ƒ์„ฑ๋œ ํ‚ค ๊ฐ’์„ ์ €์žฅํ•  dto ํ•„๋“œ ๋ช… ์ง€์ •

    `RETURNING category_id` : sql ์‚ฝ์ž… ํ›„ ์ƒ์„ฑ ๋œ ๊ฐ’์„ ๋ฐ˜ํ™˜ (์นดํ…Œ๊ณ ๋ฆฌ ํ‚ค ๊ฐ€์ ธ์˜ค๋Š” ์šฉ๋„)

     

     

     

     

     

    ์ค‘๋ถ„๋ฅ˜ & ์†Œ๋ถ„๋ฅ˜ ์‚ฝ์ž… 

     

        List<adminRSDTO> categories = dto.getCategories(); // ์ค‘๋ถ„๋ฅ˜ LIST ๊ฐ€์ ธ์˜ค๊ธฐ
        
        for (adminRSDTO category : categories) { // ์ค‘๋ถ„๋ฅ˜ LIST ์ˆœํšŒ
          category.setStoreNo(dto.getStoreNo()); 
          category.setParentCategoryId(serviceId); // ๋Œ€๋ถ„๋ฅ˜ ID๋ฅผ ์นดํ…Œ๊ณ ๋ฆฌ์— ์„ค์ •
          
          int serviceId2 = adminReservationMapper.setMainCategory2(category); // ์ค‘๋ถ„๋ฅ˜ INSERT
          
          adminReservationMapper.setMainCategory3(category); // ์ค‘๋ถ„๋ฅ˜ ์ƒํƒœ  INSERT
    	
          List<adminReservationDTO> subCategories = category.getSubCategories(); // ์†Œ๋ถ„๋ฅ˜ LIST ๊ฐ€์ ธ์˜ค๊ธฐ
    
          for (adminReservationDTO subcategory : subCategories) {
            subcategory.setStoreNo(dto.getStoreNo());
            subcategory.setParentCategoryId(serviceId2); // ์‚ฝ์ž…๋œ ์ค‘๋ถ„๋ฅ˜ ์•„์ด๋””๋ฅผ ๋ถ€๋ชจ ์•„์ด๋””๋กœ ๊ฐ€์ง€๊ณ  ๊ฐ
            adminReservationMapper.setMainCategory4(subcategory); // ์†Œ๋ถ„๋ฅ˜ insert
          }
        }

     

     

    ์ดํ›„ ์ค‘๋ถ„๋ฅ˜ LIST ๋ฅผ ์ˆœํšŒํ•˜๋ฉด์„œ ์ค‘๋ถ„๋ฅ˜์™€ ์ค‘๋ถ„๋ฅ˜ ์ƒํƒœ๋ฅผ ์‚ฝ์ž…ํ•ด์ฃผ๊ณ 

    ๊ฐ ์ค‘๋ถ„๋ฅ˜์— ํ•ด๋‹นํ•˜๋Š” ์†Œ๋ถ„๋ฅ˜๋„ ์‚ฝ์ž…ํ•ด์ค€๋‹ค. 

    (๋Œ€๋ถ„๋ฅ˜์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์‚ฝ์ž… ํ›„ PK ๊ฐ’ ๋ฐ˜ํ™˜ํ•ด์™€์„œ ์‚ฌ์šฉ)

     

    	<!--  ์„œ๋น„์Šค (์ค‘๋ถ„๋ฅ˜) ๋“ฑ๋กํ•˜๊ธฐ    -->
        <insert id="setMainCategory2" parameterType="com.example.HiMade.admin.dto.adminRSDTO" useGeneratedKeys="true" keyProperty="middleId">
            INSERT INTO category (category_level, parent_category_id, service_name, service_price, store_no)
            VALUES (2, #{parentCategoryId}, #{serviceName}, #{servicePrice},#{storeNo})
            RETURNING category_id
        </insert>
    
        <!--  ์„œ๋น„์Šค (์ค‘๋ถ„๋ฅ˜ ์ƒํƒœ๊ฐ’ ) ๋“ฑ๋กํ•˜๊ธฐ    -->
        <insert id="setMainCategory3" parameterType="com.example.HiMade.admin.dto.adminRSDTO">
            INSERT INTO sub_category_status (category_id, sub_category_type, is_required, is_paid)
            VALUES (#{middleId}, #{subCategoryType}, #{isRequired}, #{isPaid});
        </insert>
    
        <!--  ์„œ๋น„์Šค (์†Œ๋ถ„๋ฅ˜) ๋“ฑ๋กํ•˜๊ธฐ    -->
        <insert id="setMainCategory4" parameterType="com.example.HiMade.admin.dto.adminReservationDTO">
            INSERT INTO category (category_level, parent_category_id, service_name, service_price, store_no)
            VALUES (3, #{parentCategoryId}, #{serviceName}, #{servicePrice}, #{storeNo})
        </insert>

     

     

     

    ๋กœ๊ทธ

    adminReserveAdd(serviceName=ํ™”์ดํŠธ ์ดˆ์ฝœ๋ฆฟ ์ผ€์ดํฌ, servicePrice=12000, serviceContent=๋‹ฌ์ฝคํ•œ ํ™”์ดํŠธ ์ดˆ์ฝœ๋ฆฟ ์ผ€์ดํฌ, categories=[adminRSDTO(middleId=0, subId=0, categoryId=0, storeNo=0, categoryLevel=0, parentCategoryId=0, categoryStatus=0, serviceName=ํฌ์žฅ์œ ๋ฌด, servicePrice=0, serviceContent=null, subCategoryType=SELECT1, isRequired=Y, isPaid=N, subCategories=[adminReservationDTO(categoryId=0, categoryLevel=0, parentCategoryId=0, serviceName=X, servicePrice=0, serviceContent=null, storeNo=0, ServiceStart=null, imageUrl=null, activated=null, orderIndex=null), adminReservationDTO(categoryId=0, categoryLevel=0, parentCategoryId=0, serviceName=O, servicePrice=0, serviceContent=null, storeNo=0, ServiceStart=null, imageUrl=null, activated=null, orderIndex=null)])], ServiceStart=2025-02-07T00:00, DateNumCase=10, TimeNumCase=0, StoreNo=1, StoreId=null, categoryId=null, reservationSlotDate=null)
    
    ๋ฉ”์ธ ์นดํ…Œ๊ณ ๋ฆฌ ์‚ฝ์ž… ํ›„ ์•„์ด๋””  : 59
    ์ค‘๋ถ„๋ฅ˜ ์นดํ…Œ๊ณ ๋ฆฌ ์‚ฝ์ž… ํ›„ : 60
    
    adminReservationDTO(categoryId=0, categoryLevel=0, parentCategoryId=0, serviceName=X, servicePrice=0, serviceContent=null, storeNo=0, ServiceStart=null, imageUrl=null, activated=null, orderIndex=null)
    ์†Œ๋ถ„๋ฅ˜ ์‚ฝ์ž…๋จ 1
    adminReservationDTO(categoryId=0, categoryLevel=0, parentCategoryId=0, serviceName=O, servicePrice=0, serviceContent=null, storeNo=0, ServiceStart=null, imageUrl=null, activated=null, orderIndex=null)
    ์†Œ๋ถ„๋ฅ˜ ์‚ฝ์ž…๋จ 2

     

     


     

    SELECT 

     

     

      @Override
      public adminReservationDTO getListDetail(int id) {
        return adminReservationMapper.getListDetail(id);
      }
    
      @Override
      public List<adminRSDTO> getMiddleItem(int id) {
    
        List<adminRSDTO> dto = adminReservationMapper.getMiddleItem(id);
        System.out.println("service dto ::  " + dto );
    
        for (adminRSDTO d : dto ){
          System.out.println(d);
          System.out.println();
          d.setSubCategories(adminReservationMapper.getSubItem(d.getCategoryId()));
        }
    
        System.out.println(dto);
        return dto;
      }

     

     useEffect(() => {
        axios
          .get(`/adminReservation/getListDetail/${cateId}`)
          .then(response => {
          
            console.log(response.data);
            setReserveModi(response.data);
            
            const { imageUrl,serviceContent,serviceName,servicePrice,serviceStart} = response.data; 
            setImagePreview(imageUrl);
            setName(serviceName);
            setPrice(servicePrice);
            setDescription(serviceContent);
            setServiceStart(serviceStart);
          })
          .catch(error => {
            console.log('์—๋Ÿฌ', error);
          });
    
          axios
          .get(`/adminReservation/getMiddleItem/${cateId}`)
          .then(response => {
            console.log("get"  + JSON.stringify(response.data));
            
            const transformedData = response.data.map(item => ({
              serviceName: item.serviceName, // serviceName -> name
              servicePrice: item.servicePrice, // servicePrice -> price
              isPaid: item.isPaid === 'Y', // isPaid ("Y"/"N") -> true/false
              isRequired: item.isRequired === 'Y', // isRequired ("Y"/"N") -> true/false
              subCategoryType: item.subCategoryType, // subCategoryType -> inputType
              subCategories: item.subCategories.map(sub => ({
                serviceName: sub.serviceName,
                servicePrice: sub.servicePrice
              }))
            }));
            setCategories(transformedData);
          })
          .catch(error => {
            console.log('์—๋Ÿฌ', error);
          });
      }, [cateId]);

     

        <!--  ์„œ๋น„์Šค ๋Œ€๋ถ„๋ฅ˜ (์ƒ์„ธ ๊ฐ€์ ธ์˜ค๊ธฐ)  -->
        <select id="getListDetail" resultType="com.example.HiMade.admin.dto.adminReservationDTO">
            select c.category_id, c.category_level, c.parent_category_id, c.service_name , c.service_price, c.service_content, c.store_no, ci.image_url,  c.service_start
            from category c
            left join category_image ci
            on c.category_id = ci.category_id
            where c.category_level = 1 AND  c.category_id = #{id}
        </select>
    
        <!--   ์„œ๋น„์Šค ์ค‘๋ถ„๋ฅ˜ ๊ฐ€์ ธ์˜ค๊ธฐ  -->
        <select id="getMiddleItem" resultType="com.example.HiMade.admin.dto.adminRSDTO">
            select c.category_id, c.category_level, c.parent_category_id, c.service_name , c.service_price, c.service_content, c.store_no, sc.category_status, sc.category_id, sc.sub_category_type, sc.is_required, sc.is_paid
            from category c
            LEFT join sub_category_status sc
            on c.category_id = sc.category_id
            WHERE c.parent_category_id = #{id}  AND c.category_level = 2
        </select>
        <!--  ์„œ๋น„์Šค ์†Œ๋ถ„๋ฅ˜ ๊ฐ€์ ธ์˜ค๊ธฐ   -->
        <select id="getSubItem" resultType="com.example.HiMade.admin.dto.adminReservationDTO">
            select * from category c
            where parent_category_id = #{id} AND category_level = 3;
        </select>

     

     

    ์กฐํšŒ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ๋Œ€๋ถ„๋ฅ˜ ์™€ ์ค‘๋ถ„๋ฅ˜|์†Œ๋ถ„๋ฅ˜๋ฅผ ๋‚˜๋ˆ ์„œ ๊ฐ€์ ธ์™”๋‹ค.

    (ํ•ด๋‹น ์ฟผ๋ฆฌ๋Š” ์ƒ๋‹นํžˆ ๋น„ํšจ์œจ์ ์ธ ๊ฒƒ ๊ฐ™์•„์„œ JOIN ์„ ์ด์šฉํ•ด ํ•œ๋ฒˆ์— ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ์‹์„ ์—ฐ์Šตํ•ด๋ด์•ผ๊ฒ ์Œ)

     

     

     

     

    UPDATE

     

    ์ด๊ฑด ๊ทธ๋ƒฅ ๊ธฐ์กด ๊ฐ’์„ ์ œ๊ฑฐํ•˜๊ณ  ์ƒˆ๋กœ ์‚ฝ์ž…ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ตฌํ˜„ํ–ˆ๋‹ค. 

    (์ˆ˜์ • ๊ธฐ๋Šฅ ๊ตฌํ˜„์ด ๋„ˆ๋ฌด.. ํž˜๋“ค์—ˆ๋‹ค... )

     

     

     

    DELETE

     

    ์ด๊ฑด ๋Œ€๋ถ„๋ฅ˜ ๊ฐ’์˜ `activated` ๊ฐ’์„ Y / N ์œผ๋กœ ํ•ด์„œ ๊ตฌํ˜„ํ–ˆ๋‹ค. 

     

     

     


    4) ๊ธฐ๋Šฅ ๊ตฌํ˜„ (์ฝ”๋“œ) - ์‚ฌ์šฉ์ž Part 

     

     

     

    ์‚ฌ์šฉ์ž ํŒŒํŠธ์—์„œ ์นดํ…Œ๊ณ ๋ฆฌ ์กฐํšŒํ•ด์˜ค๋Š” ๋ฐฉ์‹์€ ๊ด€๋ฆฌ์ž ํŒŒํŠธ์ฒ˜๋Ÿผ ์กฐํšŒ ํ•ด์˜ค๋Š” ๋ฐฉ์‹์€ ๋™์ผํ•˜๊ณ  ๋ณด์—ฌ์ฃผ๋Š” ๋ฐฉ์‹๋งŒ ๋‹ค๋ฅด๋‹ค.

     

     

     

    5) ํ›„๊ธฐ

     

    • โœ… ํ˜„์žฌ ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ SELECT ํ•ด์˜ค๋˜ ์ฟผ๋ฆฌ๋“ค์ด ๋น„ํšจ์œจ์ ์ด๋ฏ€๋กœ, ๋ณด๋‹ค ํšจ์œจ์ ์ธ ์ฟผ๋ฆฌ๋ฅผ ์ž‘์„ฑํ•ด๋ณผ ๊ฒƒ
    • โœ… ํ…Œ์ด๋ธ” ๋‚ด์— ๋„ˆ๋ฌด ๋‹ค์–‘ํ•œ ์ปฌ๋Ÿผ๊ณผ ๋ฐ์ดํ„ฐ๋“ค์ด ํ˜ผ์žฌ๋˜์–ด ์žˆ์œผ๋ฏ€๋กœ, ์ด๋ฅผ ์ž˜ ๋ถ„๋ฅ˜ํ•˜์—ฌ ๊ตฌ์กฐ๋ฅผ ๊ฐœ์„ ํ•ด๋ณผ ๊ฒƒ