package com.template.services.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.template.model.pojo.SmartSectionDetail;
import com.template.mapper.SmartSectionDetailMapper;
import com.template.model.pojo.SmartUser;
import com.template.services.SmartSectionDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 应用管理 服务实现类
 * </p>
 *
 * @author ceshi
 * @since 2024-05-28
 */
@Service
public class SmartSectionDetailServiceImpl extends ServiceImpl<SmartSectionDetailMapper, SmartSectionDetail> implements SmartSectionDetailService {

    @Autowired
    private SmartSectionDetailMapper smartSectionDetailMapper;

    @Override
    public int deletedDetailBySenctionId(Integer sectionId) {
        QueryWrapper<SmartSectionDetail> queryWrapper = new QueryWrapper();
        queryWrapper.eq("section_id", sectionId);
        int deleteDetail = smartSectionDetailMapper.delete(queryWrapper);
        return deleteDetail;
    }

    @Override
    public List<SmartSectionDetail> getSmartByIds(List<Integer> ids) {
        QueryWrapper<SmartSectionDetail> queryWrapper = new QueryWrapper();
        queryWrapper.in("section_id", ids);
        List<SmartSectionDetail> sectionDetails = smartSectionDetailMapper.selectList(queryWrapper);
        return sectionDetails;
    }
}
