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

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.common.PageListBean;
import com.seer.teach.common.utils.PageConverterUtils;
import com.seer.teach.mall.convert.GoodsSpecificationConvert;
import com.seer.teach.mall.entity.GoodsSpecificationEntity;
import com.seer.teach.mall.good.service.IAdminGoodsSpecificationService;
import com.seer.teach.mall.mapper.GoodsSpecificationMapper;
import com.seer.teach.mall.request.GoodsSpecificationQueryReq;
import com.seer.teach.mall.response.GoodsSpecificationResp;
import org.springframework.stereotype.Service;


@Service
public class AdminGoodsSpecificationServiceImpl extends ServiceImpl<GoodsSpecificationMapper, GoodsSpecificationEntity> implements IAdminGoodsSpecificationService {


    @Override
    public PageListBean<GoodsSpecificationResp> getGoodsSpecification(GoodsSpecificationQueryReq params) {
        Page<GoodsSpecificationEntity> page = new Page<>(params.getPageNo(), params.getPageSize());
        IPage<GoodsSpecificationEntity> iPage = this.getBaseMapper().getGoodsSpecificationPage(page,params.getId(),params.getSpuName());
        return PageConverterUtils.convertPageListBean(iPage, GoodsSpecificationConvert.INSTANCE::list);
    }
}