package com.zcloud.zcGbsServicer.persistence.repository.impl;

import com.jjb.saas.framework.repository.common.PageHelper;
import com.zcloud.zcGbsServicer.persistence.dataobject.PumpRoomDO;
import com.zcloud.zcGbsServicer.persistence.mapper.PumpRoomMapper;
import com.zcloud.zcGbsServicer.persistence.repository.PumpRoomRepository;
import com.alibaba.cola.dto.PageResponse;
import com.zcloud.gbscommon.utils.PageQueryHelper;
import com.zcloud.gbscommon.utils.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Map;

/**
* web-infrastructure
* @Author makejava
* @Date 2026-01-21 17:22:16
*/
@Service
@RequiredArgsConstructor
public class PumpRoomRepositoryImpl extends BaseRepositoryImpl<PumpRoomMapper, PumpRoomDO> implements PumpRoomRepository {
    private final PumpRoomMapper pumpRoomMapper;

    @Override
    public  PageResponse<PumpRoomDO> listPage(Map<String,Object> params) {
    IPage<PumpRoomDO> iPage = new Query<PumpRoomDO>().getPage(params);
        QueryWrapper<PumpRoomDO> queryWrapper = new QueryWrapper<>();
        queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, params);
        queryWrapper.orderByDesc("create_time");
        IPage<PumpRoomDO> result = pumpRoomMapper.selectPage(iPage, queryWrapper);
        return PageHelper.pageToResponse(result, result.getRecords());
    }

    @Override
    public PumpRoomDO getById(Long id) {
        return this.getById(id);
    }
}

