|
@@ -10,6 +10,9 @@ import cn.seecoder.ojserver.model.dto.ProblemDTO;
|
|
|
import cn.seecoder.ojserver.model.vo.ProblemVO;
|
|
import cn.seecoder.ojserver.model.vo.ProblemVO;
|
|
|
import cn.seecoder.ojserver.model.vo.TestCaseVO;
|
|
import cn.seecoder.ojserver.model.vo.TestCaseVO;
|
|
|
import cn.seecoder.ojserver.service.ProblemService;
|
|
import cn.seecoder.ojserver.service.ProblemService;
|
|
|
|
|
+import org.springframework.cache.annotation.CacheEvict;
|
|
|
|
|
+import org.springframework.cache.annotation.CachePut;
|
|
|
|
|
+import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -38,6 +41,7 @@ public class ProblemServiceImpl implements ProblemService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @CacheEvict(value = {"problem","problemTestCase"}, key = "#problemId")
|
|
|
public int delete(int problemId) {
|
|
public int delete(int problemId) {
|
|
|
this.problemDAO.deleteById(problemId);
|
|
this.problemDAO.deleteById(problemId);
|
|
|
return problemId;
|
|
return problemId;
|
|
@@ -71,6 +75,7 @@ public class ProblemServiceImpl implements ProblemService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @CacheEvict(value = "problemTestCase",key = "#testCaseVO.problemId")
|
|
|
public TestCaseVO addTestCase(TestCaseVO testCaseVO) {
|
|
public TestCaseVO addTestCase(TestCaseVO testCaseVO) {
|
|
|
TestCase testCase = TestCaseMapper.INSTANCE.toPO(testCaseVO);
|
|
TestCase testCase = TestCaseMapper.INSTANCE.toPO(testCaseVO);
|
|
|
Problem problem = new Problem();
|
|
Problem problem = new Problem();
|
|
@@ -81,6 +86,7 @@ public class ProblemServiceImpl implements ProblemService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @CacheEvict(value = "problemTestCase",allEntries = true)
|
|
|
public List<TestCaseVO> addTestCaseList(List<TestCaseVO> testCaseVOList) {
|
|
public List<TestCaseVO> addTestCaseList(List<TestCaseVO> testCaseVOList) {
|
|
|
List<TestCase> testCaseList = TestCaseMapper.INSTANCE.toPOList(testCaseVOList);
|
|
List<TestCase> testCaseList = TestCaseMapper.INSTANCE.toPOList(testCaseVOList);
|
|
|
for(int i=0;i<testCaseList.size();i++){
|
|
for(int i=0;i<testCaseList.size();i++){
|
|
@@ -94,6 +100,7 @@ public class ProblemServiceImpl implements ProblemService {
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @CacheEvict(value = "problemTestCase", allEntries = true)
|
|
|
public String deleteTestCase(Integer testcaseId) {
|
|
public String deleteTestCase(Integer testcaseId) {
|
|
|
this.testCaseDAO.deleteById(testcaseId);
|
|
this.testCaseDAO.deleteById(testcaseId);
|
|
|
return "删除测试用例成功";
|
|
return "删除测试用例成功";
|