package com.zd.bottle.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zd.bottle.domain.UsegasApply;
import com.zd.bottle.mapper.UsegasApplyMapper;
import com.zd.bottle.service.UsegasApplyService;
import com.zd.bottle.vo.AirAmount;
import com.zd.bottle.vo.UsegasApplyTabVo;
import com.zd.bottle.vo.UsegasApplyVo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用气申请表 服务实现类
 * </p>
 *
 * @author hanson
 * @since 2022-09-08
 */
@Service
public class UsegasApplyServiceImpl extends ServiceImpl<UsegasApplyMapper, UsegasApply> implements UsegasApplyService {

    @Override
    public List <UsegasApplyVo> selectUseagsApplyList(UsegasApply usegasApply) {
        return baseMapper.selectUseagsApplyList(usegasApply);
    }

    @Override
    public UsegasApplyTabVo selectApplyTabCount(UsegasApply usegasApply) {
        return baseMapper.selectApplyTabCount(usegasApply);
    }

    @Override
    public List<AirAmount> calcApply(String airName) {
        return baseMapper.calcApply(airName);
    }


    public Boolean updatetUseagsApply(Long applyId,Long auditStatus){
        LambdaUpdateWrapper<UsegasApply> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
        lambdaUpdateWrapper.eq(UsegasApply::getId,applyId).set(UsegasApply::getLeadAuditStaus,auditStatus);
        return update(lambdaUpdateWrapper);
    }
}
