package com.whyc.service;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.whyc.mapper.CircleInfMapper;
|
import com.whyc.pojo.CircleInf;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
|
@Service
|
public class CircleInfService {
|
|
@Resource
|
private CircleInfMapper mapper;
|
|
public int add(CircleInf circleInf){
|
return mapper.insert(circleInf);
|
}
|
|
public void updateByDeviceId(CircleInf circleInf){
|
UpdateWrapper<CircleInf> wrapper = new UpdateWrapper<CircleInf>().eq("device_id",circleInf.getDeviceId());
|
mapper.update(circleInf,wrapper);
|
}
|
|
public void deleteByDeviceId(Integer deviceId){
|
QueryWrapper<CircleInf> wrapper = new QueryWrapper<CircleInf>().eq("device_id",deviceId);
|
mapper.delete(wrapper);
|
}
|
//获取动环的设备id
|
public String getDeviceId() {
|
Integer devId = mapper.getMaxDeviceId();
|
if(devId==null||devId==0){
|
devId = 120*1000000;
|
}
|
devId+=1;
|
return String.valueOf(devId);
|
}
|
}
|