package com.ozs.base.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ozs.base.domain.BaseAgency;
import com.ozs.base.domain.BaseExpert;
import com.ozs.base.mapper.BaseExpertMapper;
import com.ozs.base.mapper.BaseSupplierMapper;
import com.ozs.base.service.BaseExpertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BaseExpertServiceImpl extends ServiceImpl<BaseExpertMapper, BaseExpert> implements BaseExpertService {

    @Autowired
    private BaseExpertMapper baseExpertMapper;

    @Override
    public int insertExpert(BaseExpert baseExpert) {
        return baseExpertMapper.insertExpert(baseExpert);
    }

    @Override
    public int updateSupplierType(BaseExpert baseExpert) {
        LambdaUpdateWrapper<BaseExpert> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
        //eq是指你查询的条件，set是指你修改的值
        lambdaUpdateWrapper
                .eq(BaseExpert::getId, baseExpert.getId())
                .set(BaseExpert::getStatus, baseExpert.getStatus());
        return baseExpertMapper.update(null, lambdaUpdateWrapper);
    }
}
