deason hace 7 años
padre
commit
060858b71e

+ 1 - 1
src/main/java/cn/com/qmth/examcloud/app/controller/DeviceRecordController.java

@@ -37,7 +37,7 @@ public class DeviceRecordController {
 
     @ResponseBody
     @RequestMapping(value = "/list", method = RequestMethod.POST)
-    public Result<Page<DeviceRecord>> list(@RequestBody DeviceRecord params) throws Exception {
+    public Result<Page<DeviceRecord>> list(@RequestBody(required = false) DeviceRecord params) throws Exception {
         return deviceRecordService.getDeviceRecordList(params);
     }
 

+ 2 - 1
src/main/java/cn/com/qmth/examcloud/app/service/DeviceRecordService.java

@@ -14,6 +14,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.scheduling.annotation.Async;
@@ -31,7 +32,7 @@ public class DeviceRecordService {
 
     public Result<Page<DeviceRecord>> getDeviceRecordList(DeviceRecord params) {
         Specification<DeviceRecord> spec = null;
-        Pageable pageable = null;
+        Pageable pageable = new PageRequest(0, 10);
         Page<DeviceRecord> page = deviceRecordRepository.findAll(spec, pageable);
         return new Result<>().success(page);
     }

+ 34 - 1
src/main/resources/templates/deviceRecord/list.ftl

@@ -6,8 +6,41 @@
     <meta name="renderer" content="webkit"/>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
+    <link href="${base}/bycdao-ui/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
 </head>
 <body>
-todo
+<div id="contentDiv">loading...</div>
+<script src="${base}/bycdao-ui/jquery/jquery-1.9.1.min.js"></script>
+<script type="text/javascript">
+
+    $(function () {
+        loadData();
+    });
+
+    function loadData() {
+        var params = {};
+        params.loginKey = '111';
+        params.loginToken = '222';
+        $.ajax({
+            url: '${base}/device/record/list',
+            contentType: "application/json; charset=UTF-8",
+            dataType: "json",
+            type: "POST",
+            data: JSON.stringify(params),
+            success: function (response) {
+                if (response && response.success) {
+                    var html = [];
+                    var list = response.data.content;
+                    for (var n = 0; n < list.length; n++) {
+                        var obj = list[n];
+                        html.push('<p>' + JSON.stringify(obj) + '</p>');
+                    }
+                    $("#contentDiv").html(html.join(''));
+                }
+            }
+        });
+    }
+
+</script>
 </body>
 </html>