添加按类别创建促销

Change-Id: If9a0d78bfd14030782c24a0fa07b66cddea69d1e
diff --git a/src/main/java/com/example/myproject/service/PromotionService.java b/src/main/java/com/example/myproject/service/PromotionService.java
index b83bce5..2122411 100644
--- a/src/main/java/com/example/myproject/service/PromotionService.java
+++ b/src/main/java/com/example/myproject/service/PromotionService.java
@@ -18,4 +18,5 @@
     double getDownloadDiscount(Long torrentId);
 
 
-} 
\ No newline at end of file
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/myproject/service/TorrentService.java b/src/main/java/com/example/myproject/service/TorrentService.java
index 0baee2d..700b8ea 100644
--- a/src/main/java/com/example/myproject/service/TorrentService.java
+++ b/src/main/java/com/example/myproject/service/TorrentService.java
@@ -89,4 +89,8 @@
     //        return torrentMapper.selectColdTorrents(threshold);
     //    }
     List<TorrentEntity> getColdTorrents(int threshold);
+
+    List<TorrentEntity> getTorrentsByCategory(String category);
+
+    void incrementDownloadCount(Long torrentId);
 }
diff --git a/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java b/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java
index caec8e1..dccba96 100644
--- a/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java
+++ b/src/main/java/com/example/myproject/service/serviceImpl/PromotionServiceImpl.java
@@ -3,12 +3,12 @@
 import com.example.myproject.entity.Promotion;
 import com.example.myproject.entity.TorrentEntity;
 import com.example.myproject.mapper.PromotionMapper;
+import com.example.myproject.mapper.TorrentMapper;
 import com.example.myproject.service.PromotionService;
 import com.example.myproject.dto.PromotionCreateDTO;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -23,6 +23,9 @@
     @Autowired
     private PromotionMapper promotionMapper;
 
+    @Autowired
+    private TorrentMapper torrentMapper;
+
     @Override
     @Transactional
     public Promotion createPromotion(PromotionCreateDTO promotionDTO) {
@@ -165,4 +168,5 @@
                 .min()
                 .orElse(0.0);
     }
+
 }
diff --git a/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java b/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java
index 2fb4b4d..cf97746 100644
--- a/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java
+++ b/src/main/java/com/example/myproject/service/serviceImpl/TorrentServiceImpl.java
@@ -606,5 +606,15 @@
     public List<TorrentEntity> getColdTorrents(int threshold) {
         return torrentMapper.selectColdTorrents(threshold);
     }
+    @Override
+    public List<TorrentEntity> getTorrentsByCategory(String category) {
+        return torrentMapper.selectByCategory(category);
+    }
+    @Override
+    public void incrementDownloadCount(Long torrentId) {
+        torrentMapper.incrementDownloadCount(torrentId);
+    }
+
+
 
 }
\ No newline at end of file