|
@@ -0,0 +1,27 @@
|
|
|
+package com.dragon.tj.portal.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.dragon.tj.portal.entity.TipInfo;
|
|
|
+import com.dragon.tj.portal.mapper.TipInfoMapper;
|
|
|
+import com.dragon.tj.portal.service.TipService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class TipServiceImpl implements TipService {
|
|
|
+
|
|
|
+ private final TipInfoMapper tipInfoMapper;
|
|
|
+
|
|
|
+ public TipServiceImpl(TipInfoMapper tipInfoMapper) {
|
|
|
+ this.tipInfoMapper = tipInfoMapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public TipInfo getLatestTip() {
|
|
|
+ LambdaQueryWrapper<TipInfo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.orderByDesc(TipInfo::getCreateTime)
|
|
|
+ .last("limit 1");
|
|
|
+ return tipInfoMapper.selectOne(queryWrapper);
|
|
|
+ }
|
|
|
+}
|