Commit 5d15fe0f by 丁伟峰

改成直接传递dto

1 parent ab541bd9
...@@ -22,7 +22,7 @@ public class WorkbenchController { ...@@ -22,7 +22,7 @@ public class WorkbenchController {
public Result<?> orderChangeList(@Validated @RequestBody WorkbenchOrderChangeListReqDTO reqDTO) { public Result<?> orderChangeList(@Validated @RequestBody WorkbenchOrderChangeListReqDTO reqDTO) {
Result<?> res = null; Result<?> res = null;
try { try {
res = workbenchService.getOrderChangeList(reqDTO.getLevelType(), reqDTO.getLevelValue(), reqDTO.getPage(), reqDTO.getSize()); res = workbenchService.getOrderChangeList(reqDTO);
} catch (BusinessException e) { } catch (BusinessException e) {
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
......
package com.alibaba.cloud.integration.order.service; package com.alibaba.cloud.integration.order.service;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO;
public interface WorkbenchService { public interface WorkbenchService {
Result<?> getOrderChangeList(String levelType, String levelId, int page, int pageSize); Result<?> getOrderChangeList(WorkbenchOrderChangeListReqDTO orderChangeListReqDTO);
} }
...@@ -3,6 +3,7 @@ package com.alibaba.cloud.integration.order.service.impl; ...@@ -3,6 +3,7 @@ package com.alibaba.cloud.integration.order.service.impl;
import com.alibaba.cloud.integration.common.Result; import com.alibaba.cloud.integration.common.Result;
import com.alibaba.cloud.integration.order.dao.OrderChangeDao; import com.alibaba.cloud.integration.order.dao.OrderChangeDao;
import com.alibaba.cloud.integration.order.dao.OrderRequestDao; import com.alibaba.cloud.integration.order.dao.OrderRequestDao;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListReqDTO;
import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListRespDTO; import com.alibaba.cloud.integration.order.dto.WorkbenchOrderChangeListRespDTO;
import com.alibaba.cloud.integration.order.entity.OrderChangeEntity; import com.alibaba.cloud.integration.order.entity.OrderChangeEntity;
import com.alibaba.cloud.integration.order.entity.OrderRequestEntity; import com.alibaba.cloud.integration.order.entity.OrderRequestEntity;
...@@ -28,15 +29,17 @@ public class WorkbenchServiceImpl implements WorkbenchService { ...@@ -28,15 +29,17 @@ public class WorkbenchServiceImpl implements WorkbenchService {
private OrderRequestDao orderRequestDao; private OrderRequestDao orderRequestDao;
@Override @Override
public Result<?> getOrderChangeList(String levelType, String levelId, int page, int pageSize) { public Result<?> getOrderChangeList(WorkbenchOrderChangeListReqDTO orderChangeListReqDTO) {
Pageable pageable = PageRequest.of(page - 1, pageSize); Pageable pageable = PageRequest.of(orderChangeListReqDTO.getPage() - 1, orderChangeListReqDTO.getSize());
Page<?> changes; Page<?> changes;
String levelType = orderChangeListReqDTO.getLevelType();
String levelValue = orderChangeListReqDTO.getLevelValue();
if ("cluster".equals(levelType)) { if ("cluster".equals(levelType)) {
changes = orderChangeDao.findAllByClusterId(pageable, levelId); changes = orderChangeDao.findAllByClusterId(levelValue, pageable);
} else if ("branch".equals(levelType)) { } else if ("branch".equals(levelType)) {
changes = orderChangeDao.findAllByBranchId(pageable, levelId); changes = orderChangeDao.findAllByBranchId(levelValue, pageable);
} else { } else {
changes = orderChangeDao.findAllByGroupId(pageable, levelId); changes = orderChangeDao.findAllByGroupId(levelValue, pageable);
} }
List<WorkbenchOrderChangeListRespDTO.Content> contents = new ArrayList<>(); List<WorkbenchOrderChangeListRespDTO.Content> contents = new ArrayList<>();
for (Object e1 : changes.getContent()) { for (Object e1 : changes.getContent()) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!