zhangnaisong
2024-05-31 9091740e4964c6065c6549cd1599624d0fb24cbd
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
package com.ruoyi.device.camera.service.impl;
 
import java.util.List;
 
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.device.camera.domain.ArdCameras;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
 
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.device.camera.mapper.ArdCameraUserPostionMapper;
import com.ruoyi.device.camera.domain.ArdCameraUserPostion;
import com.ruoyi.device.camera.service.IArdCameraUserPostionService;
 
/**
 * 用户预览位置Service业务层处理
 *
 * @author 刘苏义
 * @date 2024-05-08
 */
@Service
public class ArdCameraUserPostionServiceImpl implements IArdCameraUserPostionService {
    @Autowired
    private ArdCameraUserPostionMapper ardCameraUserPostionMapper;
 
    /**
     * 查询用户预览位置
     *
     * @param id 用户预览位置主键
     * @return 用户预览位置
     */
    @Override
    public ArdCameraUserPostion selectArdCameraUserPostionById(String id) {
        return ardCameraUserPostionMapper.selectArdCameraUserPostionById(id);
    }
 
    @Override
    public ArdCameras selectArdCameraUserPostionByPosition(String position) {
        ArdCameraUserPostion ardCameraUserPostion = new ArdCameraUserPostion();
        ardCameraUserPostion.setUserId(SecurityUtils.getUserId());
        ardCameraUserPostion.setPosition(position);
        ArdCameras ardCameras = ardCameraUserPostionMapper.selectArdCameraUserPostionByPosition(ardCameraUserPostion);
        return ardCameras;
    }
 
    /**
     * 查询用户预览位置列表
     *
     * @param ardCameraUserPostion 用户预览位置
     * @return 用户预览位置
     */
    @Override
    public List<ArdCameraUserPostion> selectArdCameraUserPostionList(ArdCameraUserPostion ardCameraUserPostion) {
        return ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion);
    }
 
    /**
     * 新增用户预览位置
     *
     * @param ardCameraUserPostion 用户预览位置
     * @return 结果
     */
    @Override
    public int insertArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) {
        ardCameraUserPostion.setUserId(SecurityUtils.getUserId());
        List<ArdCameraUserPostion> ardCameraUserPostions = ardCameraUserPostionMapper.selectArdCameraUserPostionList(ardCameraUserPostion);
        if (ardCameraUserPostions.size() > 0) {
            return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion);
        } else {
            ardCameraUserPostion.setId(IdUtils.simpleUUID());
            return ardCameraUserPostionMapper.insertArdCameraUserPostion(ardCameraUserPostion);
        }
    }
 
    /**
     * 修改用户预览位置
     *
     * @param ardCameraUserPostion 用户预览位置
     * @return 结果
     */
    @Override
    public int updateArdCameraUserPostion(ArdCameraUserPostion ardCameraUserPostion) {
        return ardCameraUserPostionMapper.updateArdCameraUserPostion(ardCameraUserPostion);
    }
 
    /**
     * 批量删除用户预览位置
     *
     * @param ids 需要删除的用户预览位置主键
     * @return 结果
     */
    @Override
    public int deleteArdCameraUserPostionByIds(String[] ids) {
        return ardCameraUserPostionMapper.deleteArdCameraUserPostionByIds(ids);
    }
 
    /**
     * 删除用户预览位置信息
     *
     * @param id 用户预览位置主键
     * @return 结果
     */
    @Override
    public int deleteArdCameraUserPostionById(String id) {
        return ardCameraUserPostionMapper.deleteArdCameraUserPostionById(id);
    }
}