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

Change-Id: I269fb69c6ee4dd695a38fa0c91fa8fbe72fc5322
diff --git a/ruoyi-system/src/main/java/bounty/controller/BountyController.java b/ruoyi-system/src/main/java/bounty/controller/BountyController.java
new file mode 100644
index 0000000..7c47e1b
--- /dev/null
+++ b/ruoyi-system/src/main/java/bounty/controller/BountyController.java
@@ -0,0 +1,52 @@
+package bounty.controller;
+
+import bounty.domain.Bounty;
+import bounty.domain.BountySubmission;
+import bounty.service.BountyService;
+import bounty.service.BountySubmissionService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import java.util.List;
+
+// 悬赏 Controller 类
+@RestController
+@RequestMapping("/bounties")
+public class BountyController {
+    @Autowired
+    private BountyService bountyService;
+
+    @PostMapping
+    public ResponseEntity<?> saveBounty(@RequestBody Bounty bounty) {
+        boolean result = bountyService.saveBounty(bounty);
+        if (result) {
+            return ResponseEntity.ok().build();
+        } else {
+            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
+        }
+    }
+    @GetMapping
+    // 导入 List 类
+    public List<Bounty> getBounties() {  // 移除分页参数,返回 List 而非 IPage
+        return bountyService.getBounties();  // 调用无分页的 Service 方法
+    }
+
+    @GetMapping("/{id}")
+    public ResponseEntity<Bounty> getBountyById(@PathVariable Long id) {
+        Bounty bounty = bountyService.getBountyById(id);
+        if (bounty == null) {
+            return ResponseEntity.notFound().build();
+        } else {
+            return ResponseEntity.ok(bounty);
+        }
+    }
+    // 新增:发布悬赏接口
+    @PostMapping("/publish")
+    public boolean publishBounty(@RequestBody Bounty bounty) {
+        return bountyService.publishBounty(bounty);
+    }
+}
+