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; /** *

* 服务实现类 *

* * @author ceshi * @since 2024-06-12 */ @Service public class SmartNewsServiceImpl extends ServiceImpl implements SmartNewsService { @Autowired SmartNewsMapper smartNewsMapper; @Override public List newsList() { LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>(); wrapper.last("limit 3") .orderByDesc(SmartNews::getCreateTime); List list = this.list(wrapper); return list; } }