|
@@ -4,22 +4,19 @@ import cc.iotkit.common.api.PageRequest;
|
|
import cc.iotkit.data.IAlertConfigData;
|
|
import cc.iotkit.data.IAlertConfigData;
|
|
import cc.iotkit.data.dao.AlertConfigRepository;
|
|
import cc.iotkit.data.dao.AlertConfigRepository;
|
|
import cc.iotkit.data.model.AlertConfigMapper;
|
|
import cc.iotkit.data.model.AlertConfigMapper;
|
|
-import cc.iotkit.data.model.ProductMapper;
|
|
|
|
import cc.iotkit.data.model.TbAlertConfig;
|
|
import cc.iotkit.data.model.TbAlertConfig;
|
|
-import cc.iotkit.data.model.TbProduct;
|
|
|
|
import cc.iotkit.model.Paging;
|
|
import cc.iotkit.model.Paging;
|
|
import cc.iotkit.model.alert.AlertConfig;
|
|
import cc.iotkit.model.alert.AlertConfig;
|
|
-import java.util.List;
|
|
|
|
-import java.util.UUID;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Primary;
|
|
import org.springframework.context.annotation.Primary;
|
|
-import org.springframework.data.domain.Example;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.domain.Pageable;
|
|
-import org.springframework.data.domain.Sort;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.UUID;
|
|
|
|
+
|
|
@Primary
|
|
@Primary
|
|
@Service
|
|
@Service
|
|
public class AlertConfigDataImpl implements IAlertConfigData {
|
|
public class AlertConfigDataImpl implements IAlertConfigData {
|
|
@@ -49,7 +46,7 @@ public class AlertConfigDataImpl implements IAlertConfigData {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void deleteById(String s) {
|
|
public void deleteById(String s) {
|
|
-
|
|
|
|
|
|
+ alertConfigRepository.deleteById(s);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -69,8 +66,9 @@ public class AlertConfigDataImpl implements IAlertConfigData {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Paging<AlertConfig> selectAlertConfigPage(PageRequest<AlertConfig> request) {
|
|
public Paging<AlertConfig> selectAlertConfigPage(PageRequest<AlertConfig> request) {
|
|
- Pageable pageable = org.springframework.data.domain.PageRequest.of(request.getPageNo(), request.getPageSize(), Sort.Direction.DESC, "createAt");
|
|
|
|
- Page<TbAlertConfig> alertConfigPage = alertConfigRepository.findAll(Example.of(AlertConfigMapper.M.toVo(request.getData())), pageable);
|
|
|
|
|
|
+ //Pageable pageable = org.springframework.data.domain.PageRequest.of(request.getPageNo(), request.getPageSize());
|
|
|
|
+ //Page<TbAlertConfig> alertConfigPage = alertConfigRepository.findAll(Example.of(AlertConfigMapper.M.toVo(request.getData())), pageable);
|
|
|
|
+ Page<TbAlertConfig> alertConfigPage = alertConfigRepository.findAll(Pageable.ofSize(request.getPageSize()).withPage(request.getPageNo() - 1));
|
|
return new Paging<>(alertConfigPage.getTotalElements(), AlertConfigMapper.toDto(alertConfigPage.getContent()));
|
|
return new Paging<>(alertConfigPage.getTotalElements(), AlertConfigMapper.toDto(alertConfigPage.getContent()));
|
|
}
|
|
}
|
|
}
|
|
}
|