|
@@ -1,9 +1,14 @@
|
|
|
package com.fdkankan.ucenter.controller;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.fdkankan.ucenter.common.BaseController;
|
|
|
import com.fdkankan.ucenter.common.Result;
|
|
|
import com.fdkankan.ucenter.entity.Article;
|
|
|
+import com.fdkankan.ucenter.entity.Case;
|
|
|
import com.fdkankan.ucenter.service.IArticleService;
|
|
|
+import com.fdkankan.ucenter.service.ICaseService;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -18,19 +23,36 @@ import org.springframework.web.bind.annotation.*;
|
|
|
*/
|
|
|
@RestController
|
|
|
@RequestMapping("/ucenter/article")
|
|
|
-public class ArticleController {
|
|
|
+public class ArticleController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
- IArticleService articleService;
|
|
|
+ ICaseService caseService;
|
|
|
/**
|
|
|
* 行业解决方案-案例展示
|
|
|
*/
|
|
|
@PostMapping("/detail")
|
|
|
- public Result detail(@RequestBody Article article) throws Exception {
|
|
|
- if(ObjectUtils.isEmpty(article.getId())){
|
|
|
+ public Result detail(@RequestBody Case caseEntity) throws Exception {
|
|
|
+ if(ObjectUtils.isEmpty(caseEntity.getId())){
|
|
|
return Result.success();
|
|
|
}
|
|
|
- return Result.success(articleService.getById(article.getId()));
|
|
|
+ return Result.success(caseService.getById(caseEntity.getId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/allList")
|
|
|
+ public Result allList(@RequestBody Case caseEntity) throws Exception {
|
|
|
+ String lang = getLang();
|
|
|
+ if("zh".equals(lang)){
|
|
|
+ lang = "cn";
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<Case> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ if(StringUtils.isNotBlank(caseEntity.getTypeId())){
|
|
|
+ wrapper.eq(Case::getTypeId,caseEntity.getTypeId());
|
|
|
+ }
|
|
|
+ wrapper.eq(Case::getLanguage,lang);
|
|
|
+ wrapper.eq(Case::getIsPublic,1);
|
|
|
+ wrapper.orderByAsc(Case::getSort);
|
|
|
+ wrapper.orderByAsc(Case::getId);
|
|
|
+ return Result.success(caseService.list(wrapper));
|
|
|
}
|
|
|
}
|
|
|
|