我是人,我提交了悬赏功能哦!悬赏功能是:1.人可以发布悬赏 2.人可以回复悬赏 3.只有回复人和悬赏发布者可以下载回复的附件

Change-Id: I269fb69c6ee4dd695a38fa0c91fa8fbe72fc5322
diff --git a/ruoyi-system/src/main/resources/mapper/bounty/BountyMapper.xml b/ruoyi-system/src/main/resources/mapper/bounty/BountyMapper.xml
new file mode 100644
index 0000000..731572a
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/bounty/BountyMapper.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="bounty.mapper.BountyMapper">
+    <!-- 确保 namespace 与 BountyMapper 接口全限定名一致 -->
+    
+    <!-- 添加 selectPage 方法的 SQL 语句 -->
+    <select id="selectPage" resultType="bounty.domain.Bounty">
+    SELECT * FROM bounty
+    <!-- MyBatis-Plus 分页插件会自动添加 LIMIT 语句,无需手动写分页 -->
+</select>
+
+    <select id="selectList" resultType="bounty.domain.Bounty">
+        SELECT * FROM bounty
+    </select>
+
+    <insert id="insert" parameterType="bounty.domain.Bounty">
+        INSERT INTO bounty (
+            title, 
+            description, 
+            reward, 
+            creator_id,  <!-- 假设 creator_id 是非空字段 -->
+            deadline, 
+            create_time,  <!-- 假设 create_time 是非空字段 -->
+            status        <!-- 假设 status 是非空字段 -->
+        )
+        VALUES (
+            #{title},
+            #{description},
+            #{reward},
+            #{creator_id},  <!-- 假设 creatorId 是 Bounty 类中的属性 -->
+            #{deadline},
+            NOW(),  <!-- create_time 默认当前时间(MySQL 函数) -->
+            '0'  <!-- status 默认值(如已发布) -->
+        )
+    </insert>
+
+
+
+     <update id="updateById" parameterType="bounty.domain.Bounty">
+        UPDATE bounty
+        SET 
+            status = #{et.status}  <!-- 使用 et 别名访问实体的 status 属性 -->
+        WHERE id = #{et.id}  <!-- 使用 et 别名访问实体的 id 属性 -->
+    </update>
+
+
+     <resultMap id="BountyWithSubmissionsResult" type="bounty.domain.Bounty">
+        <id property="id" column="id"/>
+        <result property="title" column="title"/>
+        <result property="description" column="description"/>
+        <result property="reward" column="reward"/>
+        <result property="deadline" column="deadline"/>
+        <result property="status" column="status"/>
+        <!-- 关联查询回复列表,填充到 submissions 字段 -->
+        <collection 
+            property="submissions" 
+            column="id" 
+            ofType="bounty.domain.BountySubmission"
+            select="bounty.mapper.BountySubmissionMapper.getSubmissionsByBountyId"/>
+    </resultMap>
+
+    <!-- 修改 selectById 方法,使用新的 resultMap -->
+    <select id="selectById" resultMap="BountyWithSubmissionsResult">
+        SELECT * FROM bounty WHERE id = #{id}
+    </select>
+
+
+</mapper>
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/bounty/BountySubmissionMapper.xml b/ruoyi-system/src/main/resources/mapper/bounty/BountySubmissionMapper.xml
new file mode 100644
index 0000000..67d7947
--- /dev/null
+++ b/ruoyi-system/src/main/resources/mapper/bounty/BountySubmissionMapper.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="bounty.mapper.BountySubmissionMapper">
+    <!-- 继承 BaseMapper 的默认方法(如 insert、selectById 等),无需重复定义 -->
+    
+    <!-- 示例:自定义分页查询(若默认方法不满足需求) -->
+    <select id="getBountySubmissionsByPage" resultType="bounty.domain.BountySubmission">
+        SELECT * FROM bounty_submissions
+        WHERE bounty_id = #{bountyId}
+        LIMIT #{offset}, #{pageSize}
+    </select>
+
+    <insert id="insert" parameterType="bounty.domain.BountySubmission">
+        INSERT INTO bounty_submissions (
+        bounty_id,
+        user_id,
+        content,
+        attachment, <!-- 新增字段 -->
+        create_time,
+        status
+        ) VALUES (
+        #{bountyId},
+        #{userId},
+        #{content},
+        #{attachment}, <!-- 绑定字段 -->
+        NOW(),
+        '0'
+        )
+    </insert>
+
+    <select id="getSubmissionsByBountyId" resultType="bounty.domain.BountySubmission">
+        SELECT id, user_id AS userId, content, attachment, status
+        FROM bounty_submissions
+        WHERE bounty_id = #{bountyId}
+    </select>
+
+    <!-- BountySubmissionMapper.xml -->
+    <update id="updateById" parameterType="bounty.domain.BountySubmission">
+        UPDATE bounty_submissions
+        SET
+            status = #{et.status}
+        WHERE id = #{et.id}
+    </update>
+
+    <select id="selectById" resultType="bounty.domain.BountySubmission">
+        SELECT id, bounty_id AS bountyId, user_id AS userId, content, attachment, status
+        FROM bounty_submissions
+        WHERE id = #{id}
+    </select>
+
+</mapper>
\ No newline at end of file