feat: 가계부·게시판 백엔드 API 구현

- com.sb.web 패키지로 재구성: account / auth / board / user / admin / common
- 가계부(account): 내역(필터), 계좌·순자산, 예산, 분류, 정기 거래, 투자 포트폴리오
  (종목·매매 이력, 이동평균 평단·실현/평가손익)
- MyBatis + MariaDB + Redis 세션, BCrypt
- 스키마 자동 초기화(db/*.sql, 멱등), 사용자별 데이터 격리(member_id)
- 문서: docs/BACKEND.md, .env.example

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ByungCheol
2026-05-31 15:43:09 +09:00
parent 9243a41385
commit 2a2f81dc32
121 changed files with 5899 additions and 31 deletions
@@ -0,0 +1,62 @@
<?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.BudgetMapper">
<resultMap id="budgetResultMap" type="com.sb.web.account.domain.Budget">
<id property="id" column="id"/>
<result property="memberId" column="member_id"/>
<result property="category" column="category"/>
<result property="fixed" column="fixed"/>
<result property="baseUnit" column="base_unit"/>
<result property="baseAmount" column="base_amount"/>
<result property="daily" column="daily"/>
<result property="weekly" column="weekly"/>
<result property="monthly" column="monthly"/>
<result property="yearly" column="yearly"/>
<result property="createdAt" column="created_at"/>
<result property="updatedAt" column="updated_at"/>
</resultMap>
<sql id="cols">id, member_id, category, fixed, base_unit, base_amount,
daily, weekly, monthly, yearly, created_at, updated_at</sql>
<select id="findByMember" parameterType="long" resultMap="budgetResultMap">
SELECT <include refid="cols"/> FROM budget WHERE member_id = #{memberId} ORDER BY category
</select>
<select id="findByIdAndMember" resultMap="budgetResultMap">
SELECT <include refid="cols"/> FROM budget WHERE id = #{id} AND member_id = #{memberId}
</select>
<select id="countByCategory" resultType="int">
SELECT COUNT(*) FROM budget
WHERE member_id = #{memberId} AND category = #{category}
<if test="excludeId != null">AND id != #{excludeId}</if>
</select>
<insert id="insert" parameterType="com.sb.web.account.domain.Budget"
useGeneratedKeys="true" keyProperty="id">
INSERT INTO budget (member_id, category, fixed, base_unit, base_amount,
daily, weekly, monthly, yearly, created_at, updated_at)
VALUES (#{memberId}, #{category}, #{fixed}, #{baseUnit}, #{baseAmount},
#{daily}, #{weekly}, #{monthly}, #{yearly}, NOW(), NOW())
</insert>
<update id="update" parameterType="com.sb.web.account.domain.Budget">
UPDATE budget
SET category = #{category}, fixed = #{fixed}, base_unit = #{baseUnit}, base_amount = #{baseAmount},
daily = #{daily}, weekly = #{weekly}, monthly = #{monthly}, yearly = #{yearly}
WHERE id = #{id} AND member_id = #{memberId}
</update>
<delete id="delete">
DELETE FROM budget WHERE id = #{id} AND member_id = #{memberId}
</delete>
<update id="renameCategory">
UPDATE budget SET category = #{newName}
WHERE member_id = #{memberId} AND category = #{oldName}
</update>
</mapper>