zhangxiaoyu 3 роки тому
батько
коміт
a7cad6e06f

+ 10 - 0
src/main/java/com/example/springbootdemo/controller/HelloController.java

@@ -1,6 +1,9 @@
1 1
 package com.example.springbootdemo.controller;
2 2
 
3 3
 import com.example.springbootdemo.entity.FootScanEntity;
4
+import com.example.springbootdemo.entity.FootScanGroup;
5
+import com.example.springbootdemo.mapper.FootScanGroupMapper;
6
+import com.example.springbootdemo.service.FootScanGroupService;
4 7
 import com.example.springbootdemo.service.FootScanService;
5 8
 import com.example.springbootdemo.zxyTeST.sql.dao.ArmGrabRepository;
6 9
 import com.example.springbootdemo.zxyTeST.sql.dao.ColorRepository;
@@ -25,6 +28,8 @@ public class HelloController {
25 28
     JdbcTemplate jdbcTemplate;
26 29
     @Autowired
27 30
     FootScanService footScanService;
31
+    @Autowired
32
+    FootScanGroupService footScanGroupService;
28 33
     @RequestMapping("/hello")
29 34
     public void hello() {
30 35
         List<Color> listColors = colorRepository.findByColorId(2314);
@@ -53,7 +58,12 @@ public class HelloController {
53 58
         return footScanService.getFootScanById(foot_scan_id);
54 59
 
55 60
     }
61
+    @RequestMapping("mybatis1")
62
+    public List<FootScanGroup> getFootScanGroup(@RequestParam("foot_scan_group_id") Long foot_scan_group_id) {
63
+       List <FootScanGroup> ff = footScanGroupService.findByFootScanGroupId(foot_scan_group_id);
64
+        return ff;
56 65
 
66
+    }
57 67
 
58 68
 }
59 69
 

+ 0 - 1
src/main/java/com/example/springbootdemo/entity/FootScanEntity.java

@@ -13,7 +13,6 @@ import java.io.Serializable;
13 13
  * @version 1.0
14 14
  * @date 2021/5/31 下午5:14
15 15
  */
16
-@Entity
17 16
 @Data
18 17
 @Table(name = "wb_tbl_foot_scan")
19 18
 public class FootScanEntity implements Serializable {

+ 24 - 0
src/main/java/com/example/springbootdemo/entity/FootScanGroup.java

@@ -0,0 +1,24 @@
1
+package com.example.springbootdemo.entity;
2
+
3
+
4
+import lombok.Data;
5
+
6
+import javax.persistence.GeneratedValue;
7
+import javax.persistence.Id;
8
+import javax.persistence.Table;
9
+import java.io.Serializable;
10
+
11
+/**
12
+ * @author zhangxiaoyu
13
+ * @version 1.0
14
+ * @date 2021/6/1 上午9:45
15
+ */
16
+@Data
17
+@Table(name = "wb_tbl_foot_scan_group")
18
+public class FootScanGroup implements Serializable {
19
+    @Id
20
+    @GeneratedValue
21
+    private Long footScanGroupId;
22
+    private Long userId;
23
+    private String userName;
24
+}

+ 21 - 0
src/main/java/com/example/springbootdemo/mapper/FootScanGroupMapper.java

@@ -0,0 +1,21 @@
1
+package com.example.springbootdemo.mapper;
2
+
3
+import com.example.springbootdemo.entity.FootScanGroup;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+import org.apache.ibatis.annotations.Select;
7
+import org.springframework.stereotype.Repository;
8
+
9
+import java.util.List;
10
+
11
+/**
12
+ * @author zhangxiaoyu
13
+ * @version 1.0
14
+ * @date 2021/6/1 上午9:48
15
+ */
16
+@Mapper
17
+@Repository
18
+public interface FootScanGroupMapper {
19
+    @Select("SELECT foot_scan_group_id,user_id,user_name FROM wb_tbl_foot_scan_group WHERE  foot_scan_group_id = #{footScanGroupId}")
20
+    List <FootScanGroup> findByFootScanGroupId(Long footScanGroupId);
21
+}

+ 18 - 0
src/main/java/com/example/springbootdemo/service/FootScanGroupService.java

@@ -0,0 +1,18 @@
1
+package com.example.springbootdemo.service;
2
+
3
+import com.example.springbootdemo.entity.FootScanGroup;
4
+import com.example.springbootdemo.mapper.FootScanGroupMapper;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+import org.springframework.stereotype.Service;
7
+
8
+import java.util.List;
9
+
10
+@Service
11
+public class FootScanGroupService {
12
+    @Autowired
13
+    FootScanGroupMapper footScanGroupMapper;
14
+    public List<FootScanGroup> findByFootScanGroupId(Long foot_scan_group_id) {
15
+        return footScanGroupMapper.findByFootScanGroupId(foot_scan_group_id);
16
+    }
17
+
18
+}

+ 2 - 2
src/main/resources/application-dev.yml

@@ -18,9 +18,9 @@ spring:
18 18
         login-username: zxy
19 19
         login-password: 123456
20 20
       driver-class-name: com.mysql.cj.jdbc.Driver
21
-      url: jdbc:mysql://localhost:3306/test?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
21
+      url: jdbc:mysql://192.168.2.130:3306/ceshi?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
22 22
       username: root
23
-      password:
23
+      password: 123456
24 24
   jpa:
25 25
     database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
26 26
     open-in-view: false