WANG il y a 6 ans
Parent
commit
d2e23b6c87

+ 6 - 0
examcloud-task-dao/src/main/java/cn/com/qmth/examcloud/task/dao/TaskTraceRepo.java

@@ -4,7 +4,10 @@ import java.util.Date;
 
 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.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
 
 import cn.com.qmth.examcloud.task.dao.entity.TaskTraceEntity;
 
@@ -16,6 +19,9 @@ public interface TaskTraceRepo
 
 	TaskTraceEntity findByTraceId(String traceId);
 
+	@Transactional
+	@Modifying
+	@Query(value = "delete from EC_T_TASK_TRACE where creation_time < ?1", nativeQuery = true)
 	void deleteByCreationTimeLessThan(Date date);
 
 }