hasan 2 years ago
parent
commit
e8af617e1a

+ 1 - 1
pom.xml

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3 3
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4 4
     <modelVersion>4.0.0</modelVersion>
5 5
     <parent>

+ 31 - 0
src/main/java/com/szls/nstths/controller/DataController.java

@@ -0,0 +1,31 @@
1
+package com.szls.nstths.controller;
2
+
3
+import com.szls.nstths.entity.TeData;
4
+import com.szls.nstths.mapper.TeDataMapper;
5
+import com.szls.nstths.mapper.UserMapper;
6
+import org.slf4j.Logger;
7
+import org.slf4j.LoggerFactory;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.web.bind.annotation.PostMapping;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+
13
+@RestController
14
+public class DataController {
15
+
16
+    private static final Logger logger = LoggerFactory.getLogger(DataController.class);
17
+
18
+    private TeDataMapper teDataMapper;
19
+
20
+    @Autowired
21
+    public void setTeDataMapper(TeDataMapper teDataMapper) {
22
+        this.teDataMapper = teDataMapper;
23
+    }
24
+
25
+    @PostMapping("/equipmentTestingEnd")
26
+    public String equipmentTesting(TeData teData) {
27
+        logger.info("{}", teData);
28
+        int dbi = teDataMapper.insert(teData);
29
+        return dbi + " success";
30
+    }
31
+}

+ 9 - 1
src/main/java/com/szls/nstths/controller/UserController.java

@@ -2,14 +2,20 @@ package com.szls.nstths.controller;
2 2
 
3 3
 
4 4
 import com.szls.nstths.mapper.UserMapper;
5
+import org.slf4j.Logger;
6
+import org.slf4j.LoggerFactory;
5 7
 import org.springframework.beans.factory.annotation.Autowired;
6 8
 import org.springframework.web.bind.annotation.GetMapping;
7 9
 import org.springframework.web.bind.annotation.RequestParam;
8 10
 import org.springframework.web.bind.annotation.RestController;
9 11
 
12
+import java.util.List;
13
+
10 14
 @RestController
11 15
 public class UserController {
12 16
 
17
+    private static final Logger logger = LoggerFactory.getLogger(UserController.class);
18
+
13 19
     private UserMapper userMapper;
14 20
 
15 21
     @Autowired
@@ -19,7 +25,9 @@ public class UserController {
19 25
 
20 26
     @GetMapping("/hello")
21 27
     public String hello(@RequestParam(value = "name", defaultValue = "World") String name) {
22
-        userMapper.selectList(null);
28
+        List list = userMapper.selectList(null);
29
+        logger.info("{}", list);
30
+
23 31
         return String.format("Hello %s!", name);
24 32
     }
25 33
 }

+ 20 - 0
src/main/java/com/szls/nstths/entity/TeData.java

@@ -0,0 +1,20 @@
1
+package com.szls.nstths.entity;
2
+
3
+
4
+import com.baomidou.mybatisplus.annotation.TableId;
5
+import com.baomidou.mybatisplus.annotation.TableName;
6
+import lombok.Data;
7
+
8
+import java.util.Date;
9
+
10
+@Data
11
+@TableName("te_data")
12
+public class TeData {
13
+    @TableId
14
+    private Long id;
15
+    private String equipmentID;
16
+    private Date stime;
17
+    private Date etime;
18
+    private String rotationxy;
19
+
20
+}

+ 11 - 0
src/main/java/com/szls/nstths/mapper/TeDataMapper.java

@@ -0,0 +1,11 @@
1
+package com.szls.nstths.mapper;
2
+
3
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4
+import com.szls.nstths.entity.TeData;
5
+import com.szls.nstths.entity.User;
6
+import org.springframework.stereotype.Component;
7
+
8
+@Component(value = "teDataMapper")
9
+public interface TeDataMapper extends BaseMapper<TeData> {
10
+
11
+}

+ 1 - 1
src/main/java/com/szls/nstths/mapper/UserMapper.java

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.szls.nstths.entity.User;
5 5
 import org.springframework.stereotype.Component;
6 6
 
7
-@Component(value ="userMapper")
7
+@Component(value = "userMapper")
8 8
 public interface UserMapper extends BaseMapper<User> {
9 9
 
10 10
 }

+ 0 - 2
src/test/java/com/szls/nstths/SampleTest.java

@@ -2,9 +2,7 @@ package com.szls.nstths;
2 2
 
3 3
 import com.szls.nstths.entity.User;
4 4
 import com.szls.nstths.mapper.UserMapper;
5
-import org.junit.jupiter.api.Assertions;
6 5
 import org.junit.jupiter.api.Test;
7
-import org.mybatis.spring.annotation.MapperScan;
8 6
 import org.springframework.boot.test.context.SpringBootTest;
9 7
 
10 8
 import javax.annotation.Resource;