2026-06-28 12:27:35 +09:00
|
|
|
<?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.point.mapper.PointMapper">
|
|
|
|
|
|
|
|
|
|
<select id="countTodayGrants" resultType="int">
|
|
|
|
|
SELECT COUNT(*) FROM point_history
|
|
|
|
|
WHERE member_id = #{memberId} AND reason = #{reason} AND created_at >= CURDATE()
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertHistory">
|
|
|
|
|
INSERT INTO point_history (member_id, amount, reason, created_at)
|
|
|
|
|
VALUES (#{memberId}, #{amount}, #{reason}, NOW())
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="addPoints">
|
|
|
|
|
UPDATE member SET points = points + #{amount}, updated_at = NOW() WHERE id = #{memberId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getPoints" parameterType="long" resultType="long">
|
|
|
|
|
SELECT points FROM member WHERE id = #{memberId}
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-06-28 14:44:24 +09:00
|
|
|
<select id="findHistory" resultType="com.sb.web.point.PointHistoryResponse">
|
|
|
|
|
SELECT amount, reason, created_at
|
|
|
|
|
FROM point_history
|
|
|
|
|
WHERE member_id = #{memberId}
|
|
|
|
|
ORDER BY id DESC
|
|
|
|
|
LIMIT #{limit}
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-06-28 12:27:35 +09:00
|
|
|
</mapper>
|