package com.whyc.service;
|
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.whyc.dto.LocklogDto;
|
import com.whyc.dto.Response;
|
import com.whyc.mapper.LockCtlLogMapper;
|
import com.whyc.pojo.plus_lock_ram.LockCtlLog;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
import java.util.List;
|
|
@Service
|
public class LockCtlLogService {
|
@Autowired(required = false)
|
private LockCtlLogMapper mapper;
|
|
//获取开锁错误的日志
|
public List getAllErrorLog(List lockIds) {
|
List<LockCtlLog> list=mapper.getAllErrorLog(lockIds);
|
return list;
|
}
|
|
//获取开锁日志
|
public List getAllLog(List lockIds) {
|
List<LockCtlLog> list=mapper.getAllLog(lockIds);
|
return list;
|
}
|
//添加操作记录
|
public void setLogByUid(Integer lockId, int result, String uname) {
|
LockCtlLog log=new LockCtlLog();
|
log.setLockId(lockId);
|
log.setCtlType(7);//蓝牙开锁
|
log.setCtlResult(result);
|
log.setCtlTime(new Date());
|
log.setCtlIdCard(0);
|
log.setCtlUname(uname);
|
mapper.insert(log);
|
}
|
//查询开锁日志
|
public Response getLockLog(LocklogDto logDto) {
|
PageHelper.startPage(logDto.getPageNum(),logDto.getPageSize());
|
List<LockCtlLog> list=mapper.getLockLog(logDto);
|
PageInfo pageInfo=new PageInfo(list);
|
return new Response().setII(1,list!=null,pageInfo,"查询开锁日志");
|
}
|
}
|