package com.gic.haoban.manage.service.service.impl;

import com.gic.commons.util.UniqueIdUtils;
import com.gic.haoban.manage.service.dao.mapper.OpenStaffMapper;
import com.gic.haoban.manage.service.entity.TabOpenStaff;
import com.gic.haoban.manage.service.service.OpenStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service("openStaffService")
public class OpenStaffServiceImpl implements OpenStaffService {

    @Autowired
    private OpenStaffMapper openStaffMapper ;

    @Override
    public TabOpenStaff save(TabOpenStaff tab) {
        tab.setUpdateTime(new Date());
        if(null == tab.getOpenStaffId()) {
            tab.setOpenStaffId(UniqueIdUtils.uniqueLong());
            tab.setDeleteFlag(0);
            tab.setStatusFlag(2);
            tab.setCreateTime(new Date());
            this.openStaffMapper.insert(tab) ;
        }else {
            this.openStaffMapper.update(tab) ;
        }
        return tab ;
    }
}
