我是人,我提交了悬赏功能哦!悬赏功能是: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