refactor: 重构
parent
7e48dfd5a3
commit
1b72784166
|
@ -2,6 +2,7 @@ package cc.iotkit.common.api;
|
|||
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.common.utils.SnowflakeIdGeneratorUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
@ -87,4 +88,6 @@ public class PageRequest<T> extends Request<T> implements Serializable {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -13,10 +13,11 @@ import cc.iotkit.data.model.TbProtocolComponent;
|
|||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProtocolComponentRepository extends JpaRepository<TbProtocolComponent, String> {
|
||||
public interface ProtocolComponentRepository extends JpaRepository<TbProtocolComponent, String>, QuerydslPredicateExecutor<TbProtocolComponent>{
|
||||
|
||||
List<TbProtocolComponent> findByState(String state);
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -30,12 +31,22 @@ public class AlertConfigDataImpl implements IAlertConfigData {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlertConfig> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertConfig save(AlertConfig data) {
|
||||
alertConfigRepository.save(MapstructUtils.convert(data, TbAlertConfig.class));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<AlertConfig> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -43,10 +54,12 @@ public class AlertConfigDataImpl implements IAlertConfigData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return 0;
|
||||
|
@ -58,10 +71,21 @@ public class AlertConfigDataImpl implements IAlertConfigData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<AlertConfig> findAll(int page, int size) {
|
||||
public Paging<AlertConfig> findAll(PageRequest<AlertConfig> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlertConfig> findAllByCondition(AlertConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertConfig findOneByCondition(AlertConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Paging<AlertConfig> selectAlertConfigPage(PageRequest<AlertConfig> request) {
|
||||
Page<TbAlertConfig> alertConfigPage = alertConfigRepository.findAll(Pageable.ofSize(request.getPageSize()).withPage(request.getPageNum() - 1));
|
||||
|
|
|
@ -8,6 +8,7 @@ import cc.iotkit.data.model.TbAlertRecord;
|
|||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.model.alert.AlertRecord;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -29,11 +30,21 @@ public class AlertRecordDataImpl implements IAlertRecordData {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlertRecord> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertRecord save(AlertRecord data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<AlertRecord> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -41,10 +52,11 @@ public class AlertRecordDataImpl implements IAlertRecordData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return 0;
|
||||
|
@ -56,10 +68,21 @@ public class AlertRecordDataImpl implements IAlertRecordData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<AlertRecord> findAll(int page, int size) {
|
||||
public Paging<AlertRecord> findAll(PageRequest<AlertRecord> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AlertRecord> findAllByCondition(AlertRecord data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertRecord findOneByCondition(AlertRecord data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Paging<AlertRecord> selectAlertConfigPage(PageRequest<AlertRecord> request) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.ICategoryData;
|
||||
import cc.iotkit.data.dao.CategoryRepository;
|
||||
|
@ -20,6 +21,7 @@ import org.springframework.context.annotation.Primary;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -35,6 +37,11 @@ public class CategoryDataImpl implements ICategoryData {
|
|||
return MapstructUtils.convert(categoryRepository.findById(s).orElse(null), Category.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Category> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category save(Category data) {
|
||||
TbCategory tb = categoryRepository.save(MapstructUtils.convert(data, TbCategory.class));
|
||||
|
@ -42,16 +49,23 @@ public class CategoryDataImpl implements ICategoryData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<Category> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
categoryRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return categoryRepository.count();
|
||||
|
@ -65,12 +79,20 @@ public class CategoryDataImpl implements ICategoryData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<Category> findAll(int page, int size) {
|
||||
return new Paging<>(
|
||||
categoryRepository.count(),
|
||||
MapstructUtils.convert(categoryRepository.findAll(
|
||||
Pageable.ofSize(size).withPage(page - 1)).getContent(),
|
||||
Category.class));
|
||||
public Paging<Category> findAll(PageRequest<Category> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Category> findAllByCondition(Category data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category findOneByCondition(Category data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IChannelConfigData;
|
||||
import cc.iotkit.data.dao.ChannelConfigRepository;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -33,6 +35,11 @@ public class ChannelConfigDataImpl implements IChannelConfigData {
|
|||
return MapstructUtils.convert(channelConfigRepository.findById(id).orElse(null), ChannelConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelConfig> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelConfig save(ChannelConfig data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -42,16 +49,22 @@ public class ChannelConfigDataImpl implements IChannelConfigData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ChannelConfig> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
channelConfigRepository.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return channelConfigRepository.count();
|
||||
|
@ -63,10 +76,19 @@ public class ChannelConfigDataImpl implements IChannelConfigData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<ChannelConfig> findAll(int page, int size) {
|
||||
Page<TbChannelConfig> tbDeviceConfigs = channelConfigRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(
|
||||
tbDeviceConfigs.getTotalElements(),
|
||||
MapstructUtils.convert(tbDeviceConfigs.getContent(), ChannelConfig.class));
|
||||
public Paging<ChannelConfig> findAll(PageRequest<ChannelConfig> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelConfig> findAllByCondition(ChannelConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelConfig findOneByCondition(ChannelConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IChannelData;
|
||||
import cc.iotkit.data.dao.ChannelRepository;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -33,6 +35,11 @@ public class ChannelDataImpl implements IChannelData {
|
|||
return MapstructUtils.convert(channelRepository.findById(id).orElse(null), Channel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Channel> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel save(Channel data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -44,6 +51,11 @@ public class ChannelDataImpl implements IChannelData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<Channel> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
|
@ -51,10 +63,11 @@ public class ChannelDataImpl implements IChannelData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return channelRepository.count();
|
||||
|
@ -66,10 +79,19 @@ public class ChannelDataImpl implements IChannelData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<Channel> findAll(int page, int size) {
|
||||
Page<TbChannel> tbDeviceConfigs = channelRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(
|
||||
tbDeviceConfigs.getTotalElements(),
|
||||
MapstructUtils.convert(tbDeviceConfigs.getContent(), Channel.class));
|
||||
public Paging<Channel> findAll(PageRequest<Channel> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Channel> findAllByCondition(Channel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel findOneByCondition(Channel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IChannelTemplateData;
|
||||
import cc.iotkit.data.dao.ChannelTemplateRepository;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -34,6 +36,11 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData {
|
|||
return MapstructUtils.convert(channelTemplateRepository.findById(id).orElse(null), ChannelTemplate.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelTemplate> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelTemplate save(ChannelTemplate data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -43,6 +50,11 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ChannelTemplate> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
|
@ -50,10 +62,12 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return channelTemplateRepository.count();
|
||||
|
@ -67,10 +81,19 @@ public class ChannelTemplateDataImpl implements IChannelTemplateData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<ChannelTemplate> findAll(int page, int size) {
|
||||
Page<TbChannelTemplate> tbDeviceConfigs = channelTemplateRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(
|
||||
tbDeviceConfigs.getTotalElements(),
|
||||
MapstructUtils.convert(tbDeviceConfigs.getContent(), ChannelTemplate.class));
|
||||
public Paging<ChannelTemplate> findAll(PageRequest<ChannelTemplate> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ChannelTemplate> findAllByCondition(ChannelTemplate data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChannelTemplate findOneByCondition(ChannelTemplate data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IDeviceConfigData;
|
||||
import cc.iotkit.data.dao.DeviceConfigRepository;
|
||||
|
@ -22,6 +23,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -47,6 +49,11 @@ public class DeviceConfigDataImpl implements IDeviceConfigData {
|
|||
return MapstructUtils.convert(deviceConfigRepository.findById(s).orElse(null), DeviceConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceConfig> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceConfig save(DeviceConfig data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -56,6 +63,11 @@ public class DeviceConfigDataImpl implements IDeviceConfigData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<DeviceConfig> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -63,10 +75,11 @@ public class DeviceConfigDataImpl implements IDeviceConfigData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return deviceConfigRepository.count();
|
||||
|
@ -78,10 +91,19 @@ public class DeviceConfigDataImpl implements IDeviceConfigData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<DeviceConfig> findAll(int page, int size) {
|
||||
Page<TbDeviceConfig> tbDeviceConfigs = deviceConfigRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(
|
||||
tbDeviceConfigs.getTotalElements(),
|
||||
MapstructUtils.convert(tbDeviceConfigs.getContent(), DeviceConfig.class));
|
||||
public Paging<DeviceConfig> findAll(PageRequest<DeviceConfig> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceConfig> findAllByCondition(DeviceConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceConfig findOneByCondition(DeviceConfig data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IDeviceGroupData;
|
||||
import cc.iotkit.data.dao.DeviceGroupRepository;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -36,6 +38,11 @@ public class DeviceGroupDataImpl implements IDeviceGroupData {
|
|||
return MapstructUtils.convert(deviceGroupRepository.findById(s).orElse(null), DeviceGroup.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceGroup> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceGroup save(DeviceGroup data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -45,6 +52,11 @@ public class DeviceGroupDataImpl implements IDeviceGroupData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<DeviceGroup> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -52,10 +64,11 @@ public class DeviceGroupDataImpl implements IDeviceGroupData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return deviceGroupRepository.count();
|
||||
|
@ -67,8 +80,19 @@ public class DeviceGroupDataImpl implements IDeviceGroupData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<DeviceGroup> findAll(int page, int size) {
|
||||
Page<TbDeviceGroup> groups = deviceGroupRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(groups.getTotalElements(), MapstructUtils.convert(groups.getContent(), DeviceGroup.class));
|
||||
public Paging<DeviceGroup> findAll(PageRequest<DeviceGroup> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceGroup> findAllByCondition(DeviceGroup data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceGroup findOneByCondition(DeviceGroup data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.ReflectUtil;
|
||||
import cc.iotkit.data.manager.ICategoryData;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
|
@ -429,6 +430,11 @@ public class DeviceInfoDataImpl implements IDeviceInfoData {
|
|||
deviceInfoRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceInfo> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public DeviceInfo save(DeviceInfo data) {
|
||||
|
@ -463,16 +469,23 @@ public class DeviceInfoDataImpl implements IDeviceInfoData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<DeviceInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
deviceInfoRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return deviceInfoRepository.count();
|
||||
|
@ -484,9 +497,20 @@ public class DeviceInfoDataImpl implements IDeviceInfoData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<DeviceInfo> findAll(int page, int size) {
|
||||
Page<TbDeviceInfo> paged = deviceInfoRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(), parseVoToDto(paged.getContent()));
|
||||
public Paging<DeviceInfo> findAll(PageRequest<DeviceInfo> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceInfo> findAllByCondition(DeviceInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceInfo findOneByCondition(DeviceInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IHomeData;
|
||||
import cc.iotkit.data.dao.HomeRepository;
|
||||
|
@ -11,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -51,6 +53,11 @@ public class HomeDataImpl implements IHomeData {
|
|||
return MapstructUtils.convert(homeRepository.findById(s).orElse(null), Home.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Home> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Home save(Home data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -60,6 +67,11 @@ public class HomeDataImpl implements IHomeData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<Home> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -67,10 +79,12 @@ public class HomeDataImpl implements IHomeData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return homeRepository.count();
|
||||
|
@ -82,7 +96,19 @@ public class HomeDataImpl implements IHomeData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<Home> findAll(int page, int size) {
|
||||
return new Paging<>();
|
||||
public Paging<Home> findAll(PageRequest<Home> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Home> findAllByCondition(Home data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Home findOneByCondition(Home data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IOauthClientData;
|
||||
import cc.iotkit.data.dao.OauthClientRepository;
|
||||
|
@ -21,6 +22,7 @@ import org.springframework.context.annotation.Primary;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -41,6 +43,11 @@ public class OauthClientDataImpl implements IOauthClientData {
|
|||
return MapstructUtils.convert(oauthClientRepository.findById(s).orElse(null), OauthClient.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OauthClient> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OauthClient save(OauthClient data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -51,16 +58,22 @@ public class OauthClientDataImpl implements IOauthClientData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<OauthClient> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
oauthClientRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return oauthClientRepository.count();
|
||||
|
@ -72,7 +85,19 @@ public class OauthClientDataImpl implements IOauthClientData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<OauthClient> findAll(int page, int size) {
|
||||
return new Paging<>();
|
||||
public Paging<OauthClient> findAll(PageRequest<OauthClient> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OauthClient> findAllByCondition(OauthClient data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OauthClient findOneByCondition(OauthClient data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IProductData;
|
||||
import cc.iotkit.data.dao.ProductRepository;
|
||||
|
@ -12,6 +13,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Primary
|
||||
|
@ -50,12 +52,22 @@ public class ProductDataImpl implements IProductData {
|
|||
return MapstructUtils.convert(productRepository.findById(s).orElse(null), Product.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Product> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Product save(Product data) {
|
||||
productRepository.save(MapstructUtils.convert(data, TbProduct.class));
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<Product> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -63,10 +75,12 @@ public class ProductDataImpl implements IProductData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return productRepository.count();
|
||||
|
@ -78,10 +92,19 @@ public class ProductDataImpl implements IProductData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<Product> findAll(int page, int size) {
|
||||
Page<TbProduct> productPage = productRepository.findAll(
|
||||
Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(productPage.getTotalElements(),
|
||||
MapstructUtils.convert(productPage.getContent(), Product.class));
|
||||
public Paging<Product> findAll(PageRequest<Product> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Product> findAllByCondition(Product data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Product findOneByCondition(Product data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,21 +1,29 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IProtocolComponentData;
|
||||
import cc.iotkit.data.dao.ProtocolComponentRepository;
|
||||
import cc.iotkit.data.model.TbProtocolComponent;
|
||||
import cc.iotkit.common.api.Paging;
|
||||
import cc.iotkit.data.util.PageBuilder;
|
||||
import cc.iotkit.data.util.PredicateBuilder;
|
||||
import cc.iotkit.model.protocol.ProtocolComponent;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static cc.iotkit.data.model.QTbSysConfig.tbSysConfig;
|
||||
|
||||
@Primary
|
||||
@Service
|
||||
public class ProtocolComponentDataImpl implements IProtocolComponentData {
|
||||
|
@ -56,6 +64,11 @@ public class ProtocolComponentDataImpl implements IProtocolComponentData {
|
|||
return MapstructUtils.convert(protocolComponentRepository.findById(s).orElse(null), ProtocolComponent.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProtocolComponent> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolComponent save(ProtocolComponent data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -66,6 +79,11 @@ public class ProtocolComponentDataImpl implements IProtocolComponentData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ProtocolComponent> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -73,10 +91,12 @@ public class ProtocolComponentDataImpl implements IProtocolComponentData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return protocolComponentRepository.count();
|
||||
|
@ -88,10 +108,23 @@ public class ProtocolComponentDataImpl implements IProtocolComponentData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<ProtocolComponent> findAll(int page, int size) {
|
||||
Page<TbProtocolComponent> paged = protocolComponentRepository
|
||||
.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(),
|
||||
MapstructUtils.convert(paged.getContent(), ProtocolComponent.class));
|
||||
public Paging<ProtocolComponent> findAll(PageRequest<ProtocolComponent> pageRequest) {
|
||||
ProtocolComponent query = pageRequest.getData();
|
||||
Predicate predicate = PredicateBuilder.instance()
|
||||
.build();
|
||||
Page<TbProtocolComponent> all = protocolComponentRepository.findAll(predicate, PageBuilder.toPageable(pageRequest));
|
||||
return new Paging<>(all.getTotalElements(), MapstructUtils.convert(all.getContent(), ProtocolComponent.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProtocolComponent> findAllByCondition(ProtocolComponent data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolComponent findOneByCondition(ProtocolComponent data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.IProtocolConverterData;
|
||||
import cc.iotkit.data.dao.ProtocolConverterRepository;
|
||||
|
@ -22,6 +23,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -56,6 +58,11 @@ public class ProtocolConverterDataImpl implements IProtocolConverterData {
|
|||
protocolConverterRepository.findById(s).orElse(null), ProtocolConverter.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProtocolConverter> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolConverter save(ProtocolConverter data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -66,6 +73,11 @@ public class ProtocolConverterDataImpl implements IProtocolConverterData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ProtocolConverter> data) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
|
@ -73,10 +85,11 @@ public class ProtocolConverterDataImpl implements IProtocolConverterData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return protocolConverterRepository.count();
|
||||
|
@ -88,10 +101,19 @@ public class ProtocolConverterDataImpl implements IProtocolConverterData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<ProtocolConverter> findAll(int page, int size) {
|
||||
Page<TbProtocolConverter> paged = protocolConverterRepository
|
||||
.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(),
|
||||
MapstructUtils.convert(paged.getContent(), ProtocolConverter.class));
|
||||
public Paging<ProtocolConverter> findAll(PageRequest<ProtocolConverter> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ProtocolConverter> findAllByCondition(ProtocolConverter data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProtocolConverter findOneByCondition(ProtocolConverter data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.manager.IRuleInfoData;
|
||||
import cc.iotkit.data.dao.RuleInfoRepository;
|
||||
import cc.iotkit.data.model.TbRuleInfo;
|
||||
|
@ -22,6 +23,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -76,6 +78,11 @@ public class RuleInfoDataImpl implements IRuleInfoData {
|
|||
return RuleInfoMapper.toDtoFix(ruleInfoRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RuleInfo> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleInfo save(RuleInfo data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -86,16 +93,23 @@ public class RuleInfoDataImpl implements IRuleInfoData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<RuleInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
ruleInfoRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return ruleInfoRepository.count();
|
||||
|
@ -107,10 +121,19 @@ public class RuleInfoDataImpl implements IRuleInfoData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<RuleInfo> findAll(int page, int size) {
|
||||
Page<TbRuleInfo> paged = ruleInfoRepository.
|
||||
findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(),
|
||||
RuleInfoMapper.toDto(paged.getContent()));
|
||||
public Paging<RuleInfo> findAll(PageRequest<RuleInfo> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RuleInfo> findAllByCondition(RuleInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuleInfo findOneByCondition(RuleInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.ISpaceData;
|
||||
import cc.iotkit.data.dao.SpaceRepository;
|
||||
|
@ -13,6 +14,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -61,6 +63,11 @@ public class SpaceDataImpl implements ISpaceData {
|
|||
return MapstructUtils.convert(spaceRepository.findById(s).orElse(null), Space.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Space> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Space save(Space data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -70,16 +77,23 @@ public class SpaceDataImpl implements ISpaceData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<Space> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
spaceRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return spaceRepository.count();
|
||||
|
@ -91,7 +105,19 @@ public class SpaceDataImpl implements ISpaceData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<Space> findAll(int page, int size) {
|
||||
return new Paging<>();
|
||||
public Paging<Space> findAll(PageRequest<Space> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Space> findAllByCondition(Space data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Space findOneByCondition(Space data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.utils.MapstructUtils;
|
||||
import cc.iotkit.data.manager.ISpaceDeviceData;
|
||||
import cc.iotkit.data.dao.SpaceDeviceRepository;
|
||||
|
@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -85,6 +87,11 @@ public class SpaceDeviceDataImpl implements ISpaceDeviceData {
|
|||
return MapstructUtils.convert(spaceDeviceRepository.findById(s).orElse(null), SpaceDevice.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpaceDevice> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpaceDevice save(SpaceDevice data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -95,16 +102,22 @@ public class SpaceDeviceDataImpl implements ISpaceDeviceData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<SpaceDevice> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
spaceDeviceRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return spaceDeviceRepository.count();
|
||||
|
@ -116,7 +129,19 @@ public class SpaceDeviceDataImpl implements ISpaceDeviceData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<SpaceDevice> findAll(int page, int size) {
|
||||
return new Paging<>();
|
||||
public Paging<SpaceDevice> findAll(PageRequest<SpaceDevice> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SpaceDevice> findAllByCondition(SpaceDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SpaceDevice findOneByCondition(SpaceDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import cc.iotkit.data.util.PredicateBuilder;
|
|||
import cc.iotkit.model.system.SysConfig;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
@ -22,9 +23,7 @@ import java.util.Map;
|
|||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import static cc.iotkit.data.model.QTbSysConfig.tbSysConfig;
|
||||
|
@ -39,14 +38,14 @@ public class SysConfigDataImpl implements ISysConfigData {
|
|||
|
||||
@Override
|
||||
public SysConfig findById(Long id) {
|
||||
TbSysConfig tbSysConfig = alertConfigRepository.findById(id).orElseThrow(() ->
|
||||
new BizException(ErrCode.DATA_NOT_EXIST));
|
||||
return MapstructUtils.convert(tbSysConfig,SysConfig.class);
|
||||
TbSysConfig tbSysConfig = alertConfigRepository.findById(id).orElseThrow(() ->
|
||||
new BizException(ErrCode.DATA_NOT_EXIST));
|
||||
return MapstructUtils.convert(tbSysConfig, SysConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysConfig save(SysConfig data) {
|
||||
alertConfigRepository.save(MapstructUtils.convert(data,TbSysConfig.class));
|
||||
alertConfigRepository.save(MapstructUtils.convert(data, TbSysConfig.class));
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -84,27 +83,18 @@ public class SysConfigDataImpl implements ISysConfigData {
|
|||
public Paging<SysConfig> findAll(PageRequest<SysConfig> pageRequest) {
|
||||
SysConfig query = pageRequest.getData();
|
||||
Predicate predicate = PredicateBuilder.instance(tbSysConfig.configId.isNotNull())
|
||||
.and(StringUtils.isNotEmpty(query.getConfigKey()),() -> tbSysConfig.configKey.eq(query.getConfigKey()))
|
||||
.and(StringUtils.isNotEmpty(query.getConfigKey()), () -> tbSysConfig.configKey.eq(query.getConfigKey()))
|
||||
|
||||
.build();
|
||||
.build();
|
||||
|
||||
List<Order> orders = new ArrayList<>();
|
||||
Map<String,String> sortMap = pageRequest.getSortMap();
|
||||
if (CollUtil.isNotEmpty(sortMap)){
|
||||
sortMap.forEach((k,v) -> {
|
||||
orders.add(new Order(Direction.ASC, k));
|
||||
});
|
||||
}
|
||||
// TODO: 2023/5/26 抽成通用工具类方法
|
||||
|
||||
|
||||
alertConfigRepository.findAll(predicate,PageBuilder.toPageable(pageRequest, Sort.by(orders)));
|
||||
|
||||
|
||||
alertConfigRepository.findAll(predicate, PageBuilder.toPageable(pageRequest));
|
||||
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysConfig> findAllByCondition(SysConfig data) {
|
||||
throw new BizException(ErrCode.UNSUPPORTED_OPERATION_EXCEPTION);
|
||||
|
|
|
@ -110,35 +110,9 @@ public class SysMenuDataImpl implements ISysMenuData {
|
|||
|
||||
PredicateBuilder predicateBuilder = PredicateBuilder.instance(tbSysMenu.menuId.isNotNull());
|
||||
|
||||
|
||||
// 管理员显示所有菜单信息
|
||||
if (isSuperAdmin) {
|
||||
predicateBuilder
|
||||
.and(StringUtils.isNotBlank(menu.getMenuName()), () -> tbSysMenu.menuName.like(menu.getMenuName()))
|
||||
.and(StringUtils.isNotBlank(menu.getVisible()), () -> tbSysMenu.visible.eq(menu.getVisible()))
|
||||
.and(StringUtils.isNotBlank(menu.getStatus()), () -> tbSysMenu.status.eq(menu.getStatus()));
|
||||
|
||||
menuList = baseMapper.selectVoList(new LambdaQueryWrapper<SysMenu>()
|
||||
.like(StringUtils.isNotBlank(menu.getMenuName()), SysMenu::getMenuName, menu.getMenuName())
|
||||
.eq(StringUtils.isNotBlank(menu.getVisible()), SysMenu::getVisible, menu.getVisible())
|
||||
.eq(StringUtils.isNotBlank(menu.getStatus()), SysMenu::getStatus, menu.getStatus())
|
||||
.orderByAsc(SysMenu::getParentId)
|
||||
.orderByAsc(SysMenu::getOrderNum));
|
||||
} else {
|
||||
predicateBuilder.and(tbSysMenu.menuId.eq(userId));
|
||||
BooleanBuilder builder = new BooleanBuilder();
|
||||
QueryWrapper<SysMenu> wrapper = Wrappers.query();
|
||||
wrapper.eq("sur.user_id", userId)
|
||||
.like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName())
|
||||
.eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible())
|
||||
.eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus())
|
||||
.orderByAsc("m.parent_id")
|
||||
.orderByAsc("m.order_num");
|
||||
menuList = baseMapper.selectMenuListByUserId(wrapper);
|
||||
}
|
||||
Predicate predicate = predicateBuilder.build();
|
||||
sysMenuRepository.findAll(predicate);
|
||||
|
||||
return menuList;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.manager.ITaskInfoData;
|
||||
import cc.iotkit.data.dao.TaskInfoRepository;
|
||||
import cc.iotkit.data.model.TbTaskInfo;
|
||||
|
@ -22,6 +23,7 @@ import org.springframework.data.domain.Page;
|
|||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -55,6 +57,11 @@ public class TaskInfoDataImpl implements ITaskInfoData {
|
|||
return TaskInfoMapper.toDtoFix(taskInfoRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskInfo save(TaskInfo data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -65,16 +72,23 @@ public class TaskInfoDataImpl implements ITaskInfoData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<TaskInfo> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
taskInfoRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return taskInfoRepository.count();
|
||||
|
@ -86,8 +100,20 @@ public class TaskInfoDataImpl implements ITaskInfoData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<TaskInfo> findAll(int page, int size) {
|
||||
Page<TbTaskInfo> paged = taskInfoRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(), TaskInfoMapper.toDto(paged.getContent()));
|
||||
public Paging<TaskInfo> findAll(PageRequest<TaskInfo> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaskInfo> findAllByCondition(TaskInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskInfo findOneByCondition(TaskInfo data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.manager.IThingModelData;
|
||||
import cc.iotkit.data.dao.ThingModelRepository;
|
||||
import cc.iotkit.data.service.convert.ThingModelMapper;
|
||||
|
@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -34,6 +36,11 @@ public class ThingModelDataImpl implements IThingModelData {
|
|||
return ThingModelMapper.toDtoFix(thingModelRepository.findById(s).orElse(null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThingModel> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThingModel save(ThingModel data) {
|
||||
if (StringUtils.isBlank(data.getId())) {
|
||||
|
@ -43,16 +50,22 @@ public class ThingModelDataImpl implements IThingModelData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<ThingModel> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteById(String s) {
|
||||
thingModelRepository.deleteById(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return 0;
|
||||
|
@ -64,7 +77,19 @@ public class ThingModelDataImpl implements IThingModelData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<ThingModel> findAll(int page, int size) {
|
||||
public Paging<ThingModel> findAll(PageRequest<ThingModel> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThingModel> findAllByCondition(ThingModel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ThingModel findOneByCondition(ThingModel data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,10 +84,6 @@ public class UserInfoDataImpl implements IUserInfoData {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
|
@ -114,10 +110,5 @@ public class UserInfoDataImpl implements IUserInfoData {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Paging<UserInfo> findAll(int page, int size) {
|
||||
Page<TbUserInfo> paged = userInfoRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(),
|
||||
UserInfoMapper.toDto(paged.getContent()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.data.service;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.data.manager.IVirtualDeviceData;
|
||||
import cc.iotkit.data.dao.VirtualDeviceMappingRepository;
|
||||
import cc.iotkit.data.dao.VirtualDeviceRepository;
|
||||
|
@ -26,6 +27,7 @@ import org.springframework.data.domain.Pageable;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -79,6 +81,11 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
return dto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findByIds(Collection<String> id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<String> getVirtualDeviceIds(String virtualId) {
|
||||
List<TbVirtualDeviceMapping> deviceMappings = virtualDeviceMappingRepository.findByVirtualId(virtualId);
|
||||
return deviceMappings.stream().map(TbVirtualDeviceMapping::getDeviceId).collect(Collectors.toList());
|
||||
|
@ -105,6 +112,11 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchSave(List<VirtualDevice> data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteById(String s) {
|
||||
|
@ -113,10 +125,11 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void deleteByIds(String[] strings) {
|
||||
public void deleteByIds(Collection<String> strings) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count() {
|
||||
return virtualDeviceRepository.count();
|
||||
|
@ -128,8 +141,19 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Paging<VirtualDevice> findAll(int page, int size) {
|
||||
Page<TbVirtualDevice> paged = virtualDeviceRepository.findAll(Pageable.ofSize(size).withPage(page - 1));
|
||||
return new Paging<>(paged.getTotalElements(), VirtualDeviceMapper.toDto(paged.getContent()));
|
||||
public Paging<VirtualDevice> findAll(PageRequest<VirtualDevice> pageRequest) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VirtualDevice> findAllByCondition(VirtualDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualDevice findOneByCondition(VirtualDevice data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,9 +3,18 @@ package cc.iotkit.data.util;
|
|||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.api.PageRequestEmpty;
|
||||
import cc.iotkit.model.system.SysConfig;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.data.domain.Sort.Order;
|
||||
|
||||
/**
|
||||
* @author: Longjun.Tu
|
||||
* @description:
|
||||
|
@ -19,7 +28,12 @@ public class PageBuilder {
|
|||
}
|
||||
|
||||
public static Pageable toPageable(PageRequest<?> request) {
|
||||
List<Order> orders = getOrders(request);
|
||||
if(CollUtil.isNotEmpty(orders)){
|
||||
return toPageable(request, Sort.by(orders));
|
||||
}
|
||||
return (Pageable)(request.getPageSize() <= 0 ? Pageable.unpaged() : org.springframework.data.domain.PageRequest.of(request.getPageNum() - 1, request.getPageSize()));
|
||||
|
||||
}
|
||||
|
||||
public static Pageable toPageable(PageRequestEmpty request) {
|
||||
|
@ -34,4 +48,15 @@ public class PageBuilder {
|
|||
return (Pageable)(request.getPageSize() <= 0 ? Pageable.unpaged() : org.springframework.data.domain.PageRequest.of(request.getPageNum() - 1, request.getPageSize(), sort));
|
||||
}
|
||||
|
||||
private static List<Order> getOrders(PageRequest pageRequest) {
|
||||
List<Order> orders = new ArrayList<>();
|
||||
Map<String,String> sortMap = pageRequest.getSortMap();
|
||||
if (CollUtil.isNotEmpty(sortMap)){
|
||||
sortMap.forEach((k,v) -> {
|
||||
orders.add(new Order(Direction.ASC, k));
|
||||
});
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
|||
@Data
|
||||
public class TenantException extends BizException {
|
||||
|
||||
public TenantException(String code, String message) {
|
||||
public TenantException(Integer code, String message) {
|
||||
super("tenant", code, message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.springframework.stereotype.Component;
|
|||
/**
|
||||
* spring工具类 方便在非spring管理环境中获取bean
|
||||
*/
|
||||
@Component
|
||||
//@Component
|
||||
public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware
|
||||
{
|
||||
/** Spring应用上下文环境 */
|
||||
|
|
|
@ -13,12 +13,13 @@ import cc.iotkit.common.enums.ErrCode;
|
|||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.thing.ThingService;
|
||||
import cc.iotkit.common.utils.JsonUtils;
|
||||
import cc.iotkit.common.utils.SpringUtils;
|
||||
import cc.iotkit.common.utils.ThreadUtil;
|
||||
import cc.iotkit.comp.AbstractDeviceComponent;
|
||||
import cc.iotkit.comp.CompConfig;
|
||||
import cc.iotkit.comp.IMessageHandler;
|
||||
import cc.iotkit.comp.model.DeviceState;
|
||||
import cc.iotkit.comp.utils.SpringUtils;
|
||||
|
||||
import cc.iotkit.converter.DeviceMessage;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
import cc.iotkit.model.device.DeviceInfo;
|
||||
|
|
|
@ -13,7 +13,8 @@ package cc.iotkit.comp.emqx;
|
|||
import cc.iotkit.common.enums.ErrCode;
|
||||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.thing.ThingService;
|
||||
import cc.iotkit.comp.utils.SpringUtils;
|
||||
|
||||
import cc.iotkit.common.utils.SpringUtils;
|
||||
import cc.iotkit.converter.Device;
|
||||
import cc.iotkit.converter.DeviceMessage;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
|
|
|
@ -13,7 +13,8 @@ package cc.iotkit.comp.mqtt;
|
|||
import cc.iotkit.common.enums.ErrCode;
|
||||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.thing.ThingService;
|
||||
import cc.iotkit.comp.utils.SpringUtils;
|
||||
|
||||
import cc.iotkit.common.utils.SpringUtils;
|
||||
import cc.iotkit.converter.Device;
|
||||
import cc.iotkit.converter.DeviceMessage;
|
||||
import cc.iotkit.data.manager.IDeviceInfoData;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
package cc.iotkit.manager.controller;
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.common.enums.ErrCode;
|
||||
import cc.iotkit.common.exception.BizException;
|
||||
import cc.iotkit.common.satoken.utils.AuthUtil;
|
||||
|
@ -214,9 +215,8 @@ public class ProtocolController {
|
|||
|
||||
@PostMapping("/components/{size}/{page}")
|
||||
public Paging<ProtocolComponent> getComponents(
|
||||
@PathVariable("size") int size,
|
||||
@PathVariable("page") int page) {
|
||||
Paging<ProtocolComponent> components = protocolComponentData.findAll(page, size);
|
||||
PageRequest<ProtocolComponent> query ) {
|
||||
Paging<ProtocolComponent> components = protocolComponentData.findAll(query);
|
||||
components.getData().forEach(c -> c.setState(
|
||||
componentManager.isRunning(c.getId()) ?
|
||||
ProtocolComponent.STATE_RUNNING : ProtocolComponent.STATE_STOPPED
|
||||
|
@ -224,11 +224,9 @@ public class ProtocolController {
|
|||
return components;
|
||||
}
|
||||
|
||||
@PostMapping("/converters/{size}/{page}")
|
||||
public Paging<ProtocolConverter> getConverters(
|
||||
@PathVariable("size") int size,
|
||||
@PathVariable("page") int page) {
|
||||
return protocolConverterData.findAll(page, size);
|
||||
@PostMapping("/converters/list")
|
||||
public Paging<ProtocolConverter> getConverters(PageRequest<ProtocolConverter> query) {
|
||||
return protocolConverterData.findAll(query);
|
||||
}
|
||||
|
||||
@PostMapping("/addConverter")
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package cc.iotkit.manager.dto.bo.protocolcomponent;
|
||||
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.model.protocol.ProtocolComponent;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @Author: jay
|
||||
* @Date: 2023/5/29 10:43
|
||||
* @Version: V1.0
|
||||
* @Description: 组件查询
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ProtocolComponent.class, reverseConvertGenerate = false)
|
||||
public class ProtocolComponentBo extends PageRequest {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package cc.iotkit.manager.dto.bo.protocolconverter;
|
||||
|
||||
|
||||
import cc.iotkit.common.api.PageRequest;
|
||||
import cc.iotkit.model.protocol.ProtocolConverter;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @Author: jay
|
||||
* @Date: 2023/5/29 10:48
|
||||
* @Version: V1.0
|
||||
* @Description: 转换脚本查询参数
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = ProtocolConverter.class, reverseConvertGenerate = false)
|
||||
public class ProtocolConverterBo extends PageRequest {
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package cc.iotkit.manager.dto.vo.protocolcomponent;
|
||||
|
||||
import cc.iotkit.model.protocol.ProtocolComponent;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: jay
|
||||
* @Date: 2023/5/29 10:54
|
||||
* @Version: V1.0
|
||||
* @Description: 组件Vo
|
||||
*/
|
||||
@Data
|
||||
|
||||
@AutoMapper(target = ProtocolComponent.class)
|
||||
public class ProtocolComponentVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 所属性用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String uid;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "协议类型")
|
||||
|
||||
private String protocol;
|
||||
|
||||
@ApiModelProperty(value = "jar包")
|
||||
private String jarFile;
|
||||
|
||||
@ApiModelProperty(value = "配置")
|
||||
private String config;
|
||||
|
||||
@ApiModelProperty(value = "转换器")
|
||||
private String converter;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "运行状态")
|
||||
private String state;
|
||||
|
||||
private Long createAt;
|
||||
|
||||
@ApiModelProperty(value = "脚本类型")
|
||||
private String scriptTyp;
|
||||
|
||||
@ApiModelProperty(value = "脚本内容")
|
||||
private String script;
|
||||
}
|
|
@ -10,6 +10,8 @@
|
|||
package cc.iotkit.manager.service;
|
||||
|
||||
import cc.iotkit.common.utils.JsonUtils;
|
||||
import cc.iotkit.data.ICommonData;
|
||||
import cc.iotkit.data.manager.*;
|
||||
import cc.iotkit.model.Id;
|
||||
import cc.iotkit.model.OauthClient;
|
||||
import cc.iotkit.model.UserInfo;
|
||||
|
@ -156,7 +158,7 @@ public class ExampleDataInit implements SmartInitializingSingleton {
|
|||
String json = FileUtils.readFileToString(new File("./data/init/" + name + ".json"), Charsets.UTF_8);
|
||||
List list = (List) JsonUtils.parseObject(json, type);
|
||||
for (Object obj : list) {
|
||||
service.add((Id) obj);
|
||||
service.save((Id) obj);
|
||||
}
|
||||
return (T) list;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package cc.iotkit.manager.service;
|
||||
|
||||
import cc.iotkit.model.protocol.ProtocolComponent;
|
||||
|
||||
/**
|
||||
* @Author: jay
|
||||
* @Date: 2023/5/29 11:28
|
||||
* @Version: V1.0
|
||||
* @Description: 协议组件接口
|
||||
*/
|
||||
public interface IProtocolService {
|
||||
|
||||
// 上传jar包
|
||||
String uploadJar(String jarFile, String id);
|
||||
|
||||
// 添加组件
|
||||
boolean addComponent(ProtocolComponent component);
|
||||
|
||||
|
||||
}
|
|
@ -9,7 +9,8 @@
|
|||
*/
|
||||
package cc.iotkit.ruleengine.handler;
|
||||
|
||||
import cc.iotkit.common.Constants;
|
||||
|
||||
import cc.iotkit.common.constant.Constants;
|
||||
import cc.iotkit.common.utils.JsonUtils;
|
||||
import cc.iotkit.model.device.message.ThingModelMessage;
|
||||
import cc.iotkit.mq.ConsumerHandler;
|
||||
|
|
|
@ -73,12 +73,8 @@ public class RuleManager {
|
|||
public void initRules() {
|
||||
int idx = 1;
|
||||
while (true) {
|
||||
Paging<RuleInfo> rules = ruleInfoData.findAll(idx, 1000);
|
||||
// 如果记录为空,直接跳出循环
|
||||
if (rules.getData() == null || rules.getData().isEmpty()) {
|
||||
break;
|
||||
}
|
||||
rules.getData().forEach(rule -> {
|
||||
List<RuleInfo> rules = ruleInfoData.findAll();
|
||||
rules.forEach(rule -> {
|
||||
try {
|
||||
//不添加停止的规则
|
||||
if (RuleInfo.STATE_STOPPED.equals(rule.getState())) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import cc.iotkit.common.api.Paging;
|
|||
import cc.iotkit.model.rule.TaskInfo;
|
||||
import cc.iotkit.model.rule.TaskLog;
|
||||
import cc.iotkit.temporal.ITaskLogData;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.*;
|
||||
|
@ -25,7 +26,9 @@ import org.springframework.context.ApplicationContext;
|
|||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
@ -51,12 +54,12 @@ public class TaskManager implements ApplicationContextAware {
|
|||
public void initTask() {
|
||||
int idx = 1;
|
||||
while (true) {
|
||||
Paging<TaskInfo> tasks = taskInfoData.findAll(idx, 1000);
|
||||
List<TaskInfo> tasks = taskInfoData.findAll();
|
||||
// 如果记录为空,直接跳出循环
|
||||
if (tasks.getData() == null || tasks.getData().isEmpty()) {
|
||||
if (CollectionUtil.isEmpty(tasks)) {
|
||||
break;
|
||||
}
|
||||
tasks.getData().forEach(task -> {
|
||||
tasks.forEach(task -> {
|
||||
try {
|
||||
if (!TaskInfo.STATE_RUNNING.equals(task.getState())) {
|
||||
return;
|
||||
|
|
|
@ -87,7 +87,7 @@ public class SysOssController extends BaseController {
|
|||
@SaCheckPermission("system:oss:download")
|
||||
@GetMapping("/download/{ossId}")
|
||||
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||
ossService.download(ossId, response);
|
||||
ossService.download(ossId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -99,7 +100,7 @@ public class SysPostController extends BaseController {
|
|||
@SaCheckPermission("system:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public void remove(@PathVariable Long[] postIds) {
|
||||
public void remove(@PathVariable Collection postIds) {
|
||||
postService.deletePostByIds(postIds);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class SysRoleBo extends BaseDto {
|
|||
* 角色ID
|
||||
*/
|
||||
@NotNull(message = "角色ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
|
|
|
@ -27,7 +27,7 @@ public class SysRoleVo implements Serializable {
|
|||
* 角色ID
|
||||
*/
|
||||
@ExcelProperty(value = "角色序号")
|
||||
private Long id;
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
|
|
|
@ -118,7 +118,7 @@ public interface ISysRoleService {
|
|||
* @param bo 角色信息
|
||||
* @return 结果
|
||||
*/
|
||||
void updateRole(SysRoleBo bo);
|
||||
int updateRole(SysRoleBo bo);
|
||||
|
||||
/**
|
||||
* 修改角色状态
|
||||
|
|
|
@ -177,7 +177,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertRole(SysRoleBo bo) {
|
||||
SysRole role = sysRoleData.save(bo.to(SysRole.class));
|
||||
bo.setId(role.getId());
|
||||
bo.setRoleId(role.getId());
|
||||
insertRoleMenu(bo);
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,12 @@ public class SysRoleServiceImpl implements ISysRoleService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateRole(SysRoleBo bo) {
|
||||
sysRoleData.save(bo.to(SysRole.class));
|
||||
public int updateRole(SysRoleBo bo) {
|
||||
SysRole role = sysRoleData.save(bo.to(SysRole.class));
|
||||
if(ObjectUtil.isNull(role)){
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
29
pom.xml
29
pom.xml
|
@ -508,5 +508,34 @@
|
|||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>flatten-maven-plugin</artifactId>
|
||||
<version>1.3.0</version>
|
||||
<configuration>
|
||||
<updatePomFile>true</updatePomFile>
|
||||
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>flatten</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>flatten</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>flatten.clean</id>
|
||||
<phase>clean</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
Loading…
Reference in New Issue