package com.template.services.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.template.model.pojo.SmartBuildMeter;
import com.template.model.pojo.SmartSection;
import com.template.mapper.SmartSectionMapper;
import com.template.model.result.PageUtils;
import com.template.model.vo.GradeVo;
import com.template.model.vo.SmartSectionPageVo;
import com.template.services.SmartSectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 应用管理 服务实现类
 * </p>
 *
 * @author ceshi
 * @since 2024-05-28
 */
@Service
public class SmartSectionServiceImpl extends ServiceImpl<SmartSectionMapper, SmartSection> implements SmartSectionService {

    @Autowired
    private SmartSectionMapper smartSectionMapper;

    @Override
    public int insertSmartSection(SmartSection ss) {
        int result = smartSectionMapper.insert(ss);
        return ss.getId();
    }

    @Override
    public int updateSmartSection(SmartSection ss) {
        int result = smartSectionMapper.updateById(ss);
        return result;
    }

    @Override
    public SmartSection getSmartById(Integer id) {
        SmartSection result = smartSectionMapper.selectById(id);
        return result;
    }

    @Override
    public int deleteSmartUserById(Integer id) {
        int result = smartSectionMapper.deleteById(id);
        return result;
    }

    @Override
    public PageUtils<SmartSectionPageVo> querySmartSectionPages(int currentPage, int pageCount) {
        Page<SmartSectionPageVo> page = new Page<>();
        page.setCurrent(currentPage);
        page.setSize(pageCount);
        IPage<SmartSectionPageVo> result = smartSectionMapper.querySmartSectionPages(page);
        return new PageUtils(result);
    }
}
