package com.ruoyi.demo.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.ruoyi.demo.entity.Brand;
import com.ruoyi.demo.entity.vo.BrandVo;
import com.ruoyi.demo.mapper.BrandMapper;
import com.ruoyi.demo.service.BrandRecycleService;
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);
    }
}
