package com.yeejoin.amos.boot.module.jg.biz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yeejoin.amos.boot.module.jg.biz.core.BaseService;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgOtherInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 安全追溯-其他信息表服务实现类
 *
 * @author system_generator
 * @date 2023-08-17
 */
@Service
public class IdxBizJgOtherInfoServiceImpl extends BaseService<IdxBizJgOtherInfoMapper, IdxBizJgOtherInfo> implements IIdxBizJgOtherInfoService {

    public boolean saveOrUpdateData(IdxBizJgOtherInfo otherInfo) {
        return super.saveOrUpdateWithNull(otherInfo);
    }

    @Override
    public IdxBizJgOtherInfo getOneData(String record) {
        return this.getOne(new QueryWrapper<IdxBizJgOtherInfo>().eq("RECORD", record));
    }

    @Override
    public void saveBatch(List<IdxBizJgOtherInfo> otherInfoList) {
        super.saveBatch(otherInfoList);
    }

    @Override
    public boolean saveOrUpdateBatch(List<IdxBizJgOtherInfo> otherInfoList) {
        return super.saveOrUpdateBatch(otherInfoList);
    }

    @Override
    public void updateBatchByRecord(List<IdxBizJgOtherInfo> toUpdateOtherInfoList) {
        toUpdateOtherInfoList.forEach(info -> super.update(info, new LambdaUpdateWrapper<IdxBizJgOtherInfo>().eq(IdxBizJgOtherInfo::getRecord, info.getRecord())));
    }
}