|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.web.controller.iot.service.impl;
|
|
|
|
|
|
+import com.ruoyi.common.constant.HttpStatus;
|
|
|
import com.ruoyi.common.core.page.PageDomain;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.core.page.TableSupport;
|
|
|
import com.ruoyi.web.controller.iot.domain.Order;
|
|
|
import com.ruoyi.web.controller.iot.service.IOrderService;
|
|
@@ -21,10 +23,10 @@ import java.util.List;
|
|
|
public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
@Override
|
|
|
- public List<Order> list(Order order) {
|
|
|
+ public TableDataInfo list(Order order) {
|
|
|
List<Order> orderList = new ArrayList<>();
|
|
|
PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
- Integer pageNum = pageDomain.getPageNum()-1;
|
|
|
+ Integer pageNum = pageDomain.getPageNum() - 1;
|
|
|
Integer pageSize = pageDomain.getPageSize();
|
|
|
String condition = "";
|
|
|
if (!ObjectUtils.isEmpty(order.getOrderNum())) {
|
|
@@ -45,26 +47,28 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
if (!ObjectUtils.isEmpty(order.getEndTime())) {
|
|
|
condition += "and end_time <= " + order.getEndTime();
|
|
|
}
|
|
|
+ Integer count = 0;
|
|
|
try {
|
|
|
DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
|
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
|
|
dataSource.setUrl("jdbc:mysql://47.94.195.4:3525/boyo_fb4a88d6f6f24d67953f68c4fe829f63?useUnicode=true&useSSL=false&characterEncoding=utf8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai");
|
|
|
dataSource.setUsername("db_cdyq6tkqn1ioja179i8b");
|
|
|
dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
|
|
|
- System.out.println("SELECT * FROM t_factory_order where 1=1 "
|
|
|
- + (ObjectUtils.isEmpty(condition) ? "" : condition)
|
|
|
- + " limit " + pageNum + "," + pageSize + ";");
|
|
|
JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
orderList = template.query("SELECT * FROM t_factory_order where 1=1 "
|
|
|
+ (ObjectUtils.isEmpty(condition) ? "" : condition)
|
|
|
+ " limit " + pageNum + "," + pageSize + ";" ,
|
|
|
new BeanPropertyRowMapper<Order>(Order.class));
|
|
|
- for (Order item : orderList) {
|
|
|
- System.out.println("返回数据:" + item.toString());
|
|
|
- }
|
|
|
+
|
|
|
+ count = template.queryForObject("SELECT count(*) FROM t_factory_order ;" , Integer.class);
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e.getMessage());
|
|
|
}
|
|
|
- return orderList;
|
|
|
+ TableDataInfo tableDataInfo = new TableDataInfo();
|
|
|
+ tableDataInfo.setCode(HttpStatus.SUCCESS);
|
|
|
+ tableDataInfo.setMsg("查询成功");
|
|
|
+ tableDataInfo.setRows(orderList);
|
|
|
+ tableDataInfo.setTotal(count);
|
|
|
+ return tableDataInfo;
|
|
|
}
|
|
|
}
|