|
|
@@ -1,9 +1,12 @@
|
|
|
package com.platform.service.impl;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.platform.entity.IotDeviceGroup;
|
|
|
import com.platform.mapper.IotDeviceGroupMapper;
|
|
|
import com.platform.service.IotDeviceGroupService;
|
|
|
+import org.checkerframework.common.returnsreceiver.qual.This;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
/**
|
|
|
@@ -15,4 +18,51 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
@Service
|
|
|
public class IotDeviceGroupServiceImpl extends ServiceImpl<IotDeviceGroupMapper, IotDeviceGroup> implements IotDeviceGroupService {
|
|
|
+ @Override
|
|
|
+ public IotDeviceGroup getOneByTitle(String title) {
|
|
|
+ return getOne( Wrappers.<IotDeviceGroup>lambdaQuery()
|
|
|
+ .eq(IotDeviceGroup::getTitle,title)
|
|
|
+ .eq(IotDeviceGroup::getDelFlag,0)
|
|
|
+ .last("limit 1"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean addDeviceGroup(IotDeviceGroup iotDeviceGroup) {
|
|
|
+ return save(iotDeviceGroup);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean updateDeviceGroup(IotDeviceGroup iotDeviceGroup) {
|
|
|
+
|
|
|
+ return update(iotDeviceGroup,Wrappers.<IotDeviceGroup>lambdaUpdate()
|
|
|
+ .eq(IotDeviceGroup::getDeviceGroupCode,iotDeviceGroup.getDeviceGroupCode())
|
|
|
+ .eq(IotDeviceGroup::getDelFlag,0));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean delDeviceGroup(String deviceGroupCode) {
|
|
|
+ IotDeviceGroup iotDeviceGroup = new IotDeviceGroup();
|
|
|
+ iotDeviceGroup.setDelFlag(1);
|
|
|
+ return update(iotDeviceGroup,Wrappers.<IotDeviceGroup>lambdaUpdate()
|
|
|
+ .eq(IotDeviceGroup::getDeviceGroupCode,deviceGroupCode));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public IotDeviceGroup getDeviceGroupDetail(IotDeviceGroup iotDeviceGroup) {
|
|
|
+ return getOne(Wrappers.<IotDeviceGroup>lambdaQuery()
|
|
|
+ .eq(IotDeviceGroup::getDeviceGroupCode,iotDeviceGroup.getDeviceGroupCode())
|
|
|
+ .eq(IotDeviceGroup::getDelFlag,0)
|
|
|
+ .last("limit 1"));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page pageGroupDevice(Integer current, Integer pageSize, IotDeviceGroup iotDeviceGroup) {
|
|
|
+ Page<IotDeviceGroup> page = new Page<>(current, pageSize);
|
|
|
+ return page(page,Wrappers.<IotDeviceGroup>lambdaQuery()
|
|
|
+ .eq(IotDeviceGroup::getDelFlag,0)
|
|
|
+ .orderByDesc(IotDeviceGroup::getCreateTime)
|
|
|
+ .orderByDesc(IotDeviceGroup::getId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|