package com.sqx.modules.errand.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.errand.dao.ShopIllegalTypeDao;
import com.sqx.modules.errand.entity.ShopIllegalType;
import com.sqx.modules.errand.service.ShopIllegalTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ShopIllegalTypeServiceImpl extends ServiceImpl<ShopIllegalTypeDao, ShopIllegalType> implements ShopIllegalTypeService {

    @Override
    public Result selectIllegalTypeList() {
        List<ShopIllegalType> illegalTypes = baseMapper.selectList(null);
        return Result.success().put("data", illegalTypes);
    }

    @Override
    public Result selectIllegalTypePage(Integer page, Integer limit) {
        Page<ShopIllegalType> pages=new Page<>(page,limit);
        PageUtils pageUtils = new PageUtils(baseMapper.selectPage(pages, null));
        return Result.success().put("data", pageUtils);
    }

    @Override
    public Result insertIllegalType(ShopIllegalType illegalType) {
        baseMapper.insert(illegalType);
        return Result.success();
    }

    @Override
    public Result updateIllegalType(ShopIllegalType illegalType) {
        baseMapper.updateById(illegalType);
        return Result.success();
    }

    @Override
    public Result deleteIllegalType(Long id) {
        baseMapper.deleteById(id);
        return Result.success();
    }
}
