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

import cn.hnthyy.thmz.entity.thmz.DispensingWindows;
import cn.hnthyy.thmz.mapper.thmz.DispensingWindowsMapper;
import cn.hnthyy.thmz.service.thmz.DispensingWindowsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class DispensingWindowsServiceImpl implements DispensingWindowsService {
    @SuppressWarnings("all")
    @Autowired
    private DispensingWindowsMapper dispensingWindowsMapper;
    @Override
    public int saveDispensingWindows(DispensingWindows dispensingWindows) {
        if(dispensingWindows.getId()==null){
            return dispensingWindowsMapper.insertDispensingUser(dispensingWindows);
        }
        dispensingWindows.setUpdateDate(new Date());
        return dispensingWindowsMapper.updateDispensingWindows(dispensingWindows);

    }

    @Override
    public DispensingWindows queryLastDispensingWindowsByUserIdCode(String userIdCode,String ipAddress) {
        return dispensingWindowsMapper.selectLastDispensingWindowsByUserIdCode(userIdCode,ipAddress);
    }

    @Override
    public int modifyDispensingWindows(DispensingWindows dispensingWindows) {
        return dispensingWindowsMapper.updateDispensingWindows(dispensingWindows);
    }

}
