whyclxw
2025-04-21 3a6d4de77253bb86aed3383f9b9c54be5c25752c
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
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.LockBlDto;
import com.whyc.dto.Response;
import com.whyc.mapper.LockBlMapper;
import com.whyc.pojo.plus_inf.LockBl;
import com.whyc.util.ActionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
 
@Service
public class LockBlService {
    @Autowired(required = false)
    private LockBlMapper mapper;
 
    //设定锁的蓝牙开启时间段
    public Response setLockBl( List<LockBl> list) {
        for (LockBl lockBl : list) {
            lockBl.setCreateTime(new Date());
            lockBl.setType(1);//默认开启
            mapper.insert(lockBl);
        }
        return new Response().set(1,true,"设定锁的蓝牙开启时间段");
    }
   //查询锁的蓝牙开启时间段记录
    public Response getLockBl( LockBlDto dto) {
        PageHelper.startPage(dto.getPageNum(),dto.getPageSize());
        List<LockBl> list=mapper.getLockBl(dto);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list!=null,pageInfo,"查询锁的蓝牙开启时间段记录");
    }
    //锁的蓝牙开启时间段取消
    public Response cancelLockBl(Integer num) {
        UpdateWrapper wrapper=new UpdateWrapper();
        wrapper.set("type",2);//取消
        wrapper.eq("num",num);
        int flag=mapper.update((LockBl) ActionUtil.objeNull,wrapper);
        return new Response().set(1,flag>0,flag>0?"取消成功":"段取消失败");
    }
}