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:
@@ -0,0 +1,173 @@
|
||||
<?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.AccountEntryMapper">
|
||||
|
||||
<resultMap id="entryResultMap" type="com.sb.web.account.domain.AccountEntry">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="entryDate" column="entry_date"/>
|
||||
<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="walletName" column="wallet_name"/>
|
||||
<result property="toWalletId" column="to_wallet_id"/>
|
||||
<result property="toWalletName" column="to_wallet_name"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="periodFilter">
|
||||
<if test="year != null">AND YEAR(entry_date) = #{year}</if>
|
||||
<if test="month != null">AND MONTH(entry_date) = #{month}</if>
|
||||
</sql>
|
||||
|
||||
<sql id="entryCols">
|
||||
e.id, e.member_id, e.entry_date, e.type, e.category, e.amount, e.memo,
|
||||
e.wallet_id, w.name AS wallet_name,
|
||||
e.to_wallet_id, tw.name AS to_wallet_name,
|
||||
e.created_at, e.updated_at
|
||||
</sql>
|
||||
<sql id="entryJoins">
|
||||
FROM account_entry e
|
||||
LEFT JOIN wallet w ON w.id = e.wallet_id
|
||||
LEFT JOIN wallet tw ON tw.id = e.to_wallet_id
|
||||
</sql>
|
||||
|
||||
<select id="findByMember" resultMap="entryResultMap">
|
||||
SELECT <include refid="entryCols"/>
|
||||
<include refid="entryJoins"/>
|
||||
WHERE e.member_id = #{memberId}
|
||||
<if test="year != null">AND YEAR(e.entry_date) = #{year}</if>
|
||||
<if test="month != null">AND MONTH(e.entry_date) = #{month}</if>
|
||||
<if test="type != null and type != ''">AND e.type = #{type}</if>
|
||||
<if test="category != null and category != ''">AND e.category = #{category}</if>
|
||||
<if test="walletId != null">AND (e.wallet_id = #{walletId} OR e.to_wallet_id = #{walletId})</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND (e.memo LIKE CONCAT('%', #{keyword}, '%') OR e.category LIKE CONCAT('%', #{keyword}, '%'))
|
||||
</if>
|
||||
<if test="tagId != null">
|
||||
AND EXISTS (SELECT 1 FROM account_entry_tag aet WHERE aet.entry_id = e.id AND aet.tag_id = #{tagId})
|
||||
</if>
|
||||
ORDER BY e.entry_date DESC, e.id DESC
|
||||
</select>
|
||||
|
||||
<select id="findByWalletAndMember" resultMap="entryResultMap">
|
||||
SELECT <include refid="entryCols"/>
|
||||
<include refid="entryJoins"/>
|
||||
WHERE e.member_id = #{memberId}
|
||||
AND (e.wallet_id = #{walletId} OR e.to_wallet_id = #{walletId})
|
||||
ORDER BY e.entry_date DESC, e.id DESC
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="entryResultMap">
|
||||
SELECT <include refid="entryCols"/>
|
||||
<include refid="entryJoins"/>
|
||||
WHERE e.id = #{id} AND e.member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<select id="sumByType" resultType="map">
|
||||
SELECT type AS type, COALESCE(SUM(amount), 0) AS total
|
||||
FROM account_entry
|
||||
WHERE member_id = #{memberId}
|
||||
<include refid="periodFilter"/>
|
||||
GROUP BY type
|
||||
</select>
|
||||
|
||||
<select id="sumExpenseByCategory" resultType="map">
|
||||
SELECT COALESCE(category, '') AS category, COALESCE(SUM(amount), 0) AS total
|
||||
FROM account_entry
|
||||
WHERE member_id = #{memberId} AND type = 'EXPENSE'
|
||||
<include refid="periodFilter"/>
|
||||
GROUP BY category
|
||||
</select>
|
||||
|
||||
<select id="sumByCategory" resultType="map">
|
||||
SELECT COALESCE(NULLIF(category, ''), '미분류') AS category, COALESCE(SUM(amount), 0) AS total
|
||||
FROM account_entry
|
||||
WHERE member_id = #{memberId} AND type = #{type}
|
||||
<include refid="periodFilter"/>
|
||||
GROUP BY COALESCE(NULLIF(category, ''), '미분류')
|
||||
ORDER BY total DESC
|
||||
</select>
|
||||
|
||||
<select id="monthlyWalletFlow" resultType="map">
|
||||
SELECT DATE_FORMAT(entry_date, '%Y-%m') AS ym,
|
||||
COALESCE(SUM(CASE WHEN type = 'INCOME' THEN amount
|
||||
WHEN type = 'EXPENSE' THEN -amount
|
||||
ELSE 0 END), 0) AS net
|
||||
FROM account_entry
|
||||
WHERE member_id = #{memberId} AND wallet_id IS NOT NULL AND type IN ('INCOME', 'EXPENSE')
|
||||
GROUP BY ym
|
||||
ORDER BY ym
|
||||
</select>
|
||||
|
||||
<select id="statsByPeriod" resultType="map">
|
||||
SELECT
|
||||
<choose>
|
||||
<when test="unit == 'DAY'">DAY(entry_date)</when>
|
||||
<when test="unit == 'WEEK'">FLOOR((DAY(entry_date) - 1) / 7) + 1</when>
|
||||
<when test="unit == 'YEAR'">YEAR(entry_date)</when>
|
||||
<otherwise>MONTH(entry_date)</otherwise>
|
||||
</choose> AS bucket,
|
||||
COALESCE(SUM(CASE WHEN type = 'INCOME' THEN amount ELSE 0 END), 0) AS income,
|
||||
COALESCE(SUM(CASE WHEN type = 'EXPENSE' THEN amount ELSE 0 END), 0) AS expense
|
||||
FROM account_entry
|
||||
WHERE member_id = #{memberId}
|
||||
<if test="unit == 'DAY' or unit == 'WEEK' or unit == 'MONTH'">AND YEAR(entry_date) = #{year}</if>
|
||||
<if test="unit == 'DAY' or unit == 'WEEK'">AND MONTH(entry_date) = #{month}</if>
|
||||
GROUP BY bucket
|
||||
ORDER BY bucket
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.AccountEntry"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO account_entry (member_id, entry_date, type, category, amount, memo,
|
||||
wallet_id, to_wallet_id, created_at, updated_at)
|
||||
VALUES (#{memberId}, #{entryDate}, #{type}, #{category}, #{amount}, #{memo},
|
||||
#{walletId}, #{toWalletId}, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.account.domain.AccountEntry">
|
||||
UPDATE account_entry
|
||||
SET entry_date = #{entryDate}, type = #{type}, category = #{category},
|
||||
amount = #{amount}, memo = #{memo}, wallet_id = #{walletId}, to_wallet_id = #{toWalletId}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM account_entry WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<select id="findDistinctCategories" resultType="string">
|
||||
SELECT DISTINCT category FROM account_entry
|
||||
WHERE member_id = #{memberId} AND type = #{type}
|
||||
AND category IS NOT NULL AND category != ''
|
||||
ORDER BY category
|
||||
</select>
|
||||
|
||||
<update id="renameCategory">
|
||||
UPDATE account_entry SET category = #{newName}
|
||||
WHERE member_id = #{memberId} AND type = #{type} AND category = #{oldName}
|
||||
</update>
|
||||
|
||||
<!-- ===== 항목-태그 ===== -->
|
||||
<insert id="insertEntryTag">
|
||||
INSERT INTO account_entry_tag (entry_id, tag_id) VALUES (#{entryId}, #{tagId})
|
||||
</insert>
|
||||
|
||||
<delete id="deleteEntryTagsByEntryId" parameterType="long">
|
||||
DELETE FROM account_entry_tag WHERE entry_id = #{entryId}
|
||||
</delete>
|
||||
|
||||
<select id="findTagNamesByEntryId" parameterType="long" resultType="string">
|
||||
SELECT t.name
|
||||
FROM account_tag t
|
||||
JOIN account_entry_tag aet ON aet.tag_id = t.id
|
||||
WHERE aet.entry_id = #{entryId}
|
||||
ORDER BY t.name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?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.AccountTagMapper">
|
||||
|
||||
<resultMap id="tagResultMap" type="com.sb.web.account.domain.AccountTag">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByMember" parameterType="long" resultMap="tagResultMap">
|
||||
SELECT id, member_id, name, created_at
|
||||
FROM account_tag
|
||||
WHERE member_id = #{memberId}
|
||||
ORDER BY name
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="tagResultMap">
|
||||
SELECT id, member_id, name, created_at
|
||||
FROM account_tag
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(*) FROM account_tag
|
||||
WHERE member_id = #{memberId} AND name = #{name}
|
||||
<if test="excludeId != null">AND id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.AccountTag"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO account_tag (member_id, name, created_at)
|
||||
VALUES (#{memberId}, #{name}, NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.account.domain.AccountTag">
|
||||
UPDATE account_tag SET name = #{name}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM account_tag WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<select id="findExistingIds" resultType="long">
|
||||
SELECT id FROM account_tag
|
||||
WHERE member_id = #{memberId} AND id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<delete id="deleteEntryLinksByTagId" parameterType="long">
|
||||
DELETE FROM account_entry_tag WHERE tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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.board.mapper.BoardSettingMapper">
|
||||
|
||||
<select id="findTagCategoryId" resultType="java.lang.Long">
|
||||
SELECT tag_category_id FROM board_setting WHERE id = 1
|
||||
</select>
|
||||
|
||||
<update id="updateTagCategoryId">
|
||||
UPDATE board_setting SET tag_category_id = #{categoryId} WHERE id = 1
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -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>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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.CategoryMapper">
|
||||
|
||||
<resultMap id="categoryResultMap" type="com.sb.web.account.domain.AccountCategory">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sortOrder" column="sort_order"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByMember" parameterType="long" resultMap="categoryResultMap">
|
||||
SELECT id, member_id, type, name, sort_order, created_at
|
||||
FROM account_category
|
||||
WHERE member_id = #{memberId}
|
||||
ORDER BY type, sort_order, name
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="categoryResultMap">
|
||||
SELECT id, member_id, type, name, sort_order, created_at
|
||||
FROM account_category
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(*) FROM account_category
|
||||
WHERE member_id = #{memberId} AND type = #{type} AND name = #{name}
|
||||
<if test="excludeId != null">AND id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.AccountCategory"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO account_category (member_id, type, name, sort_order, created_at)
|
||||
VALUES (#{memberId}, #{type}, #{name}, #{sortOrder}, NOW())
|
||||
</insert>
|
||||
|
||||
<insert id="insertIgnore" parameterType="com.sb.web.account.domain.AccountCategory">
|
||||
INSERT IGNORE INTO account_category (member_id, type, name, sort_order, created_at)
|
||||
VALUES (#{memberId}, #{type}, #{name}, 0, NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.account.domain.AccountCategory">
|
||||
UPDATE account_category SET name = #{name}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM account_category WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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.board.mapper.CommentMapper">
|
||||
|
||||
<resultMap id="commentResultMap" type="com.sb.web.board.domain.Comment">
|
||||
<id property="id" column="id"/>
|
||||
<result property="postId" column="post_id"/>
|
||||
<result property="authorId" column="author_id"/>
|
||||
<result property="authorName" column="author_name"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findByPostId" parameterType="long" resultMap="commentResultMap">
|
||||
SELECT id, post_id, author_id, author_name, content, created_at
|
||||
FROM comment
|
||||
WHERE post_id = #{postId}
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="commentResultMap">
|
||||
SELECT id, post_id, author_id, author_name, content, created_at
|
||||
FROM comment
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.board.domain.Comment"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO comment (post_id, author_id, author_name, content, created_at)
|
||||
VALUES (#{postId}, #{authorId}, #{authorName}, #{content}, NOW())
|
||||
</insert>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
DELETE FROM comment WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByPostId" parameterType="long">
|
||||
DELETE FROM comment WHERE post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?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.InvestMapper">
|
||||
|
||||
<resultMap id="holdingMap" type="com.sb.web.account.domain.InvestHolding">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="ticker" column="ticker"/>
|
||||
<result property="currentPrice" column="current_price"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="tradeMap" type="com.sb.web.account.domain.InvestTrade">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="holdingId" column="holding_id"/>
|
||||
<result property="tradeType" column="trade_type"/>
|
||||
<result property="tradeDate" column="trade_date"/>
|
||||
<result property="quantity" column="quantity"/>
|
||||
<result property="price" column="price"/>
|
||||
<result property="fee" column="fee"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="holdingCols">id, member_id, wallet_id, name, ticker, current_price, created_at, updated_at</sql>
|
||||
<sql id="tradeCols">id, member_id, holding_id, trade_type, trade_date, quantity, price, fee, created_at</sql>
|
||||
|
||||
<!-- ===== 보유 종목 ===== -->
|
||||
<select id="findHoldingsByMember" resultMap="holdingMap">
|
||||
SELECT <include refid="holdingCols"/> FROM invest_holding
|
||||
WHERE member_id = #{memberId}
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="findHoldingsByWallet" resultMap="holdingMap">
|
||||
SELECT <include refid="holdingCols"/> FROM invest_holding
|
||||
WHERE member_id = #{memberId} AND wallet_id = #{walletId}
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
<select id="findHoldingByIdAndMember" resultMap="holdingMap">
|
||||
SELECT <include refid="holdingCols"/> FROM invest_holding
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insertHolding" parameterType="com.sb.web.account.domain.InvestHolding"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO invest_holding (member_id, wallet_id, name, ticker, current_price, created_at, updated_at)
|
||||
VALUES (#{memberId}, #{walletId}, #{name}, #{ticker}, #{currentPrice}, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
<update id="updateHolding" parameterType="com.sb.web.account.domain.InvestHolding">
|
||||
UPDATE invest_holding
|
||||
SET name = #{name}, ticker = #{ticker}, current_price = #{currentPrice}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHolding">
|
||||
DELETE FROM invest_holding WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<!-- ===== 매매 이력 ===== -->
|
||||
<select id="findTradesByMember" resultMap="tradeMap">
|
||||
SELECT <include refid="tradeCols"/> FROM invest_trade
|
||||
WHERE member_id = #{memberId}
|
||||
ORDER BY holding_id, trade_date, id
|
||||
</select>
|
||||
|
||||
<select id="findTradesByHolding" resultMap="tradeMap">
|
||||
SELECT <include refid="tradeCols"/> FROM invest_trade
|
||||
WHERE holding_id = #{holdingId} AND member_id = #{memberId}
|
||||
ORDER BY trade_date, id
|
||||
</select>
|
||||
|
||||
<select id="findTradeByIdAndMember" resultMap="tradeMap">
|
||||
SELECT <include refid="tradeCols"/> FROM invest_trade
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insertTrade" parameterType="com.sb.web.account.domain.InvestTrade"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO invest_trade (member_id, holding_id, trade_type, trade_date, quantity, price, fee, created_at)
|
||||
VALUES (#{memberId}, #{holdingId}, #{tradeType}, #{tradeDate}, #{quantity}, #{price}, #{fee}, NOW())
|
||||
</insert>
|
||||
|
||||
<delete id="deleteTrade">
|
||||
DELETE FROM invest_trade WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTradesByHolding">
|
||||
DELETE FROM invest_trade WHERE holding_id = #{holdingId} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -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.auth.mapper.MemberMapper">
|
||||
|
||||
<resultMap id="memberResultMap" type="com.sb.web.auth.domain.Member">
|
||||
<id property="id" column="id"/>
|
||||
<result property="loginId" column="login_id"/>
|
||||
<result property="password" column="password"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="email" column="email"/>
|
||||
<result property="provider" column="provider"/>
|
||||
<result property="providerId" column="provider_id"/>
|
||||
<result property="role" column="role"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="columns">
|
||||
id, login_id, password, name, email, provider, provider_id, role, status, created_at, updated_at
|
||||
</sql>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="memberResultMap">
|
||||
SELECT <include refid="columns"/> FROM member WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findByLoginId" parameterType="string" resultMap="memberResultMap">
|
||||
SELECT <include refid="columns"/> FROM member WHERE login_id = #{loginId}
|
||||
</select>
|
||||
|
||||
<select id="findByProvider" resultMap="memberResultMap">
|
||||
SELECT <include refid="columns"/>
|
||||
FROM member
|
||||
WHERE provider = #{provider} AND provider_id = #{providerId}
|
||||
</select>
|
||||
|
||||
<select id="countByLoginId" parameterType="string" resultType="int">
|
||||
SELECT COUNT(*) FROM member WHERE login_id = #{loginId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.auth.domain.Member"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO member (login_id, password, name, email, provider, provider_id, role, status, created_at, updated_at)
|
||||
VALUES (#{loginId}, #{password}, #{name}, #{email},
|
||||
#{provider}, #{providerId}, #{role}, #{status}, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,80 @@
|
||||
<?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.board.mapper.PostMapper">
|
||||
|
||||
<sql id="filter">
|
||||
<if test="tag != null and tag != ''">
|
||||
JOIN post_tag pt ON pt.post_id = p.id
|
||||
JOIN tag t ON t.id = pt.tag_id
|
||||
</if>
|
||||
<where>
|
||||
<if test="tag != null and tag != ''">
|
||||
t.name = #{tag}
|
||||
</if>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
<choose>
|
||||
<when test="searchType == 'content'">
|
||||
AND p.content LIKE CONCAT('%', #{keyword}, '%')
|
||||
</when>
|
||||
<when test="searchType == 'comment'">
|
||||
AND EXISTS (SELECT 1 FROM comment c
|
||||
WHERE c.post_id = p.id
|
||||
AND c.content LIKE CONCAT('%', #{keyword}, '%'))
|
||||
</when>
|
||||
<otherwise>
|
||||
AND p.title LIKE CONCAT('%', #{keyword}, '%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="findPage" resultType="com.sb.web.board.dto.PostSummary">
|
||||
SELECT
|
||||
p.id, p.title, p.author_name, p.view_count, p.blocked, p.created_at,
|
||||
(SELECT COUNT(*) FROM comment c WHERE c.post_id = p.id) AS comment_count
|
||||
FROM post p
|
||||
<include refid="filter"/>
|
||||
ORDER BY p.id DESC
|
||||
LIMIT #{size} OFFSET #{offset}
|
||||
</select>
|
||||
|
||||
<select id="countPage" resultType="long">
|
||||
SELECT COUNT(*)
|
||||
FROM post p
|
||||
<include refid="filter"/>
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="long" resultType="com.sb.web.board.domain.Post">
|
||||
SELECT id, title, content, author_id, author_name, view_count,
|
||||
blocked, block_reason, created_at, updated_at
|
||||
FROM post
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.board.domain.Post"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO post (title, content, author_id, author_name, view_count, created_at, updated_at)
|
||||
VALUES (#{title}, #{content}, #{authorId}, #{authorName}, 0, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.board.domain.Post">
|
||||
UPDATE post
|
||||
SET title = #{title}, content = #{content}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
DELETE FROM post WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<update id="increaseViewCount" parameterType="long">
|
||||
UPDATE post SET view_count = view_count + 1 WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateBlocked">
|
||||
UPDATE post SET blocked = #{blocked}, block_reason = #{blockReason} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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.RecurringMapper">
|
||||
|
||||
<resultMap id="recurringResultMap" type="com.sb.web.account.domain.Recurring">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="amount" column="amount"/>
|
||||
<result property="category" column="category"/>
|
||||
<result property="memo" column="memo"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
<result property="walletName" column="wallet_name"/>
|
||||
<result property="toWalletId" column="to_wallet_id"/>
|
||||
<result property="toWalletName" column="to_wallet_name"/>
|
||||
<result property="frequency" column="frequency"/>
|
||||
<result property="dayOfMonth" column="day_of_month"/>
|
||||
<result property="dayOfWeek" column="day_of_week"/>
|
||||
<result property="monthOfYear" column="month_of_year"/>
|
||||
<result property="startDate" column="start_date"/>
|
||||
<result property="endDate" column="end_date"/>
|
||||
<result property="lastRunDate" column="last_run_date"/>
|
||||
<result property="active" column="active"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectJoin">
|
||||
SELECT r.id, r.member_id, r.title, r.type, r.amount, r.category, r.memo,
|
||||
r.wallet_id, w.name AS wallet_name, r.to_wallet_id, tw.name AS to_wallet_name,
|
||||
r.frequency, r.day_of_month, r.day_of_week, r.month_of_year,
|
||||
r.start_date, r.end_date, r.last_run_date, r.active
|
||||
FROM recurring r
|
||||
LEFT JOIN wallet w ON w.id = r.wallet_id
|
||||
LEFT JOIN wallet tw ON tw.id = r.to_wallet_id
|
||||
</sql>
|
||||
|
||||
<select id="findByMember" parameterType="long" resultMap="recurringResultMap">
|
||||
<include refid="selectJoin"/>
|
||||
WHERE r.member_id = #{memberId}
|
||||
ORDER BY r.active DESC, r.title
|
||||
</select>
|
||||
|
||||
<select id="findActiveByMember" parameterType="long" resultMap="recurringResultMap">
|
||||
<include refid="selectJoin"/>
|
||||
WHERE r.member_id = #{memberId} AND r.active = 1
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="recurringResultMap">
|
||||
<include refid="selectJoin"/>
|
||||
WHERE r.id = #{id} AND r.member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.Recurring"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO recurring (member_id, title, type, amount, category, memo, wallet_id, to_wallet_id,
|
||||
frequency, day_of_month, day_of_week, month_of_year,
|
||||
start_date, end_date, last_run_date, active, created_at, updated_at)
|
||||
VALUES (#{memberId}, #{title}, #{type}, #{amount}, #{category}, #{memo}, #{walletId}, #{toWalletId},
|
||||
#{frequency}, #{dayOfMonth}, #{dayOfWeek}, #{monthOfYear},
|
||||
#{startDate}, #{endDate}, #{lastRunDate}, #{active}, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.account.domain.Recurring">
|
||||
UPDATE recurring
|
||||
SET title = #{title}, type = #{type}, amount = #{amount}, category = #{category}, memo = #{memo},
|
||||
wallet_id = #{walletId}, to_wallet_id = #{toWalletId},
|
||||
frequency = #{frequency}, day_of_month = #{dayOfMonth}, day_of_week = #{dayOfWeek},
|
||||
month_of_year = #{monthOfYear}, start_date = #{startDate}, end_date = #{endDate}, active = #{active}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM recurring WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
<update id="updateLastRun">
|
||||
UPDATE recurring SET last_run_date = #{lastRunDate} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,47 @@
|
||||
<?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.board.mapper.TagCategoryMapper">
|
||||
|
||||
<resultMap id="categoryResultMap" type="com.sb.web.board.domain.TagCategory">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="sortOrder" column="sort_order"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="findAll" resultMap="categoryResultMap">
|
||||
SELECT id, name, sort_order, created_at
|
||||
FROM tag_category
|
||||
ORDER BY sort_order ASC, id ASC
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="categoryResultMap">
|
||||
SELECT id, name, sort_order, created_at
|
||||
FROM tag_category
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(*) FROM tag_category
|
||||
WHERE name = #{name}
|
||||
<if test="excludeId != null">AND id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.board.domain.TagCategory"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tag_category (name, sort_order, created_at)
|
||||
VALUES (#{name}, #{sortOrder}, NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.board.domain.TagCategory">
|
||||
UPDATE tag_category
|
||||
SET name = #{name}, sort_order = #{sortOrder}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
DELETE FROM tag_category WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,77 @@
|
||||
<?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.board.mapper.TagMapper">
|
||||
|
||||
<resultMap id="tagResultMap" type="com.sb.web.board.domain.Tag">
|
||||
<id property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="categoryId" column="category_id"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- ===== 게시글 작성/표시 ===== -->
|
||||
<select id="findNamesByPostId" parameterType="long" resultType="string">
|
||||
SELECT t.name
|
||||
FROM tag t
|
||||
JOIN post_tag pt ON pt.tag_id = t.id
|
||||
WHERE pt.post_id = #{postId}
|
||||
ORDER BY t.name
|
||||
</select>
|
||||
|
||||
<select id="findAllNames" resultType="string">
|
||||
SELECT name FROM tag ORDER BY name
|
||||
</select>
|
||||
|
||||
<insert id="insertPostTag">
|
||||
INSERT INTO post_tag (post_id, tag_id) VALUES (#{postId}, #{tagId})
|
||||
</insert>
|
||||
|
||||
<delete id="deletePostTagsByPostId" parameterType="long">
|
||||
DELETE FROM post_tag WHERE post_id = #{postId}
|
||||
</delete>
|
||||
|
||||
<select id="findExistingIds" resultType="long">
|
||||
SELECT id FROM tag
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- ===== 관리자 태그 CRUD ===== -->
|
||||
<select id="findAll" resultMap="tagResultMap">
|
||||
SELECT id, name, category_id FROM tag ORDER BY name
|
||||
</select>
|
||||
|
||||
<select id="findByCategoryId" parameterType="long" resultMap="tagResultMap">
|
||||
SELECT id, name, category_id FROM tag WHERE category_id = #{categoryId} ORDER BY name
|
||||
</select>
|
||||
|
||||
<select id="findById" parameterType="long" resultMap="tagResultMap">
|
||||
SELECT id, name, category_id FROM tag WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(*) FROM tag
|
||||
WHERE name = #{name}
|
||||
<if test="excludeId != null">AND id != #{excludeId}</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.board.domain.Tag"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tag (name, category_id) VALUES (#{name}, #{categoryId})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.board.domain.Tag">
|
||||
UPDATE tag SET name = #{name}, category_id = #{categoryId} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="long">
|
||||
DELETE FROM tag WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePostTagsByTagId" parameterType="long">
|
||||
DELETE FROM post_tag WHERE tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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.example.sb_bt.mapper.UserMapper">
|
||||
<mapper namespace="com.sb.web.user.mapper.UserMapper">
|
||||
|
||||
<resultMap id="userResultMap" type="User">
|
||||
<id property="id" column="id"/>
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?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.WalletMapper">
|
||||
|
||||
<resultMap id="walletResultMap" type="com.sb.web.account.domain.Wallet">
|
||||
<id property="id" column="id"/>
|
||||
<result property="memberId" column="member_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="issuer" column="issuer"/>
|
||||
<result property="accountNumber" column="account_number"/>
|
||||
<result property="cardType" column="card_type"/>
|
||||
<result property="openingBalance" column="opening_balance"/>
|
||||
<result property="openingDate" column="opening_date"/>
|
||||
<result property="currentValue" column="current_value"/>
|
||||
<result property="createdAt" column="created_at"/>
|
||||
<result property="updatedAt" column="updated_at"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="cols">id, member_id, type, name, issuer, account_number, card_type,
|
||||
opening_balance, opening_date, current_value, created_at, updated_at</sql>
|
||||
|
||||
<select id="findByMember" parameterType="long" resultMap="walletResultMap">
|
||||
SELECT <include refid="cols"/> FROM wallet
|
||||
WHERE member_id = #{memberId}
|
||||
ORDER BY type, name
|
||||
</select>
|
||||
|
||||
<select id="findByIdAndMember" resultMap="walletResultMap">
|
||||
SELECT <include refid="cols"/> FROM wallet
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.sb.web.account.domain.Wallet"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO wallet (member_id, type, name, issuer, account_number, card_type,
|
||||
opening_balance, opening_date, current_value, created_at, updated_at)
|
||||
VALUES (#{memberId}, #{type}, #{name}, #{issuer}, #{accountNumber}, #{cardType},
|
||||
#{openingBalance}, #{openingDate}, #{currentValue}, NOW(), NOW())
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.sb.web.account.domain.Wallet">
|
||||
UPDATE wallet
|
||||
SET type = #{type}, name = #{name}, issuer = #{issuer},
|
||||
account_number = #{accountNumber}, card_type = #{cardType},
|
||||
opening_balance = #{openingBalance}, opening_date = #{openingDate},
|
||||
current_value = #{currentValue}
|
||||
WHERE id = #{id} AND member_id = #{memberId}
|
||||
</update>
|
||||
|
||||
<!-- 계좌별 현재 잔액 = 초기잔액 + 수입 - 지출 - 이체출금 + 이체입금 -->
|
||||
<select id="findBalances" parameterType="long" resultType="map">
|
||||
SELECT w.id AS id,
|
||||
w.opening_balance
|
||||
+ COALESCE((SELECT SUM(e.amount) FROM account_entry e
|
||||
WHERE e.member_id = w.member_id AND e.type = 'INCOME' AND e.wallet_id = w.id), 0)
|
||||
- COALESCE((SELECT SUM(e.amount) FROM account_entry e
|
||||
WHERE e.member_id = w.member_id AND e.type = 'EXPENSE' AND e.wallet_id = w.id), 0)
|
||||
- COALESCE((SELECT SUM(e.amount) FROM account_entry e
|
||||
WHERE e.member_id = w.member_id AND e.type = 'TRANSFER' AND e.wallet_id = w.id), 0)
|
||||
+ COALESCE((SELECT SUM(e.amount) FROM account_entry e
|
||||
WHERE e.member_id = w.member_id AND e.type = 'TRANSFER' AND e.to_wallet_id = w.id), 0)
|
||||
AS balance
|
||||
FROM wallet w
|
||||
WHERE w.member_id = #{memberId}
|
||||
</select>
|
||||
|
||||
<delete id="delete">
|
||||
DELETE FROM wallet WHERE id = #{id} AND member_id = #{memberId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user