비공개 메모 기능 추가 + 아이콘 개선
- 식당별 1:1 비공개 메모 CRUD (user_memos 테이블) - 내 기록에 리뷰/메모 탭 분리 - 백오피스 유저 관리에 메모 수/상세 표시 - 리뷰/메모 작성 시 현재 날짜 기본값 - 지도우선/목록우선 버튼 Material Symbols 아이콘 적용 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tasteby.mapper.MemoMapper">
|
||||
|
||||
<resultMap id="memoResultMap" type="com.tasteby.domain.Memo">
|
||||
<id property="id" column="id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="restaurantId" column="restaurant_id"/>
|
||||
<result property="rating" column="rating"/>
|
||||
<result property="memoText" column="memo_text" typeHandler="com.tasteby.config.ClobTypeHandler"/>
|
||||
<result property="visitedAt" column="visited_at"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
<result property="restaurantName" column="restaurant_name"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByUserAndRestaurant" resultMap="memoResultMap">
|
||||
SELECT id, user_id, restaurant_id, rating, memo_text,
|
||||
visited_at, created_at, updated_at
|
||||
FROM user_memos
|
||||
WHERE user_id = #{userId} AND restaurant_id = #{restaurantId}
|
||||
</select>
|
||||
|
||||
<insert id="insertMemo">
|
||||
INSERT INTO user_memos (id, user_id, restaurant_id, rating, memo_text, visited_at)
|
||||
VALUES (#{id}, #{userId}, #{restaurantId}, #{rating}, #{memoText},
|
||||
<choose>
|
||||
<when test="visitedAt != null">TO_DATE(#{visitedAt}, 'YYYY-MM-DD')</when>
|
||||
<otherwise>NULL</otherwise>
|
||||
</choose>)
|
||||
</insert>
|
||||
|
||||
<update id="updateMemo">
|
||||
UPDATE user_memos SET
|
||||
rating = #{rating},
|
||||
memo_text = #{memoText},
|
||||
visited_at = <choose>
|
||||
<when test="visitedAt != null">TO_DATE(#{visitedAt}, 'YYYY-MM-DD')</when>
|
||||
<otherwise>NULL</otherwise>
|
||||
</choose>,
|
||||
updated_at = SYSTIMESTAMP
|
||||
WHERE user_id = #{userId} AND restaurant_id = #{restaurantId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMemo">
|
||||
DELETE FROM user_memos WHERE user_id = #{userId} AND restaurant_id = #{restaurantId}
|
||||
</delete>
|
||||
|
||||
<select id="findByUser" resultMap="memoResultMap">
|
||||
SELECT m.id, m.user_id, m.restaurant_id, m.rating, m.memo_text,
|
||||
m.visited_at, m.created_at, m.updated_at,
|
||||
r.name AS restaurant_name
|
||||
FROM user_memos m
|
||||
LEFT JOIN restaurants r ON r.id = m.restaurant_id
|
||||
WHERE m.user_id = #{userId}
|
||||
ORDER BY m.updated_at DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user