|
@@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zy.bms.common.io.wechat.UserDeviceRelationIO;
|
|
|
import com.zy.bms.mapper.UserDeviceRelationMapper;
|
|
|
import com.zy.bms.model.UserDeviceRelation;
|
|
|
-import com.zy.bms.common.vo.DeviceVo;
|
|
|
+import com.zy.bms.common.vo.DeviceRelationVo;
|
|
|
import com.zy.bms.utils.BeanUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -45,8 +45,11 @@ public class RelationService extends ServiceImpl<UserDeviceRelationMapper, UserD
|
|
|
*
|
|
|
* @param deviceNum 设备号
|
|
|
*/
|
|
|
- public void delByDeviceNum(String deviceNum) {
|
|
|
- baseMapper.delete(new QueryWrapper<UserDeviceRelation>().eq("deviceNum", deviceNum));
|
|
|
+ public void unbind(String deviceNum, String userId) {
|
|
|
+ QueryWrapper<UserDeviceRelation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("deviceNum", deviceNum);
|
|
|
+ queryWrapper.eq("userId", userId);
|
|
|
+ baseMapper.delete(queryWrapper);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -54,7 +57,7 @@ public class RelationService extends ServiceImpl<UserDeviceRelationMapper, UserD
|
|
|
*
|
|
|
* @param userId 用户ID
|
|
|
*/
|
|
|
- public List<DeviceVo> getListByUserId(String userId) {
|
|
|
+ public List<DeviceRelationVo> getListByUserId(String userId) {
|
|
|
return baseMapper.getListByUserId(userId);
|
|
|
}
|
|
|
|
|
@@ -63,7 +66,9 @@ public class RelationService extends ServiceImpl<UserDeviceRelationMapper, UserD
|
|
|
*
|
|
|
* @param deviceNum 设备号
|
|
|
*/
|
|
|
- public UserDeviceRelation getByDeviceNum(String deviceNum) {
|
|
|
- return baseMapper.selectOne(new QueryWrapper<UserDeviceRelation>().eq("deviceNum", deviceNum));
|
|
|
+ public boolean isBind(String deviceNum) {
|
|
|
+ QueryWrapper<UserDeviceRelation> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("deviceNum", deviceNum);
|
|
|
+ return baseMapper.selectCount(queryWrapper) > 0;
|
|
|
}
|
|
|
}
|