package com.mortals.xhx.module.ph.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.ph.dao.PhQueueStatDao;
import com.mortals.xhx.module.ph.model.PhQueueStatEntity;
import com.mortals.xhx.module.ph.model.PhQueueStatQuery;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 排队叫号汇总统计DaoImpl DAO接口
 *
 * @author zxfei
 * @date 2024-06-24
 */
@Repository("phQueueStatDao")
public class PhQueueStatDaoImpl extends BaseCRUDDaoMybatis<PhQueueStatEntity, Long> implements PhQueueStatDao {


    @Override
    public List<PhQueueStatEntity> getStatList(PhQueueStatQuery query, PageInfo pageInfo) {
        ParamDto queryParam = super.getQueryParam(query);
        List<PhQueueStatEntity> list = getSqlSession().selectList(SQLID_GET_STATLIST, queryParam);
        pageInfo.setTotalResult(list.size());
        if (pageInfo.getPrePageResult() == -1) {
            return list;
        } else {
            //获取全量
            RowBounds rowBounds = new RowBounds(pageInfo.getBeginIndex(), pageInfo.getPrePageResult());
            return getSqlSession().selectList(SQLID_GET_STATLIST, queryParam, rowBounds);
        }
    }
}
