package com.sunxung.factoring.service.sys.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.sunxung.factoring.entity.sys.SystemSerialNum;
import com.sunxung.factoring.mapper.sys.SystemSerialNumMapper;
import com.sunxung.factoring.service.sys.SystemSerialNumService;

@Service
public class SystemSerialNumServiceImpl implements SystemSerialNumService {

    @Autowired
    private SystemSerialNumMapper sysSerialNumMapper;

    @Override
    public SystemSerialNum add(SystemSerialNum sysSerialNum) {
        sysSerialNumMapper.add(sysSerialNum);
        return get(sysSerialNum.getId());
    }

    @Override
    public SystemSerialNum update(SystemSerialNum sysSerialNum) {
        if (null != sysSerialNum && null != sysSerialNum.getId()) {
            sysSerialNumMapper.update(sysSerialNum);
        }
        return get(sysSerialNum.getId());
    }

    @Override
    public SystemSerialNum get(Long id) {
        return sysSerialNumMapper.get(id);
    }

    @Override
    public SystemSerialNum getByName(String name) {
        return sysSerialNumMapper.getByName(name);
    }
}
