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

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.carapi.company.entity.NdCompanySecurityProductRegulations;
import com.ningdatech.carapi.company.entity.dto.ResSecurityProductRegulationsDTO;
import com.ningdatech.carapi.company.entity.po.CompanySecurityProductRegulationPO;
import com.ningdatech.carapi.company.mapper.NdCompanySecurityProductRegulationsMapper;
import com.ningdatech.carapi.company.service.INdCompanySecurityProductRegulationsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ningdatech.carapi.datascope.aop.XmlDataScope;
import lombok.RequiredArgsConstructor;
import org.springframework.aop.framework.AopContext;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 安全生产制度体系 服务实现类
 * </p>
 *
 * @author liushuai
 * @since 2022-10-10
 */
@Service
@RequiredArgsConstructor
public class NdCompanySecurityProductRegulationsServiceImpl extends ServiceImpl<NdCompanySecurityProductRegulationsMapper, NdCompanySecurityProductRegulations> implements INdCompanySecurityProductRegulationsService {

    private final NdCompanySecurityProductRegulationsMapper ndCompanySecurityProductRegulationsMapper;

    @Override
    public Page<ResSecurityProductRegulationsDTO> securityProductRegulationsList(String regulationsName, String competentDepartment, String startTime, String endTime, Integer fileType, int pageNum, int pageSize) {
        NdCompanySecurityProductRegulationsServiceImpl context = (NdCompanySecurityProductRegulationsServiceImpl)AopContext.currentProxy();
        return context.searchList(new Page<>(pageNum, pageSize),
                new CompanySecurityProductRegulationPO(regulationsName, competentDepartment, startTime, endTime, fileType,null));
    }

    @XmlDataScope(entityIndex = 1)
    public Page<ResSecurityProductRegulationsDTO> searchList(Page<ResSecurityProductRegulationsDTO> page, CompanySecurityProductRegulationPO po) {
        return ndCompanySecurityProductRegulationsMapper.securityProductRegulationsList(page,po);
    }
}
