2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-05-17 aff6f184e7a38a1674f3067e3f6c3acc92a4fed4
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package com.sandu.ximon.admin.service;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.sandu.common.execption.BusinessException;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.AdvisementPlayerParam;
import com.sandu.ximon.dao.domain.AdvisementPlayer;
import com.sandu.ximon.dao.mapper.AdvisementPlayerMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
@AllArgsConstructor
public class AdvisementPlayerService extends BaseServiceImpl<AdvisementPlayerMapper, AdvisementPlayer> {
    private final AdvisementPlayerMapper advisementPlayerMapper;
 
    /**
     * 查询全部广告机
     */
    public List<AdvisementPlayer> listAdvisementPlayer() {
        LambdaQueryWrapper<AdvisementPlayer> wrapper = Wrappers.lambdaQuery(AdvisementPlayer.class);
        List<AdvisementPlayer> list = list(wrapper);
 
        return list;
    }
 
    /**
     * 模糊查询——广告机
     */
    public List<AdvisementPlayer> listAdvisementPlayerParamByKeyword(AdvisementPlayerParam advisementPlayerParam) {
        //设备状态:在线/离线/全部
        int equipmentState1;
        int equipmentState2;
        if (2 == advisementPlayerParam.getEquipmentState()) {
            //在线
            equipmentState1 = 1;
            //离线
            equipmentState2 = 0;
        } else {
            equipmentState1 = advisementPlayerParam.getEquipmentState();
            equipmentState2 = advisementPlayerParam.getEquipmentState();
        }
 
        //绑定状态:已绑定/未绑定/全部
        int bindingState1;
        int bindingState2;
        if (2 == advisementPlayerParam.getBindingState()) {
            //已绑定
            bindingState1 = 1;
            //未绑定
            bindingState2 = 0;
        } else {
            bindingState1 = advisementPlayerParam.getBindingState();
            bindingState2 = advisementPlayerParam.getBindingState();
        }
        return advisementPlayerMapper.listAdvisementPlayerByKeyword(advisementPlayerParam.getKeyword(), equipmentState1, equipmentState2, bindingState1, bindingState2);
    }
 
    /**
     * 删除广告机
     *
     * @param Id
     * @return
     */
    public boolean deleteAdvisementPlayer(Long Id) {
        AdvisementPlayer advisementPlayer = getById(Id);
        if (advisementPlayer == null) {
            throw new BusinessException("找不到广告机");
        }
        return removeById(Id);
    }
 
 
}