package com.ruoyi.benyun.service.impl;

import com.ruoyi.benyun.service.BrandRecycleService;
import com.ruoyi.benyun.mapper.BrandMapper;
import com.ruoyi.benyun.entity.Brand;
import com.ruoyi.benyun.entity.vo.BrandVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class BrandRecycleServiceImpl implements BrandRecycleService {

    @Autowired
    BrandMapper brandMapper;
    @Override
    public  PageInfo<Brand> list(BrandVo brandVo) {
        PageHelper.startPage(brandVo.getPageNum(),brandVo.getPageSize());
        PageHelper.orderBy(brandVo.getOrderBy()+" desc");
        List<Brand> list = brandMapper.list(brandVo);
        PageInfo<Brand> brandPageInfo = new PageInfo<>(list);
        return brandPageInfo;
    }

    @Override
    public void deleteBrand(String brandId) {
        int i = brandMapper.deleteById(brandId);
        return;
    }

    @Override
    public void recoverBrand(String brandId) {
        brandMapper.recoverBrand(brandId);
    }
}
