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.IIdxBizJgSupervisionInfoService;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgSupervisionInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgSupervisionInfoMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 监督管理信息表服务实现类
 *
 * @author system_generator
 * @date 2023-08-17
 */
@Service
public class IdxBizJgSupervisionInfoServiceImpl extends BaseService<IdxBizJgSupervisionInfoMapper,IdxBizJgSupervisionInfo> implements IIdxBizJgSupervisionInfoService {

    public boolean saveOrUpdateData(IdxBizJgSupervisionInfo supervisionInfo){
        return super.saveOrUpdateWithNull(supervisionInfo);
    }

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

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

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