|
@@ -1,31 +1,22 @@
|
|
|
package cn.com.qmth.examcloud.core.questions.api;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.ModelAttribute;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
-
|
|
|
-import com.google.gson.Gson;
|
|
|
-
|
|
|
+import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.QuesRepo;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Question;
|
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.QuestionSearchCondition;
|
|
|
import cn.com.qmth.examcloud.core.questions.service.QuesService;
|
|
|
-import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.core.questions.service.cache.QuestionCache;
|
|
|
import cn.com.qmth.examcloud.web.support.ControllerSupport;
|
|
|
+import com.google.gson.Gson;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* Created by songyue on 16/12/28.
|
|
@@ -33,6 +24,8 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@RestController
|
|
|
@RequestMapping("${api_cqb}/")
|
|
|
public class QuesController extends ControllerSupport {
|
|
|
+ @Autowired
|
|
|
+ QuestionCache questionCache;
|
|
|
|
|
|
@Autowired
|
|
|
QuesService quesService;
|
|
@@ -82,6 +75,9 @@ public class QuesController extends ControllerSupport {
|
|
|
@PutMapping(value = "/question")
|
|
|
public ResponseEntity<Object> updateQuestion(@RequestBody Question question) {
|
|
|
quesService.saveQues(question);
|
|
|
+
|
|
|
+ //清除缓存
|
|
|
+ //questionCache.remove(question.getId());
|
|
|
return new ResponseEntity<Object>(HttpStatus.OK);
|
|
|
}
|
|
|
|
|
@@ -107,6 +103,9 @@ public class QuesController extends ControllerSupport {
|
|
|
@DeleteMapping(value = "/question/{id}")
|
|
|
public ResponseEntity<Object> removeQuestion(@PathVariable String id) {
|
|
|
quesRepo.deleteById(id);
|
|
|
+
|
|
|
+ //清除缓存
|
|
|
+ //questionCache.remove(id);
|
|
|
return new ResponseEntity<Object>(HttpStatus.OK);
|
|
|
}
|
|
|
|