- quick_entry 테이블 + 도메인/매퍼/서비스/컨트롤러 (/account/quick-entries CRUD) - /account/entries/parse: 문자·푸시 텍스트를 파서로 분석해 결과만 반환(저장X) → iPhone 등 알림 자동수집 불가 시 복사→붙여넣기 자동채움용 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -114,6 +114,22 @@ CREATE TABLE IF NOT EXISTS account_category (
|
||||
-- 대/소분류 계층 추가(기존 DB 마이그레이션) — 소분류 이름은 그대로, parent_id 만 부여
|
||||
ALTER TABLE account_category ADD COLUMN IF NOT EXISTS parent_id BIGINT NULL COMMENT '대분류 id. NULL=대분류, 값=소분류';
|
||||
|
||||
-- 자주 쓰는 내역(빠른 등록 템플릿) — 사용자별. 칩 탭 시 오늘 날짜로 즉시 등록.
|
||||
CREATE TABLE IF NOT EXISTS quick_entry (
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
member_id BIGINT NOT NULL COMMENT '소유자 member.id',
|
||||
label VARCHAR(50) NULL COMMENT '칩 표시 이름(없으면 분류/메모 사용)',
|
||||
type VARCHAR(10) NOT NULL COMMENT 'INCOME / EXPENSE',
|
||||
category VARCHAR(50) NULL,
|
||||
amount BIGINT NOT NULL,
|
||||
memo VARCHAR(255) NULL,
|
||||
wallet_id BIGINT NULL COMMENT '출금/입금 계좌(account_wallet 등) id',
|
||||
sort_order INT NOT NULL DEFAULT 0,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_quick_entry_member (member_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 기본(디폴트) 분류 — 전체 사용자 공용 템플릿(관리자 관리). 사용자가 '기본 분류 불러오기'로 자기 분류에 복사.
|
||||
CREATE TABLE IF NOT EXISTS default_category (
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"https://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sb.web.account.mapper.QuickEntryMapper">
|
||||
|
||||
<resultMap id="quickResultMap" type="com.sb.web.account.domain.QuickEntry">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="label" column="label"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="memo" column="memo"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
<result property="sortOrder" column="sort_order"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="walletName" column="wallet_name"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByMember" parameterType="long" resultMap="quickResultMap">
|
||||
SELECT q.id, q.member_id, q.label, q.type, q.category, q.amount, q.memo,
|
||||
q.wallet_id, q.sort_order, q.created_at, w.name AS wallet_name
|
||||
FROM quick_entry q
|
||||
LEFT JOIN wallet w ON w.id = q.wallet_id AND w.member_id = q.member_id
|
||||
WHERE q.member_id = #{memberId}
|
||||
ORDER BY q.sort_order, q.id
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="quickResultMap">
|
||||
SELECT id, member_id, label, type, category, amount, memo, wallet_id, sort_order, created_at
|
||||
FROM quick_entry
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.QuickEntry"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO quick_entry (member_id, label, type, category, amount, memo, wallet_id, sort_order, created_at)
|
||||
VALUES (#{memberId}, #{label}, #{type}, #{category}, #{amount}, #{memo}, #{walletId}, #{sortOrder}, NOW())
|
||||
</insert>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM quick_entry WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<select id="maxSortOrder" resultType="java.lang.Integer">
|
||||
SELECT MAX(sort_order) FROM quick_entry WHERE member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user