|
@@ -1,8 +1,11 @@
|
1
|
1
|
package com.example.springbootdemo.controller;
|
2
|
2
|
|
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
4
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
4
|
5
|
import com.example.springbootdemo.entity.Device;
|
|
6
|
+import com.example.springbootdemo.entity.FootScanEntity;
|
5
|
7
|
import com.example.springbootdemo.mapper.DeviceMapper;
|
|
8
|
+import com.example.springbootdemo.service.FootScanService;
|
6
|
9
|
import org.springframework.beans.factory.annotation.Autowired;
|
7
|
10
|
import org.springframework.web.bind.annotation.RequestMapping;
|
8
|
11
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -18,10 +21,22 @@ import java.util.List;
|
18
|
21
|
public class MybatisPlusController {
|
19
|
22
|
@Autowired
|
20
|
23
|
DeviceMapper deviceMapper;
|
|
24
|
+ @Autowired
|
|
25
|
+ FootScanService footScanService;
|
21
|
26
|
@RequestMapping("/mybatisPlusSelect")
|
22
|
27
|
public Device getDeviceList() {
|
23
|
28
|
QueryWrapper<Device> queryWrapper = new QueryWrapper<>();
|
24
|
29
|
queryWrapper.eq("device_code","19216800200306800");
|
25
|
30
|
return deviceMapper.selectOne(queryWrapper);
|
26
|
31
|
}
|
|
32
|
+ @RequestMapping("/pageDemo")
|
|
33
|
+ public List<FootScanEntity> getFootScanListPage() {
|
|
34
|
+ Page<FootScanEntity> page = new Page<>(1,3);
|
|
35
|
+ QueryWrapper<FootScanEntity> queryWrapper = new QueryWrapper<FootScanEntity>()
|
|
36
|
+ .eq("device_code","SCMD03001001").orderByDesc("foot_scan_id");
|
|
37
|
+ footScanService.page(page,queryWrapper);
|
|
38
|
+ return page.getRecords();
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+
|
27
|
42
|
}
|