|
@@ -1,19 +1,28 @@
|
|
|
-package cn.com.qmth.examcloud.task.dao;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
-import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
-import org.springframework.stereotype.Repository;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.task.dao.entity.DataSyncEntity;
|
|
|
-
|
|
|
-@Repository
|
|
|
-public interface DataSyncRepo
|
|
|
- extends
|
|
|
- JpaRepository<DataSyncEntity, Long>,
|
|
|
- JpaSpecificationExecutor<DataSyncEntity> {
|
|
|
-
|
|
|
- List<DataSyncEntity> findTop10ByComponentOrderById(String component);
|
|
|
-
|
|
|
-}
|
|
|
+package cn.com.qmth.examcloud.task.dao;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
+import org.springframework.data.jpa.repository.Modifying;
|
|
|
+import org.springframework.data.jpa.repository.Query;
|
|
|
+import org.springframework.data.repository.query.Param;
|
|
|
+import org.springframework.stereotype.Repository;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.task.dao.entity.DataSyncEntity;
|
|
|
+
|
|
|
+@Repository
|
|
|
+public interface DataSyncRepo
|
|
|
+ extends
|
|
|
+ JpaRepository<DataSyncEntity, Long>,
|
|
|
+ JpaSpecificationExecutor<DataSyncEntity> {
|
|
|
+
|
|
|
+ List<DataSyncEntity> findTop10ByComponentOrderById(String component);
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Modifying
|
|
|
+ @Query("update DataSyncEntity set syncNum = syncNum+1 where id=:id")
|
|
|
+ void increaseSyncNum(@Param("id") Long id);
|
|
|
+
|
|
|
+}
|