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

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

/**
 * web-infrastructure
 *
 * @Author makejava
 * @Date 2026-03-05 11:33:21
 */
@Service
@RequiredArgsConstructor
public class PersonMessageRepositoryImpl extends BaseRepositoryImpl<PersonMessageMapper, PersonMessageDO> implements PersonMessageRepository {
    private final PersonMessageMapper personMessageMapper;

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

