ArticleController.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.fdkankan.ucenter.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.fdkankan.ucenter.common.Result;
  4. import com.fdkankan.ucenter.entity.Article;
  5. import com.fdkankan.ucenter.entity.Case;
  6. import com.fdkankan.ucenter.service.IArticleService;
  7. import com.fdkankan.ucenter.service.ICaseService;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.util.ObjectUtils;
  10. import org.springframework.web.bind.annotation.*;
  11. import javax.annotation.PostConstruct;
  12. /**
  13. * <p>
  14. * 前端控制器
  15. * </p>
  16. *
  17. * @author
  18. * @since 2022-10-13
  19. */
  20. @RestController
  21. @RequestMapping("/ucenter/article")
  22. public class ArticleController {
  23. @Autowired
  24. ICaseService caseService;
  25. /**
  26. * 行业解决方案-案例展示
  27. */
  28. @PostMapping("/detail")
  29. public Result detail(@RequestBody Case caseEntity) throws Exception {
  30. if(ObjectUtils.isEmpty(caseEntity.getId())){
  31. return Result.success();
  32. }
  33. return Result.success(caseService.getById(caseEntity.getId()));
  34. }
  35. @PostMapping("/allList")
  36. public Result allList() throws Exception {
  37. LambdaQueryWrapper<Case> wrapper = new LambdaQueryWrapper<>();
  38. wrapper.eq(Case::getIsPublic,1);
  39. wrapper.orderByAsc(Case::getSort);
  40. return Result.success(caseService.list(wrapper));
  41. }
  42. }