|
@@ -1,5 +1,7 @@
|
|
|
package com.template.services.impl;
|
|
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.model.pojo.SmartNews;
|
|
|
import com.template.mapper.SmartNewsMapper;
|
|
import com.template.mapper.SmartNewsMapper;
|
|
|
import com.template.services.SmartNewsService;
|
|
import com.template.services.SmartNewsService;
|
|
@@ -25,8 +27,11 @@ public class SmartNewsServiceImpl extends ServiceImpl<SmartNewsMapper, SmartNews
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<SmartNews> newsList() {
|
|
public List<SmartNews> newsList() {
|
|
|
- List<SmartNews> newsList = smartNewsMapper.newsList();
|
|
|
|
|
- return newsList;
|
|
|
|
|
|
|
+ LambdaQueryWrapper<SmartNews> wrapper=new LambdaQueryWrapper<>();
|
|
|
|
|
+ wrapper.last("limit 3")
|
|
|
|
|
+ .orderByDesc(SmartNews::getCreateTime);
|
|
|
|
|
+ List<SmartNews> list = this.list(wrapper);
|
|
|
|
|
+ return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|