| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package com.template.services.impl;
- import com.baomidou.mybatisplus.core.conditions.Wrapper;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.template.model.pojo.SmartNews;
- import com.template.mapper.SmartNewsMapper;
- import com.template.services.SmartNewsService;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import java.util.List;
- /**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author ceshi
- * @since 2024-06-12
- */
- @Service
- public class SmartNewsServiceImpl extends ServiceImpl<SmartNewsMapper, SmartNews> implements SmartNewsService {
- @Autowired
- SmartNewsMapper smartNewsMapper;
- @Override
- public List<SmartNews> newsList() {
- LambdaQueryWrapper<SmartNews> wrapper=new LambdaQueryWrapper<>();
- wrapper.last("limit 3")
- .orderByDesc(SmartNews::getCreateTime);
- List<SmartNews> list = this.list(wrapper);
- return list;
- }
- }
|