add
heheng
2025-06-10 942bdeee0b6fcc92b35e788c851d39c5182a8e40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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;
 
/**
 * <p>
 * 轮播图表 服务实现类
 * </p>
 *
 * @author kzy
 * @since 2024-06-05 11:15:14
 */
@Service
public class SysCarouselServiceImpl extends ServiceImpl<SysCarouselMapper, SysCarousel> implements SysCarouselService {
 
    @Override
    public CommonPage selectCarouselList(SysCarousel carousel) {
            PageUtils.startPage();
            List<SysCarousel> 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;
    }
}