package com.mortals.xhx.module.device.dao.ibatis;


import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.ParamDto;
import com.mortals.xhx.module.device.dao.DeviceMessageStatDao;
import com.mortals.xhx.module.device.model.DeviceMessageStatEntity;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.List;
/**
* 设备消息统计DaoImpl DAO接口
*
* @author zxfei
* @date 2024-03-26
*/
@Repository("deviceMessageStatDao")
public class DeviceMessageStatDaoImpl extends BaseCRUDDaoMybatis<DeviceMessageStatEntity,Long> implements DeviceMessageStatDao {


    @Override
    public List<DeviceMessageStatEntity> getStatList(DeviceMessageStatEntity query, PageInfo pageInfo) {
        ParamDto queryParam = super.getQueryParam(query);
        if (pageInfo.getPrePageResult() == -1) {
            return getSqlSession().selectList(SQLID_GET_STATLIST, queryParam);
        } else {
            RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
            return getSqlSession().selectList(SQLID_GET_STATLIST, queryParam, rowBounds);
        }
    }
}
