package com.yunzhi.marketing.eContract.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yunzhi.marketing.base.ResponseBean;
import com.yunzhi.marketing.eContract.entity.TaCompanyOrg;
import com.yunzhi.marketing.eContract.mapper.TaCompanyOrgMapper;
import com.yunzhi.marketing.eContract.service.ITaCompanyOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 企业和组织关系表  服务实现类
 * </p>
 *
 * @author fxf
 * @since 2020-03-26
 */
@Service
public class TaCompanyOrgServiceImpl extends ServiceImpl<TaCompanyOrgMapper, TaCompanyOrg> implements ITaCompanyOrgService {

    @Autowired
    private TaCompanyOrgMapper taCompanyOrgMapper;

    public ResponseBean listCompanyOrg(Integer pageNum, Integer pageSize, String companyName, String companyCode, String certifiedStatus,
                                       Integer companyStatus, String orgName, String miniAppName) {
        ResponseBean responseBean = new ResponseBean();

        // 组装分页
        IPage<TaCompanyOrg> pg = new Page<>(pageNum, pageSize);
        pg = taCompanyOrgMapper.listCompanyAndOrg(pg, companyName, companyCode, certifiedStatus, companyStatus, orgName, miniAppName);
        responseBean.addSuccess(pg);
        return responseBean;
    }
}
