package com.gkhy.exam.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.exam.common.api.CommonPage;
import com.gkhy.exam.common.exception.ApiException;
import com.gkhy.exam.common.utils.PageUtils;
import com.gkhy.exam.system.domain.SysCarousel;
import com.gkhy.exam.system.mapper.SysCarouselMapper;
import com.gkhy.exam.system.service.SysCarouselService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
* 轮播图表 服务实现类
*
*
* @author kzy
* @since 2024-06-05 11:15:14
*/
@Service
public class SysCarouselServiceImpl extends ServiceImpl implements SysCarouselService {
@Override
public CommonPage selectCarouselList(SysCarousel carousel) {
PageUtils.startPage();
List carousels = baseMapper.selectCarouselList(carousel);
return CommonPage.restPage(carousels);
}
@Override
public SysCarousel selectCarouselById(Long carouselId) {
return baseMapper.selectCarouselById(carouselId);
}
@Override
public int insertCarousel(SysCarousel carousel) {
int row= baseMapper.insert(carousel);
if(row<1){
throw new ApiException("新增轮播图失败");
}
return row;
}
@Override
public int updateCarousel(SysCarousel carousel) {
int row =baseMapper.updateById(carousel);
if(row<1){
throw new ApiException("更新轮播图失败");
}
return row;
}
@Override
public int deleteCarouselById(Long carouselId) {
int row=baseMapper.deleteById(carouselId);
if(row<1) {
throw new ApiException("删除轮播图失败");
}
return row;
}
}