package com.chinaweal.aiccs.crgs.moveinDetails.service.impl;

import com.chinaweal.aiccs.crgs.moveinDetails.entity.EAlterRecoder;
import com.chinaweal.aiccs.crgs.moveinDetails.mapper.EAlterRecoderMapper;
import com.chinaweal.aiccs.crgs.moveinDetails.service.EAlterRecoderService;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 变更备案信息 服务实现类
 * </p>
 *
 * @author sh
 * @since 2021-12-27
 */
@Service
public class EAlterRecoderServiceImpl extends BaseServiceImpl<EAlterRecoderMapper, EAlterRecoder> implements EAlterRecoderService {

    @Resource
    private EAlterRecoderMapper eAlterRecoderMapper;
    @Override
    public List<EAlterRecoder> queryEAlterByEntNo(String pripid) {
        List<EAlterRecoder> listall = eAlterRecoderMapper.queryEAlterByPripid(pripid);
        List<EAlterRecoder> listnew = new ArrayList<>();

        if (listall.size() > 0) {
            EAlterRecoder eAlterRecoder = listall.get(0);
            for (int i = 0; i < listall.size(); i++) {
                if (eAlterRecoder.getAltdate().equals(listall.get(i).getAltdate())){
                    listnew.add(listall.get(i));
                }
            }
        }
        return listnew;
    }
}
