package cn.com.qmth.stmms.biz.config.service.impl;

import java.util.Date;
import java.util.List;

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

import cn.com.qmth.stmms.biz.common.BaseQueryService;
import cn.com.qmth.stmms.biz.config.dao.SystemAuthDao;
import cn.com.qmth.stmms.biz.config.model.SystemAuth;
import cn.com.qmth.stmms.biz.config.service.SystemAuthService;

@Service("systemAuthService")
public class SystemAuthServiceImpl extends BaseQueryService<SystemAuth> implements SystemAuthService {

    @Autowired
    private SystemAuthDao authDao;

    @Override
    public SystemAuth findOne() {
        List<SystemAuth> list = (List<SystemAuth>) authDao.findAll();
        return list.isEmpty() ? null : list.get(0);
    }

    @Override
    public SystemAuth save(SystemAuth systemAuth) {
        systemAuth.setUpdateTime(new Date());
        return authDao.save(systemAuth);
    }

}
