增加查询上游的菜单
This commit is contained in:
+76
@@ -0,0 +1,76 @@
|
||||
package com.bms.web.controller.monitor;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.bms.common.constant.HttpStatus;
|
||||
import com.bms.common.core.controller.BaseController;
|
||||
import com.bms.common.core.page.PageDomain;
|
||||
import com.bms.common.core.page.TableDataInfo;
|
||||
import com.bms.common.core.page.TableSupport;
|
||||
import com.bms.common.utils.StringUtils;
|
||||
import com.bms.price.domain.vo.TabOrderMonitorQuery;
|
||||
import com.bms.price.domain.vo.TabOrderMonitorVo;
|
||||
import com.bms.price.oracle.TabOrderMonitorService;
|
||||
|
||||
/**
|
||||
* 订单数据源:查询上游 Oracle TAB_ORDER。
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/orderSource")
|
||||
public class TabOrderMonitorController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private TabOrderMonitorService tabOrderMonitorService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:orderSource:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(TabOrderMonitorQuery query)
|
||||
{
|
||||
TableDataInfo rsp = new TableDataInfo();
|
||||
rsp.setCode(HttpStatus.SUCCESS);
|
||||
rsp.setMsg("\u67e5\u8be2\u6210\u529f");
|
||||
if (!hasRequiredFilters(query))
|
||||
{
|
||||
rsp.setRows(Collections.emptyList());
|
||||
rsp.setTotal(0L);
|
||||
return rsp;
|
||||
}
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
int pageNum = pageDomain.getPageNum() == null ? 1 : pageDomain.getPageNum().intValue();
|
||||
int pageSize = pageDomain.getPageSize() == null ? 10 : pageDomain.getPageSize().intValue();
|
||||
long total = tabOrderMonitorService.count(query);
|
||||
List<TabOrderMonitorVo> rows = total <= 0L
|
||||
? Collections.emptyList()
|
||||
: tabOrderMonitorService.selectPage(query, pageNum, pageSize);
|
||||
rsp.setRows(rows);
|
||||
rsp.setTotal(total);
|
||||
return rsp;
|
||||
}
|
||||
|
||||
private static boolean hasRequiredFilters(TabOrderMonitorQuery query)
|
||||
{
|
||||
if (query == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
boolean hasCustomer = false;
|
||||
if (query.getCustomerCodes() != null)
|
||||
{
|
||||
for (String code : query.getCustomerCodes())
|
||||
{
|
||||
if (StringUtils.isNotEmpty(code))
|
||||
{
|
||||
hasCustomer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean hasTime = StringUtils.isNotEmpty(query.getBeginTime()) && StringUtils.isNotEmpty(query.getEndTime());
|
||||
return hasCustomer && hasTime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user