package com.engine.salary.service.impl;

import com.engine.core.impl.Service;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.param.QueryAccountDetailParam;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.mapper.siaccount.SIAccountDetailMapper;
import com.engine.salary.service.SIReportService;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;

import java.util.List;


public class SIReportServiceImpl extends Service implements SIReportService {

    private EncryptUtil encryptUtil = new EncryptUtil();

    private SIAccountDetailMapper getSIAccountDetailMapper(){
        return MapperProxyFactory.getProxy(SIAccountDetailMapper.class);
    }

    @Override
    public PageInfo<InsuranceAccountDetailPO> welfareList(QueryAccountDetailParam param) {
        List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getSIAccountDetailMapper().listSome(param);
        PageInfo<InsuranceAccountDetailPO> page = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(),
                insuranceAccountDetailPOS ,InsuranceAccountDetailPO.class);
        List<InsuranceAccountDetailPO> list = page.getList();
        encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
        page.setList(list);
        return page;
    }
}
