package com.trade.service.serialNum.service.impl;


import com.trade.service.serialNum.domain.SystemSerialNum;
import com.trade.service.serialNum.mapper.SystemSerialNumMapper;
import com.trade.service.serialNum.service.SystemSerialNumService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SystemSerialNumServiceImpl implements SystemSerialNumService {

    @Autowired
    private SystemSerialNumMapper sysSerialNumMapper;

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

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

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