package com.yeejoin.amos.boot.module.tdc.biz.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.yeejoin.amos.boot.module.tdc.api.entity.SubmitRecord;
import com.yeejoin.amos.boot.module.tdc.api.mapper.SubmitRecordMapper;
import com.yeejoin.amos.boot.module.tdc.api.service.SubmitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;


/**
 * @author DELL
 */
@Service
public class SubmitRecordServiceImpl extends ServiceImpl<SubmitRecordMapper, SubmitRecord> implements SubmitRecordService {

    @Autowired
    SubmitRecordMapper submitRecordMapper;

    @Override
    public IPage<SubmitRecord> selectByOrgCode(int current, int size) {
        Page page = new Page(current,size);
        return submitRecordMapper.selectByOrgCode(page);
    }

    @Override
    public int saveSubmitRecord(SubmitRecord submitRecord) {
        return this.baseMapper.insert(submitRecord);
    }

    @Override
    public SubmitRecord updateById(Long sequenceNbr, String batchNo) {
        SubmitRecord submitRecord = this.getById(sequenceNbr);
        submitRecord.setBatchNo(batchNo);
        this.updateById(submitRecord);
        return submitRecord;
    }
}
