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

import com.jjb.saas.framework.repository.common.PageHelper;
import com.zcloud.zcGbsServicer.persistence.dataobject.FireResourceStaDO;
import com.zcloud.zcGbsServicer.persistence.mapper.FireResourceMapper;
import com.zcloud.zcGbsServicer.persistence.repository.FireResourceRepository;
import com.alibaba.cola.dto.PageResponse;
import com.zcloud.gbscommon.utils.Query;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
@RequiredArgsConstructor
public class FireResourceRepositoryImpl implements FireResourceRepository {

    private final FireResourceMapper fireResourceMapper;

    @Override
    public PageResponse<FireResourceStaDO> listPage(Map<String, Object> params) {
        IPage<FireResourceStaDO> iPage = new Query<FireResourceStaDO>().getPage(params);
        String corpName = params == null ? null : (String) params.get("corpName");
        IPage<FireResourceStaDO> result = fireResourceMapper.selectStaPage(iPage, corpName);
        return PageHelper.pageToResponse(result, result.getRecords());
    }
}
