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

import cn.hnthyy.thmz.entity.his.mz.MzyZdReqtype;
import cn.hnthyy.thmz.mapper.his.mz.MzyZdReqtypeMapper;
import cn.hnthyy.thmz.service.his.mz.MzyZdReqtypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MzyZdReqtypeServiceImpl implements MzyZdReqtypeService {
    @SuppressWarnings("all")
    @Autowired
    private MzyZdReqtypeMapper mzyZdReqtypeMapper;
    @Override
    public List<MzyZdReqtype> queryMzyZdReqtype() {
        return mzyZdReqtypeMapper.selectMzyZdReqtype();
    }

    @Override
    public int saveMzyZdReqtype(MzyZdReqtype mzyZdReqtype) {
        return mzyZdReqtypeMapper.insetMzyZdReqtype(mzyZdReqtype);
    }

    @Override
    public int modifyMzyZdReqtype(MzyZdReqtype mzyZdReqtype) {
        return mzyZdReqtypeMapper.updateMzyZdReqtype(mzyZdReqtype);
    }

    @Override
    public int removeMzyZdReqtype(String code) {
        return mzyZdReqtypeMapper.deleteMzyZdReqtype(code);
    }

    @Override
    public String getNewCode() {
       String newCode=mzyZdReqtypeMapper.selectNewCode();
       if(newCode==null){
           return "01";
       }
       Integer code=Integer.valueOf(newCode);
       if(code<10){
           return "0"+code;
       }
        return code.toString();
    }
}
