智慧保安后台管理-外网项目备份
钟日健
2026-06-01 62eb499b0c969f246d3245d1429a97da4de1ce28
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
package org.springblade.modules.location.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.modules.location.entity.LivePersonLocation;
import org.springblade.modules.location.mapper.LivePersonLocationMapper;
import org.springblade.modules.location.service.ILivePersonLocationService;
import org.springblade.modules.location.vo.LivePersonLocationVO;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
 
@Service
public class LivePersonLocationServiceImpl extends ServiceImpl<LivePersonLocationMapper, LivePersonLocation> implements ILivePersonLocationService {
    @Override
    public boolean saveOrUpdate(LivePersonLocation entity) {
        Date recordTime = DateUtil.now();
        entity.setRecordTime(recordTime);
 
        //查询数据库中是否已有该人员
        LivePersonLocation livePersonLocation = baseMapper.getUserLocation(entity.getUserId());
 
        if (livePersonLocation == null){
            return baseMapper.insert(entity)>-1;
        }else{
            entity.setId(livePersonLocation.getId());
            return baseMapper.updateById(entity)>-1;
        }
    }
 
    @Override
    public List<LivePersonLocationVO> getList(LivePersonLocationVO livePersonLocation) {
        return baseMapper.getList(livePersonLocation);
    }
}