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

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.carapi.company.entity.NdCompanySecurityProductExecute;
import com.ningdatech.carapi.company.entity.dto.ResSecurityProductExecuteDTO;
import com.ningdatech.carapi.company.entity.po.CompanySecurityProductExecutePO;
import com.ningdatech.carapi.company.mapper.NdCompanySecurityProductExecuteMapper;
import com.ningdatech.carapi.company.service.INdCompanySecurityProductExecuteService;
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 NdCompanySecurityProductExecuteServiceImpl extends ServiceImpl<NdCompanySecurityProductExecuteMapper, NdCompanySecurityProductExecute> implements INdCompanySecurityProductExecuteService {

    private final NdCompanySecurityProductExecuteMapper ndCompanySecurityProductExecuteMapper;

    @Override
    public Page<ResSecurityProductExecuteDTO> securityProductExecuteList(String name, String startTime, String endTime, Integer fileType, int pageNum, int pageSize) {
        NdCompanySecurityProductExecuteServiceImpl context = (NdCompanySecurityProductExecuteServiceImpl)AopContext.currentProxy();
        return context.searchList(new Page<>(pageNum, pageSize),new CompanySecurityProductExecutePO(name, startTime, endTime,fileType,null));

    }

    @XmlDataScope(entityIndex = 1)
    public Page<ResSecurityProductExecuteDTO> searchList(Page<ResSecurityProductExecuteDTO> page,
                                                         CompanySecurityProductExecutePO po) {
        return ndCompanySecurityProductExecuteMapper.securityProductExecuteList(page, po);
    }
}
