SmartNewsServiceImpl.java 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.template.services.impl;
  2. import com.baomidou.mybatisplus.core.conditions.Wrapper;
  3. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  4. import com.template.model.pojo.SmartNews;
  5. import com.template.mapper.SmartNewsMapper;
  6. import com.template.services.SmartNewsService;
  7. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.stereotype.Service;
  10. import java.util.List;
  11. /**
  12. * <p>
  13. * 服务实现类
  14. * </p>
  15. *
  16. * @author ceshi
  17. * @since 2024-06-12
  18. */
  19. @Service
  20. public class SmartNewsServiceImpl extends ServiceImpl<SmartNewsMapper, SmartNews> implements SmartNewsService {
  21. @Autowired
  22. SmartNewsMapper smartNewsMapper;
  23. @Override
  24. public List<SmartNews> newsList() {
  25. LambdaQueryWrapper<SmartNews> wrapper=new LambdaQueryWrapper<>();
  26. wrapper.last("limit 3")
  27. .orderByDesc(SmartNews::getCreateTime);
  28. List<SmartNews> list = this.list(wrapper);
  29. return list;
  30. }
  31. }