|
@@ -0,0 +1,41 @@
|
|
|
+package com.ruoyi.web.controller.iot.service.impl;
|
|
|
+
|
|
|
+import com.ruoyi.common.constant.HttpStatus;
|
|
|
+import com.ruoyi.web.controller.iot.domain.Order;
|
|
|
+import com.ruoyi.web.controller.iot.service.IOrderService;
|
|
|
+import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
|
+import org.springframework.jdbc.support.rowset.SqlRowSet;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author :jixinyuan
|
|
|
+ * @date : 2023/9/25
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class OrderServiceImpl implements IOrderService {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Order> list(Order order) {
|
|
|
+ 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");
|
|
|
+
|
|
|
+ JdbcTemplate template = new JdbcTemplate(dataSource);
|
|
|
+ SqlRowSet sqlRowSet = template.queryForRowSet("SELECT * FROM 't_factory_order';");
|
|
|
+
|
|
|
+ System.err.println("返回数据:"+sqlRowSet);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ System.err.println(e.getMessage());
|
|
|
+ return null;
|
|
|
+// return new ResponseEntity<ResponseStatusDto>(ResponseStatusDto.createErrorDto(e.getMessage(), e), HttpStatus.ACCEPTED);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|