blob: 67d7947cefb7217639289b08069a27c9e11ec93c [file] [log] [blame]
崔向南03d21b92025-06-05 17:42:23 +08001<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3<mapper namespace="bounty.mapper.BountySubmissionMapper">
4 <!-- 继承 BaseMapper 的默认方法(如 insert、selectById 等),无需重复定义 -->
5
6 <!-- 示例:自定义分页查询(若默认方法不满足需求) -->
7 <select id="getBountySubmissionsByPage" resultType="bounty.domain.BountySubmission">
8 SELECT * FROM bounty_submissions
9 WHERE bounty_id = #{bountyId}
10 LIMIT #{offset}, #{pageSize}
11 </select>
12
13 <insert id="insert" parameterType="bounty.domain.BountySubmission">
14 INSERT INTO bounty_submissions (
15 bounty_id,
16 user_id,
17 content,
18 attachment, <!-- 新增字段 -->
19 create_time,
20 status
21 ) VALUES (
22 #{bountyId},
23 #{userId},
24 #{content},
25 #{attachment}, <!-- 绑定字段 -->
26 NOW(),
27 '0'
28 )
29 </insert>
30
31 <select id="getSubmissionsByBountyId" resultType="bounty.domain.BountySubmission">
32 SELECT id, user_id AS userId, content, attachment, status
33 FROM bounty_submissions
34 WHERE bounty_id = #{bountyId}
35 </select>
36
37 <!-- BountySubmissionMapper.xml -->
38 <update id="updateById" parameterType="bounty.domain.BountySubmission">
39 UPDATE bounty_submissions
40 SET
41 status = #{et.status}
42 WHERE id = #{et.id}
43 </update>
44
45 <select id="selectById" resultType="bounty.domain.BountySubmission">
46 SELECT id, bounty_id AS bountyId, user_id AS userId, content, attachment, status
47 FROM bounty_submissions
48 WHERE id = #{id}
49 </select>
50
51</mapper>