|
@@ -4,12 +4,9 @@ import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Set;
|
|
|
|
|
|
-import javax.persistence.LockModeType;
|
|
|
-
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
|
|
-import org.springframework.data.jpa.repository.Lock;
|
|
|
import org.springframework.data.jpa.repository.Modifying;
|
|
|
import org.springframework.data.jpa.repository.Query;
|
|
|
|
|
@@ -18,10 +15,6 @@ import cn.com.qmth.stmms.common.enums.LibraryStatus;
|
|
|
|
|
|
public interface MarkLibraryDao extends JpaRepository<MarkLibrary, Integer>, JpaSpecificationExecutor<MarkLibrary> {
|
|
|
|
|
|
- @Lock(LockModeType.PESSIMISTIC_WRITE)
|
|
|
- @Query("select l from MarkLibrary l where l.id=?1")
|
|
|
- MarkLibrary findByIdForLock(Integer id);
|
|
|
-
|
|
|
List<MarkLibrary> findByExamIdAndSubjectCode(Integer examId, String subjectCode, Pageable page);
|
|
|
|
|
|
List<MarkLibrary> findByExamIdAndSubjectCodeAndGroupNumberAndStatus(Integer examId, String subjectCode,
|
|
@@ -66,17 +59,20 @@ public interface MarkLibraryDao extends JpaRepository<MarkLibrary, Integer>, Jpa
|
|
|
List<String> findTagSubjectCode(Integer examId);
|
|
|
|
|
|
@Modifying(clearAutomatically = true)
|
|
|
- @Query("update MarkLibrary m set m.status=?4, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null , m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.examId=?1 and m.subjectCode=?2 and m.groupNumber=?3")
|
|
|
+ @Query("update MarkLibrary m set m.status=?4, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null, m.markerSpent=null, "
|
|
|
+ + "m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.examId=?1 and m.subjectCode=?2 and m.groupNumber=?3")
|
|
|
void resetByExamIdAndSubjectCodeAndGroupNumber(Integer examId, String subjectCode, Integer groupNumber,
|
|
|
LibraryStatus status);
|
|
|
|
|
|
@Modifying(clearAutomatically = true)
|
|
|
- @Query("update MarkLibrary m set m.status=?2, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null, m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.markerId=?1 and m.status!=?3 and m.status!=?4 ")
|
|
|
+ @Query("update MarkLibrary m set m.status=?2, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null, m.markerSpent=null, "
|
|
|
+ + "m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.markerId=?1 and m.status!=?3 and m.status!=?4 ")
|
|
|
void resetByMarkerId(Integer markerId, LibraryStatus status, LibraryStatus libraryStatus1,
|
|
|
LibraryStatus libraryStatus2);
|
|
|
|
|
|
@Modifying(clearAutomatically = true)
|
|
|
- @Query("update MarkLibrary m set m.status=?2, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null , m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.id=?1 and m.status=?3")
|
|
|
+ @Query("update MarkLibrary m set m.status=?2, m.tags=null, m.markerId=null, m.markerTime=null, m.markerScore=null, m.markerScoreList=null, m.markerSpent=null, "
|
|
|
+ + "m.headerId=null , m.headerTime=null , m.headerScore=null , m.headerScoreList=null where m.id=?1 and m.status=?3")
|
|
|
int resetById(Integer id, LibraryStatus newStatus, LibraryStatus previousStatus);
|
|
|
|
|
|
@Query("select f.markerId, count(*) as markerCount from MarkLibrary f where f.examId=?1 and f.status=?2 group by f.markerId")
|
|
@@ -110,9 +106,9 @@ public interface MarkLibraryDao extends JpaRepository<MarkLibrary, Integer>, Jpa
|
|
|
void updateByStudentIdAndGroupNumber(Integer studentId, Integer groupNumber, LibraryStatus status);
|
|
|
|
|
|
@Modifying(clearAutomatically = true)
|
|
|
- @Query("update MarkLibrary l set l.status=?2, l.markerId=?3, l.markerScore=?4, l.markerScoreList=?5, l.markerTime=?6, l.tags=?7 "
|
|
|
- + "where l.id=?1 and l.status in (?8) and (l.markerId=null or l.markerId=?3)")
|
|
|
+ @Query("update MarkLibrary l set l.status=?2, l.markerId=?3, l.markerScore=?4, l.markerScoreList=?5, l.markerTime=?6, "
|
|
|
+ + "l.markerSpent=?7, l.tags=?8 where l.id=?1 and l.status in (?9) and (l.markerId=null or l.markerId=?3)")
|
|
|
int updateMarkerResult(Integer id, LibraryStatus newStatus, Integer markerId, Double markerScore,
|
|
|
- String markerScoreList, Date markerTime, String tags, LibraryStatus... previousStatus);
|
|
|
+ String markerScoreList, Date markerTime, Integer spent, String tags, LibraryStatus... previousStatus);
|
|
|
|
|
|
}
|