package com.hxzk.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.hxzk.mapper.HeartDao;
|
import com.hxzk.pojo.TbAchor;
|
import com.hxzk.pojo.TbHeartRecord;
|
import com.hxzk.pojo.TbHistoryinwarning;
|
import com.hxzk.service.HeartService;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
@Service
|
public class HeartServiceImpl extends ServiceImpl<HeartDao, TbHeartRecord> implements HeartService {
|
|
@Autowired
|
HeartDao heartDao;
|
@Override
|
public PageInfo<TbHeartRecord> findAll(Integer page, Integer limit) {
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
PageHelper.startPage(page,limit);
|
queryWrapper.orderByDesc("time");
|
List<TbHeartRecord> cardList = baseMapper.selectList(queryWrapper);
|
PageInfo<TbHeartRecord> info = new PageInfo<>(cardList);
|
return info;
|
}
|
|
@Override
|
public PageInfo<TbHeartRecord> findSearch(Integer page, Integer limit, TbHeartRecord achor) {
|
QueryWrapper<TbHeartRecord> queryWrapper = new QueryWrapper<>();
|
PageHelper.startPage(page,limit);
|
queryWrapper.like("tagid",achor.getTagid()).or().eq("name",achor.getTagid());
|
queryWrapper.orderByDesc("time");
|
List<TbHeartRecord> cardList = baseMapper.selectList(queryWrapper);
|
PageInfo<TbHeartRecord> info = new PageInfo<>(cardList);
|
return info;
|
}
|
|
@Override
|
public void deleteanchor(Integer id) {
|
QueryWrapper queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq("id",id);
|
baseMapper.delete(queryWrapper);
|
}
|
|
@Override
|
public List FindHeartZongCount() {
|
List list = new ArrayList<>();
|
list.add(heartDao.findChaoGao());
|
list.add(heartDao.findChaoDi());
|
list.add(heartDao.findZengChang());
|
return list;
|
}
|
|
@Override
|
public List<TbHeartRecord> FindTopCount() {
|
TbHeartRecord chaogao1 = heartDao.findChaoGaoYi();
|
if (chaogao1 != null){
|
Integer chaogao1s = heartDao.findChaoGaoYis(chaogao1.getName());
|
chaogao1.setHeart(String.valueOf(chaogao1s));
|
chaogao1.setOkheart(heartDao.GuoQuDay(chaogao1.getName()));
|
chaogao1.setState(heartDao.GuoQuYue(chaogao1.getName()));
|
}
|
|
TbHeartRecord chaogao2 = heartDao.findChaoGaoEr();
|
if (chaogao2!=null){
|
Integer chaogao2s = heartDao.findChaoGaoErs(chaogao2.getName());
|
chaogao2.setHeart(String.valueOf(chaogao2s));
|
chaogao2.setOkheart(heartDao.GuoQuDay(chaogao2.getName()));
|
chaogao2.setState(heartDao.GuoQuYue(chaogao2.getName()));
|
}
|
|
//已获取前两位
|
TbHeartRecord chaodi1 = heartDao.findChaoDiYi();
|
if (chaodi1!=null){
|
Integer chaodi1s = heartDao.findChaoDiYis(chaodi1.getName());
|
chaodi1.setHeart(String.valueOf(chaodi1s));
|
chaodi1.setOkheart(heartDao.GuoQuDay(chaodi1.getName()));
|
chaodi1.setState(heartDao.GuoQuYue(chaodi1.getName()));
|
}
|
|
TbHeartRecord chaodi2 = heartDao.findChaoDiEr();
|
if (chaodi2!=null){
|
Integer chaodi2s = heartDao.findChaoDiErs(chaodi2.getName());
|
chaodi2.setHeart(String.valueOf(chaodi2s));
|
chaodi2.setOkheart(heartDao.GuoQuDay(chaodi2.getName()));
|
chaodi2.setState(heartDao.GuoQuYue(chaodi2.getName()));
|
}
|
|
//后两位
|
|
List<TbHeartRecord> heartRecords = new ArrayList<>();
|
heartRecords.add(chaogao1);
|
heartRecords.add(chaogao2);
|
heartRecords.add(chaodi1);
|
heartRecords.add(chaodi2);
|
|
return heartRecords;
|
}
|
}
|