|
|
@@ -6,9 +6,14 @@ import com.seec.bok.back.repository.QuestionRepository;
|
|
|
import com.seec.bok.back.repository.TQRepository;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler;
|
|
|
import org.springframework.data.rest.webmvc.RepositoryRestController;
|
|
|
import org.springframework.data.rest.webmvc.support.RepositoryEntityLinks;
|
|
|
+
|
|
|
+import org.springframework.data.web.PagedResourcesAssembler;
|
|
|
+import org.springframework.hateoas.server.RepresentationModelAssembler;
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -22,7 +27,19 @@ import org.springframework.web.bind.annotation.*;
|
|
|
* @Description //TODO
|
|
|
**/
|
|
|
@RepositoryRestController
|
|
|
-@RequestMapping("/question")
|
|
|
+@RequestMapping("/api/question")
|
|
|
public class QuestionController {
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("QuestionRepository") // inject Spring implementation here
|
|
|
+ private QuestionRepository questionRepository;
|
|
|
+ @Autowired
|
|
|
+ private PagedResourcesAssembler pagedAssembler;
|
|
|
+ @Autowired
|
|
|
+ private RepositoryEntityLinks entityLinks;
|
|
|
+ @RequestMapping(value = "/search/findByStemLike",method= RequestMethod.GET, produces = "application/hal+json")
|
|
|
+ public @ResponseBody ResponseEntity<?> findByStem(String content,Pageable pageable) {
|
|
|
+ final Page<Question> like = questionRepository.findByStemLike(content, pageable);
|
|
|
+ return new ResponseEntity(pagedAssembler.toModel(like), HttpStatus.OK);
|
|
|
+ }
|
|
|
|
|
|
}
|