package com.chinaweal.aiccs.aiccs.revoke.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.chinaweal.aiccs.aiccs.revoke.entity.BizRevEnt;
import com.chinaweal.aiccs.aiccs.revoke.entity.Tsbizrevlist;
import com.chinaweal.aiccs.aiccs.revoke.entity.dto.AttachmentWritDto;
import com.chinaweal.aiccs.aiccs.revoke.entity.dto.BizRevEntAttachDto;
import com.chinaweal.aiccs.aiccs.revoke.mapper.BizRevEntMapper;
import com.chinaweal.aiccs.aiccs.revoke.service.BizRevEntService;
import com.chinaweal.youfool.framework.springboot.mybatis.plus.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Lee
 * @since 2022-02-15
 */
@Service
public class BizRevEntServiceImpl extends BaseServiceImpl<BizRevEntMapper, BizRevEnt> implements BizRevEntService {

//    @Override
//    public Tsbizrevlist getFirstEnt(String bizseq) {
//        return baseMapper.selectFirstEnt(bizseq).get(0);
//    }

    @Override
    public List<BizRevEnt> getListByBizseq(String bizseq) {
        LambdaQueryWrapper<BizRevEnt> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(BizRevEnt::getBizseq,bizseq)
                .eq(BizRevEnt::getIsremove,"0")
                .orderByAsc(BizRevEnt::getInserttime);
        return list(wrapper);
    }

    @Override
    public boolean insertOrUpdateBatch(List<BizRevEnt> list) {
        return baseMapper.insertOrUpdateBatch(list);
    }

    @Override
    public List<BizRevEntAttachDto> getBizEntAttachList(String bizseq, String attachType) {
        return baseMapper.selectBizEntAttachList(bizseq,attachType);
    }
}
