๊ฐœ๋ฐœ์ผ์ง€-30 [๐ŸŒฏ๋ฉ”๋‰ด๋„๋ฉ”์ธ(๊ตฌ๋งค์ž): ๋ฉ”๋‰ด ์ƒ์„ธ ์ •๋ณด]

๊น€์„ฑ์ธยท2023๋…„ 9์›” 22์ผ
0

  • ํŒ๋งค์ž์˜ ๊ฐ€๊ฒŒ์— ๋‚˜ํƒ€๋‚˜๋Š” ๋ฉ”๋‰ด๋“ค์€ ๋ชจ๋‘ ๋‹น์ผ ๋–จ์ด๋ฉ”๋‰ด๋ฅผ ๋“ฑ๋กํ–ˆ์„๋•Œ ๋‚˜ํƒ€๋‚œ๋‹ค.
  • ์‚ฌ์žฅ๋‹˜๋“ค์˜ ์ž์œ ๋กœ์šด ๋“ฑ๋ก๊ณผ, ์†Œ๋น„์ž๋“ค์ด ํ•ด๋‹น ์Œ์‹์ค‘ ์›ํ•˜๋Š”๊ฒŒ ์žˆ๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Œ.
  • ๋ฉ”๋‰ด ๋ชฉ๋ก์—์„œ ๋ฉ”๋‰ด ํด๋ฆญ์‹œ ํ•ด๋‹น ๋ฉ”๋‰ด์˜ ์ƒ์„ธ ์ •๋ณด๋ฅผ ํ™•์ธํ•œ๋‹ค.
  • ์žฅ๋ฐ”๊ตฌ๋‹ˆ ๋‹ด๊ธฐ ์ „ ํ™”๋ฉด!

1. [GET] /jat/app/menus/detail

  • ์‘๋‹ต ๋ฐ”๋””
    ๋ฉ”๋‰ด ์ •๋ณด์— +๊ตฌ์„ฑ ์ด ์ถ”๊ฐ€ ๋˜์—ˆ๋‹ค.
    ๋ฉ”๋‰ด ์ด๋ฆ„, ํ•ด๋‹น ๋–จ์ด๋ฉ”๋‰ด Idx, ๋‚จ์€ ๊ฐœ์ˆ˜, ๊ตฌ์„ฑ, ์„ค๋ช…, ์›๊ฐ€, ํ• ์ธ๋น„์œจ, ํ• ์ธ ๊ฐ€๊ฒฉ
  • ์ปจํŠธ๋กค๋Ÿฌ
  • ์„œ๋น„์Šค
    public GetMenuDetailInfoRes getMenuDetailInfo(int todaymenuIdx) throws BaseException{//getMenuDetailInfo
        //๋ฉ”๋‰ด ํด๋ฆญํ–ˆ์„๋•Œ ์ •๋ณด ๊ฐ€์ง€๊ณ  ์˜ค๊ธฐ
        //์ฟผ๋ผ์ŠคํŠธ๋ง์œผ๋กœ ํ•˜๋‚˜์˜ ๋–จ์ด๋ฉ”๋‰ด์™€ ํ•ด๋‹น ์Šคํ† ์–ด idx๋ฅผ ๊ฐ€์ง€๊ณ  ์™€์•ผํ•จ ๊ฐ€์ง€๊ณ  ์™€์•ผํ•จ
        try {
            GetMenuDetailInfoRes getMenuDetailInfoRes= appMenuDao.getMenuDetailInfo(todaymenuIdx);
            if (getMenuDetailInfoRes.getMenuUrl() != null && !getMenuDetailInfoRes.equals(""))
                getMenuDetailInfoRes.setMenuUrl("" + s3Client.getUrl(bucketName, getMenuDetailInfoRes.getMenuUrl()));
           return getMenuDetailInfoRes;
        }catch (Exception e){
            throw new BaseException(POST_STORES_NOT_REGISTERD); // 2030 : ์‚ฌ์šฉ์ž์˜ ๊ฐ€๊ฒŒ๊ฐ€ ๋“ฑ๋ก๋˜์–ด์žˆ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
        }
    }
  • Dao
	public GetMenuDetailInfoRes getMenuDetailInfo(int todaymenuIdx){

        String query ="SELECT m.storeIdx, tm.todaymenuIdx, m.menu_url, m.menu_name, tm.remain,\n" +
                "    m.composition, m.description, m.price, tm.discount, tm.price AS price_today\n" +
                "FROM TodayMenu tm\n" +
                "JOIN Menu m ON m.menuIdx = tm.menuIdx\n" +
                "WHERE tm.todaymenuIdx = ?"; //์กฐ์ธํ• ๋•Œ๋Š” ํˆฌ๋ฐ์ด๋ฉ”๋‰ด์•„์ด๋””์—‘์Šค ๊ธฐ์ค€

        return this.jdbcTemplate.queryForObject(query,
                (rs, rowNum) -> new GetMenuDetailInfoRes(
                        rs.getInt("storeIdx"),
                        rs.getInt("todaymenuIdx"),
                        rs.getString("menu_url"),
                        rs.getString("menu_name"),
                        rs.getInt("remain"),
                        rs.getString("composition"),
                        rs.getString("description"),
                        rs.getInt("price"),
                        rs.getInt("discount"),
                        rs.getInt("price_today")

                ),todaymenuIdx);
    }

ํ…Œ์ŠคํŠธ

  1. ๋ฉ”๋‰ด ์กฐํšŒ๋ฅผ ํ†ตํ•ด์„œ ๋–จ์ด ๋ฉ”๋‰ด Idx๋ฅผ ํ™•์ธ (์†Œ๊ธˆ ๋ฒ„ํ„ฐ๋กค : 240)
  2. ํ•ด๋‹น Idx๋กœ ์กฐํšŒ
profile
๊ฐœ๋ฐœ์ž๊ฐ€ ๊ฟˆ์ธ 25์‚ด ๋Œ€ํ•™์ƒ์ž…๋‹ˆ๋‹ค.

0๊ฐœ์˜ ๋Œ“๊ธ€