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

import cn.hnthyy.thmz.entity.thmz.Windows;
import cn.hnthyy.thmz.mapper.thmz.WindowsMapper;
import cn.hnthyy.thmz.service.thmz.WindowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class WindowsServiceImpl implements WindowsService {
    @SuppressWarnings("all")
    @Autowired
    private WindowsMapper windowsMapper;
    @Override
    public int saveWindows(Windows windows) {
        if(windows.getId()==null){
            return windowsMapper.insertUser(windows);
        }
        windows.setUpdateDate(new Date());
        return windowsMapper.updateWindows(windows);

    }

    @Override
    public Windows queryLastWindowsByUserIdCode(String userIdCode,String ipAddress) {
        return windowsMapper.selectLastWindowsByUserIdCode(userIdCode,ipAddress);
    }

    @Override
    public int modifyWindows(Windows windows) {
        return windowsMapper.updateWindows(windows);
    }

}
