瀏覽代碼

井的3层代码提交

hbjzws 2 年之前
父節點
當前提交
8e394b3652

+ 15 - 0
pom.xml

@@ -10,9 +10,20 @@
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <spring-boot.version>3.0.0</spring-boot.version>
+	  	<lombok.version>1.16.12</lombok.version>
   </properties>
   
   <dependencies>
+	  <dependency>
+		  <groupId>org.projectlombok</groupId>
+		  <artifactId>lombok</artifactId>
+		  <version>${lombok.version}</version>
+	  </dependency>
+	  <dependency>
+		  <groupId>cn.hutool</groupId>
+		  <artifactId>hutool-all</artifactId>
+		  <version>5.0.6</version>
+	  </dependency>
 	  <dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
@@ -55,6 +66,10 @@
 		    <groupId>com.github.ben-manes.caffeine</groupId>
 		    <artifactId>caffeine</artifactId>
 		</dependency>
+	  <dependency>
+		  <groupId>org.projectlombok</groupId>
+		  <artifactId>lombok</artifactId>
+	  </dependency>
   </dependencies>
 	
   <dependencyManagement>

+ 12 - 0
src/main/java/com/hb/proj/model/Well.java

@@ -0,0 +1,12 @@
+package com.hb.proj.model;
+
+import lombok.Data;
+
+@Data
+public class Well {
+    private String wellId;
+
+    private String wellName;
+
+    private String wellSort;
+}

+ 27 - 0
src/main/java/com/hb/proj/well/controller/WellController.java

@@ -0,0 +1,27 @@
+package com.hb.proj.well.controller;
+
+import cn.hutool.core.util.IdUtil;
+import com.hb.proj.model.Well;
+import com.hb.proj.well.service.WellService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/api/well")
+@Validated
+public class WellController {
+    @Autowired
+    private WellService wellService;
+    @RequestMapping("/save")
+    public void save(){
+        Well well = new Well();
+        System.out.println("--------------------id:"+IdUtil.fastSimpleUUID());
+        well.setWellId(IdUtil.fastSimpleUUID());
+        well.setWellName("井名");
+        well.setWellSort("测试井");
+        wellService.insert(well);
+
+    }
+}

+ 18 - 0
src/main/java/com/hb/proj/well/service/WellService.java

@@ -0,0 +1,18 @@
+package com.hb.proj.well.service;
+
+
+import com.hb.proj.model.Well;
+import com.hb.xframework.dao.core.SpringJdbcDAO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class WellService {
+    @Autowired
+    private SpringJdbcDAO springDAO;
+    private String tabName="tzl_well";
+    public void insert(Well well) {
+
+          springDAO.insert(well, tabName);
+    }
+}