package com.hxzk.gps.service.impl.HistoryPower;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hxzk.gps.controller.HistoryPower.dto.TableSearchResult.TableSearchResult;
import com.hxzk.gps.entity.Attendance.TbKaoqing;
import com.hxzk.gps.entity.HistoryPower.TbHistoryPower;
import com.hxzk.gps.mapper.HistoryPower.TbHistoryPowerMapper;
import com.hxzk.gps.result.ListDataResult;
import com.hxzk.gps.result.ResultTable;
import com.hxzk.gps.result.table;
import com.hxzk.gps.service.HistoryPower.TbHistoryPowerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxzk.gps.util.GetUser.UserInfoUtil;
import com.hxzk.gps.util.MessageUtils.MessageUtils;
import com.hxzk.gps.util.Time.TimeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
*
* 服务实现类
*
*
* @author YuZhiTong
* @since 2025-05-27
*/
@Service
public class TbHistoryPowerServiceImpl extends ServiceImpl implements TbHistoryPowerService {
@Autowired
TbHistoryPowerMapper historyPowerMapper;
/**
* 标签电量列表查询接口
* @param TableSearchResult
* @return ResultTable
* */
@Override
public ResultTable FindTagHistoryPowerInfo(TableSearchResult TableSearchResult) {
if (TableSearchResult.getHistoryPower().getTime() == null){
TableSearchResult.getHistoryPower().setTime(TimeUtil.GetYearMonthDay());
}else{
TableSearchResult.getHistoryPower().setTime(TimeUtil.ZhuanDate(TableSearchResult.getHistoryPower().getTime()));
}
PageHelper.startPage(TableSearchResult.getTableList().getPageNum(), TableSearchResult.getTableList().getPageSize());
PageInfo info = new PageInfo<>(historyPowerMapper.FindTagHistoryPowerInfo(UserInfoUtil.getUserCompany(), TableSearchResult.getHistoryPower().getTime(),TableSearchResult.getHistoryPower().getTagid()));
table achortable = new table<>(info.getList(), TableSearchResult.getTableList().getPageNum(), TableSearchResult.getTableList().getPageSize(), info.getTotal());
return ListDataResult.resultTableSuccess(achortable, MessageUtils.getMessage("Success"));
}
}