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

import cn.hnthyy.thmz.entity.his.zd.MzZdInstructionCode;
import cn.hnthyy.thmz.mapper.his.zd.MzZdInstructionCodeMapper;
import cn.hnthyy.thmz.pageDto.MzZdInstructionCodePageDto;
import cn.hnthyy.thmz.service.his.zd.MzZdInstructionCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MzZdInstructionCodeServiceImpl implements MzZdInstructionCodeService {
    @SuppressWarnings("all")
    @Autowired
    private MzZdInstructionCodeMapper mzZdInstructionCodeMapper;

    @Override
    public List<MzZdInstructionCode> queryMzZdInstructionByType(Integer instructionType) {
        return mzZdInstructionCodeMapper.selectMzZdInstructionByType(instructionType);
    }

    @Override
    public List<MzZdInstructionCode> queryMzZdInstructionPage(MzZdInstructionCodePageDto mzZdInstructionCodePageDto) {
        return mzZdInstructionCodeMapper.selectMzZdInstructionPage(mzZdInstructionCodePageDto);
    }

    @Override
    public int queryMzZdInstructionCount(MzZdInstructionCodePageDto mzZdInstructionCodePageDto) {
        return mzZdInstructionCodeMapper.selectMzZdInstructionCount(mzZdInstructionCodePageDto);
    }

    @Override
    public int modifyMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode) {
        return mzZdInstructionCodeMapper.updateMzZdInstructionCode(mzZdInstructionCode);
    }

    @Override
    public int modifyDelFlag(String code, Integer delFlag) {
        return mzZdInstructionCodeMapper.updateDelFlag(code,delFlag);
    }

    @Override
    public int saveMzZdInstructionCode(MzZdInstructionCode mzZdInstructionCode) {
        String code = mzZdInstructionCodeMapper.selectMaxCode();
        mzZdInstructionCode.setCode(Integer.parseInt(code)+1+"");
        return mzZdInstructionCodeMapper.insertMzZdInstructionCode(mzZdInstructionCode);
    }
}
