package cn.hnthyy.thmz.service.impl.his;

import cn.hnthyy.thmz.entity.MzException;
import cn.hnthyy.thmz.entity.his.YpConfig;
import cn.hnthyy.thmz.mapper.his.YpConfigMapper;
import cn.hnthyy.thmz.service.his.YpConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class YpConfigServiceImpl implements YpConfigService {
    @SuppressWarnings("all")
    @Autowired
    private YpConfigMapper ypConfigMapper;
    @Override
    public Integer getYfFyNo() throws MzException {
        YpConfig ypConfig=ypConfigMapper.selectYpConfig();
        if(ypConfig==null){
            throw new MzException("当前药房发药号配置不存在，请先设置！");
        }
        ypConfig.setYfFyNo(ypConfig.getYfFyNo()+1);
        ypConfigMapper.updateYpConfig(ypConfig);
        return ypConfig.getYfFyNo();
    }
}
