whyclxw
2025-05-15 96510a549bfb313920bf297b28089c4cf57f0146
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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,"查询开锁日志");
    }
}