package com.ningdatech.carapi.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper;
import com.ningdatech.carapi.company.entity.CompanySecurityProductRegulation;
import com.ningdatech.carapi.company.entity.dto.CompanySecurityProductRegulationParam;
import com.ningdatech.carapi.company.mapper.CompanySecurityProductRegulationsFileMapper;
import com.ningdatech.carapi.company.service.ICompanySecurityProductRegulationsFileService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 安全生产制度体系 服务实现类
 * </p>
 *
 * @author CMM
 * @since 2023-05-24
 */
@Service
public class CompanySecurityProductRegulationsFileServiceImpl extends ServiceImpl<CompanySecurityProductRegulationsFileMapper, CompanySecurityProductRegulation> implements ICompanySecurityProductRegulationsFileService {

    @Override
    @BuildChildrenRegionWrapper(wrapperIndex = 1,entityIndex = 2)
    @LambdaDataScope(wrapperIndex = 1)
    public Page<CompanySecurityProductRegulation> pageDataScope(Page<CompanySecurityProductRegulation> page, LambdaQueryWrapper<CompanySecurityProductRegulation> wrapper, CompanySecurityProductRegulationParam param) {
        return page(page,wrapper);
    }

    @Override
    @BuildChildrenRegionWrapper
    @LambdaDataScope
    public List<CompanySecurityProductRegulation> dataScopeList(LambdaQueryWrapper<CompanySecurityProductRegulation> wrapper, CompanySecurityProductRegulationParam param) {
        return baseMapper.selectList(wrapper);
    }

    @Override
    public void deleteById(Long id) {
        baseMapper.deleteById(id);
    }
}
