package com.seer.teach.mall.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.seer.teach.mall.entity.TradeAfterSaleLogEntity;
import com.seer.teach.mall.mapper.TradeAfterSaleLogMapper;
import com.seer.teach.mall.request.AfterSaleLogPageReq;
import com.seer.teach.mall.service.ITradeAfterSaleLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 售后日志服务实现类
 */
@Slf4j
@Service
public class TradeAfterSaleLogServiceImpl extends ServiceImpl<TradeAfterSaleLogMapper, TradeAfterSaleLogEntity> implements ITradeAfterSaleLogService {

    @Override
    public IPage<TradeAfterSaleLogEntity> pageList(AfterSaleLogPageReq reqVO) {
        IPage<TradeAfterSaleLogEntity> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
        return super.page(page, new LambdaQueryWrapper<>(TradeAfterSaleLogEntity.class).eq(TradeAfterSaleLogEntity::getAfterSaleId, reqVO.getAfterSaleId())
                .orderByDesc(TradeAfterSaleLogEntity::getId));
    }
}