12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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.*;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author
- * @since 2022-10-13
- */
- @RestController
- @RequestMapping("/ucenter/article")
- public class ArticleController extends BaseController {
- @Autowired
- ICaseService caseService;
- /**
- * 行业解决方案-案例展示
- */
- @PostMapping("/detail")
- public Result detail(@RequestBody Case caseEntity) throws Exception {
- if(ObjectUtils.isEmpty(caseEntity.getId())){
- return Result.success();
- }
- 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));
- }
- }
|