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

import cn.hnthyy.thmz.entity.his.mz.MzyZdChargeType;
import cn.hnthyy.thmz.mapper.his.mz.MzyZdChargeTypeMapper;
import cn.hnthyy.thmz.service.his.mz.MzyZdChargeTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MzyZdChargeTypeServiceImpl implements MzyZdChargeTypeService {
    @SuppressWarnings("all")
    @Autowired
    private MzyZdChargeTypeMapper mzyZdChargeTypeMapper;
    @Override
    public List<MzyZdChargeType> queryAllMzyZdChargeType() {
        return mzyZdChargeTypeMapper.selectAllMzyZdChargeType();
    }

    @Override
    public MzyZdChargeType queryByCode(String code) {
        return mzyZdChargeTypeMapper.selectByCode(code);
    }

    @Override
    public int queryCountByReqType(String reqType) {
        return mzyZdChargeTypeMapper.selectCountByReqType(reqType);
    }

    @Override
    public int modifyMzyZdChargeType(MzyZdChargeType mzyZdChargeType) {
        return mzyZdChargeTypeMapper.updateMzyZdChargeType(mzyZdChargeType);
    }

    @Override
    public int saveMzyZdChargeType(MzyZdChargeType mzyZdChargeType) {
        return mzyZdChargeTypeMapper.insetMzyZdChargeType(mzyZdChargeType);
    }

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