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

import com.zcloud.primeport.persistence.dataobject.EVehicleBasicInfoDO;
import com.zcloud.primeport.persistence.mapper.EVehicleBasicInfoMapper;
import com.zcloud.primeport.persistence.repository.EVehicleBasicInfoRepository;
import com.alibaba.cola.dto.PageResponse;
import com.jjb.saas.framework.repository.common.PageHelper;
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 dearLin
 * @Date 2026-04-23 10:04:33
 */
@Service
@RequiredArgsConstructor
public class EVehicleBasicInfoRepositoryImpl extends BaseRepositoryImpl<EVehicleBasicInfoMapper, EVehicleBasicInfoDO> implements EVehicleBasicInfoRepository {
    private final EVehicleBasicInfoMapper eVehicleBasicInfoMapper;

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

