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);
|
}
|
}
|