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

import com.zcloud.primeport.persistence.dataobject.VehicleDockLogDO;
import com.zcloud.primeport.persistence.mapper.VehicleDockLogMapper;
import com.zcloud.primeport.persistence.repository.VehicleDockLogRepository;
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-14 14:53:30
 */
@Service
@RequiredArgsConstructor
public class VehicleDockLogRepositoryImpl extends BaseRepositoryImpl<VehicleDockLogMapper, VehicleDockLogDO> implements VehicleDockLogRepository {
    private final VehicleDockLogMapper vehicleDockLogMapper;

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

