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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.carapi.common.aop.BuildChildrenRegionWrapper;
import com.ningdatech.carapi.company.entity.CompanySecurityGovernment;
import com.ningdatech.carapi.company.entity.dto.CompanySecurityCommitmentParam;
import com.ningdatech.carapi.company.mapper.NdCompanySecurityGovernmentMapper;
import com.ningdatech.carapi.company.service.ICompanySecurityGovernmentService;
import com.ningdatech.carapi.datascope.aop.LambdaDataScope;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 安全 管理机构
 * </p>
 *
 * @author zpf
 * @since 2023-05-23
 */
@Service
@RequiredArgsConstructor
public class NdCompanySecurityGovernmentServiceImpl extends ServiceImpl<NdCompanySecurityGovernmentMapper, CompanySecurityGovernment> implements ICompanySecurityGovernmentService {

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

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

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