|
@@ -9,15 +9,13 @@ import com.mooctest.crowd.site.data.vo.SearchConditionVO;
|
|
|
import com.mooctest.crowd.site.data.vo.TechnicalArticlesVO;
|
|
|
import com.mooctest.crowd.site.service.TechnicalArticlesService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @Author: hanyuwei
|
|
@@ -30,15 +28,14 @@ public class TechnicalArticlesController {
|
|
|
@Autowired
|
|
|
private TechnicalArticlesService technical;
|
|
|
|
|
|
-// @RequestMapping(value = "/articles", method = RequestMethod.POST)
|
|
|
-// public ResponseVO<TechnicalArticlesDTO> technicalarticles(@RequestBody SearchConditionVO searchConditionVO){
|
|
|
-// Map<String, String> extraCondition = searchConditionVO.getColumnFilters()==null? new HashMap<>() :super.getExtraCondition(searchConditionVO);
|
|
|
-// Gson gson = new Gson();
|
|
|
-// SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
|
|
|
-// Pageable pageable = this.getPageable(searchConditionVO);
|
|
|
-// String keyword = searchConditionVO.getKeyword();
|
|
|
-// return new ResponseVO<>(ServerCode.SUCCESS, technical.getArticles(pageable, keyword));
|
|
|
-// }
|
|
|
+ @RequestMapping(value = "/articles", method = RequestMethod.GET)
|
|
|
+ public ResponseVO<TechnicalArticlesDTO> technicalarticles(@RequestParam(name = "searchCondition") String searchCondition){
|
|
|
+ Gson gson = new Gson();
|
|
|
+ SearchConditionVO searchConditionVO = gson.fromJson(searchCondition, SearchConditionVO.class);
|
|
|
+ Pageable pageable = this.getPageable(searchConditionVO);
|
|
|
+ String keyword = searchConditionVO.getKeyword();
|
|
|
+ return new ResponseVO<>(ServerCode.SUCCESS, technical.getArticles(pageable, keyword));
|
|
|
+ }
|
|
|
|
|
|
Pageable getPageable(SearchConditionVO searchConditionVO){
|
|
|
int activePage = searchConditionVO.getActivePage() == 0?1:searchConditionVO.getActivePage();
|