lcl 1 vuosi sitten
vanhempi
commit
0e83d77f5f

+ 6 - 0
pom.xml

@@ -18,6 +18,12 @@
 		<java.version>17</java.version>
 	</properties>
 	<dependencies>
+
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-actuator</artifactId>
+		</dependency>
+
 		<dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-jpa</artifactId>

+ 1 - 1
src/main/java/com/kxs/adminap/AdminapApplication.java

@@ -20,7 +20,7 @@ public class AdminapApplication {
 	@PostConstruct
 	void started() {
 		TimeZone.setDefault(TimeZone.getTimeZone("GMT+8"));
-		initMainServer();
+		// initMainServer();
 	}
 
 	public static void main(String[] args) {

+ 3 - 3
src/main/java/com/kxs/adminap/config/Base.java

@@ -5,9 +5,9 @@ import java.util.Map;
 
 public class Base {
 
-	public static String main_url = "jdbc:mysql://localhost:3306/GGSJ?useUnicode=true&characterEncoding=utf8";
-    public static String main_username = "root";
-    public static String main_password = "123456";
+	public static String main_url = "jdbc:mysql://47.109.31.237:3306/KxsMainServer?useUnicode=true&characterEncoding=utf8";
+    public static String main_username = "KxsMainServer";
+    public static String main_password = "FrW8ZfxlcaVdm1r0";
 
 	public static Dictionary<String, Map<String, String>> main_tables;
 }

+ 69 - 71
src/main/java/com/kxs/adminap/controller/TestController.java

@@ -4,9 +4,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Dictionary;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -14,8 +12,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.kxs.adminap.config.Base;
-import com.kxs.adminap.dao.TestTablerepository;
-import com.kxs.adminap.enity.TestTable;
+// import com.kxs.adminap.dao.TestTablerepository;
+// import com.kxs.adminap.enity.TestTable;
 import com.kxs.adminap.service.DbConn;
 import com.kxs.adminap.util.RedisUtils;
 
@@ -24,8 +22,8 @@ import jakarta.annotation.Resource;
 @RestController
 public class TestController {
 
-	@Autowired
-	private TestTablerepository testTablerepository;
+	// @Autowired
+	// private TestTablerepository testTablerepository;
 
 	@Resource
 	RedisUtils redisUtils;
@@ -36,93 +34,93 @@ public class TestController {
 		return result;
 	}
 
-	@RequestMapping("/test")
-	public String test() {
-		String result = "ok";
+	// @RequestMapping("/test")
+	// public String test() {
+	// 	String result = "ok";
 		
-		// redisUtils.set("javaset", "ohyeah");
-		// result += redisUtils.get("javaset");
+	// 	// redisUtils.set("javaset", "ohyeah");
+	// 	// result += redisUtils.get("javaset");
 
-		// redisUtils.set("hahaha", "咔咔咔咔");
-		// result += redisUtils.get("hahaha");
+	// 	// redisUtils.set("hahaha", "咔咔咔咔");
+	// 	// result += redisUtils.get("hahaha");
 
-		// redisUtils.set("kkk", 123);
-		// result += redisUtils.getInteger("kkk");
+	// 	// redisUtils.set("kkk", 123);
+	// 	// result += redisUtils.getInteger("kkk");
 
-		TestTable d = testTablerepository.findById(2).get();
-		redisUtils.addList("test:list", d);
+	// 	TestTable d = testTablerepository.findById(2).get();
+	// 	redisUtils.addList("test:list", d);
 
-		return result;
-	}
+	// 	return result;
+	// }
 
 	@RequestMapping("/test2")
 	public List<Object> test2() {
 		return redisUtils.getList("test:list");
 	}
 
-	@RequestMapping("/test3")
-	public TestTable test3() {
-		return (TestTable)redisUtils.getList("test:list").get(0);
-	}
+	// @RequestMapping("/test3")
+	// public TestTable test3() {
+	// 	return (TestTable)redisUtils.getList("test:list").get(0);
+	// }
 
-	@RequestMapping("/add")
-	public String add() {
-		String result = "ok";
+	// @RequestMapping("/add")
+	// public String add() {
+	// 	String result = "ok";
 		
-		TestTable d = new TestTable();
-		d.setName("测试java");
-		try {
-			d.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2023-07-07 15:15:15"));
-		} catch (ParseException e) {
-			e.printStackTrace();
-		}
-		d.setSex(12345d);
-		d.setContents("水电费及时反馈海上繁花科技<br>asdasdasd");
-		d.setIsOk(true);
-
-		testTablerepository.save(d);
-
-		return result;
-	}
-
-	@RequestMapping("/update")
-	public String update(Integer id) {
-		String result = "ok";
+	// 	TestTable d = new TestTable();
+	// 	d.setName("测试java");
+	// 	try {
+	// 		d.setCreateDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2023-07-07 15:15:15"));
+	// 	} catch (ParseException e) {
+	// 		e.printStackTrace();
+	// 	}
+	// 	d.setSex(12345d);
+	// 	d.setContents("水电费及时反馈海上繁花科技<br>asdasdasd");
+	// 	d.setIsOk(true);
+
+	// 	testTablerepository.save(d);
+
+	// 	return result;
+	// }
+
+	// @RequestMapping("/update")
+	// public String update(Integer id) {
+	// 	String result = "ok";
 		
-		TestTable d = testTablerepository.findById(id).get();
-		d.setName("修改名称");
-		d.setContents("修改的内容");
+	// 	TestTable d = testTablerepository.findById(id).get();
+	// 	d.setName("修改名称");
+	// 	d.setContents("修改的内容");
 
-		testTablerepository.save(d);
+	// 	testTablerepository.save(d);
 
-		return result;
-	}
+	// 	return result;
+	// }
 
-	@RequestMapping("/delete")
-	public String delete(Integer id) {
-		String result = "ok";
+	// @RequestMapping("/delete")
+	// public String delete(Integer id) {
+	// 	String result = "ok";
 
-		testTablerepository.deleteById(id);
+	// 	testTablerepository.deleteById(id);
 
-		return result;
-	}
+	// 	return result;
+	// }
 
-	@RequestMapping("/all")
-	public @ResponseBody Iterable<TestTable> getAll() {
-		return testTablerepository.findAll();
-	}
+	// @RequestMapping("/all")
+	// public @ResponseBody Iterable<TestTable> getAll() {
+	// 	return testTablerepository.findAll();
+	// }
 
-	@RequestMapping("/one")
-	public @ResponseBody TestTable getOne(Integer id) {
-		var item = testTablerepository.findById(id);
-		return item.orElse(new TestTable());
-	}
+	// @RequestMapping("/one")
+	// public @ResponseBody TestTable getOne(Integer id) {
+	// 	var item = testTablerepository.findById(id);
+	// 	return item.orElse(new TestTable());
+	// }
 
-	@RequestMapping("/search")
-	public @ResponseBody Iterable<TestTable> getSearch() {
-		var item = testTablerepository.findByCondition("name='测试java'");
-		return item;
-	}
+	// @RequestMapping("/search")
+	// public @ResponseBody Iterable<TestTable> getSearch() {
+	// 	var item = testTablerepository.findByCondition("name='测试java'");
+	// 	return item;
+	// }
 
 
 	@RequestMapping("/sql")

+ 0 - 1
src/main/java/com/kxs/adminap/controller/UsersController.java

@@ -13,7 +13,6 @@ import com.kxs.adminap.util.Util;
 
 import jakarta.annotation.Resource;
 
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.Dictionary;

+ 9 - 9
src/main/java/com/kxs/adminap/dao/TestTablerepository.java

@@ -1,13 +1,13 @@
-package com.kxs.adminap.dao;
+// package com.kxs.adminap.dao;
 
-import java.util.List;
+// import java.util.List;
 
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
+// import org.springframework.data.jpa.repository.JpaRepository;
+// import org.springframework.data.jpa.repository.Query;
 
-import com.kxs.adminap.enity.TestTable; 
+// import com.kxs.adminap.enity.TestTable; 
 
-public interface TestTablerepository extends JpaRepository<TestTable, Integer> {
-    @Query(value = "select * from test_table where #{condition}",nativeQuery = true)
-    List<TestTable> findByCondition(String condition);
-}
+// public interface TestTablerepository extends JpaRepository<TestTable, Integer> {
+//     @Query(value = "select * from test_table where #{condition}",nativeQuery = true)
+//     List<TestTable> findByCondition(String condition);
+// }

+ 66 - 66
src/main/java/com/kxs/adminap/enity/TestTable.java

@@ -1,89 +1,89 @@
-package com.kxs.adminap.enity;
+// package com.kxs.adminap.enity;
 
-import java.io.Serializable;
-import java.util.Date;
+// import java.io.Serializable;
+// import java.util.Date;
 
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.GeneratedValue;
-import jakarta.persistence.GenerationType;
-import jakarta.persistence.Id;
-import jakarta.persistence.Table;
+// import jakarta.persistence.Column;
+// import jakarta.persistence.Entity;
+// import jakarta.persistence.GeneratedValue;
+// import jakarta.persistence.GenerationType;
+// import jakarta.persistence.Id;
+// import jakarta.persistence.Table;
 
-@Entity
-@Table(name = "test_table")
-public class TestTable implements Serializable {
+// @Entity
+// @Table(name = "test_table")
+// public class TestTable implements Serializable {
 
-	@Id
-    @GeneratedValue(strategy = GenerationType.IDENTITY)
-	private Long id;
+// 	@Id
+//     @GeneratedValue(strategy = GenerationType.IDENTITY)
+// 	private Long id;
 	
-	@Column(name = "name")
-	private String name;
+// 	@Column(name = "name")
+// 	private String name;
 
-	@Column(name = "sex")
-	private Double sex;
+// 	@Column(name = "sex")
+// 	private Double sex;
 
-	@Column(name = "create_date")
-	private Date create_date;
+// 	@Column(name = "create_date")
+// 	private Date create_date;
 
-	@Column(name = "is_ok")
-	private Boolean is_ok;
+// 	@Column(name = "is_ok")
+// 	private Boolean is_ok;
 
-	@Column(name = "contents")
-	private String contents;
+// 	@Column(name = "contents")
+// 	private String contents;
 
-	// User的默认构造函数
-	public TestTable() {
-		super();
-	}
+// 	// User的默认构造函数
+// 	public TestTable() {
+// 		super();
+// 	}
 
-	public Long getId() {
-		return id;
-	}
+// 	public Long getId() {
+// 		return id;
+// 	}
 
-	public void setId(Long id) {
-		this.id = id;
-	}
+// 	public void setId(Long id) {
+// 		this.id = id;
+// 	}
 
-	public String getName() {
-		return name;
-	}
+// 	public String getName() {
+// 		return name;
+// 	}
 
-	public void setName(String name) {
-		this.name = name;
-	}
+// 	public void setName(String name) {
+// 		this.name = name;
+// 	}
 
-	public Double getSex() {
-		return sex;
-	}
+// 	public Double getSex() {
+// 		return sex;
+// 	}
 
-	public void setSex(Double sex) {
-		this.sex = sex;
-	}
+// 	public void setSex(Double sex) {
+// 		this.sex = sex;
+// 	}
 
-	public Date getCreateDate() {
-		return create_date;
-	}
+// 	public Date getCreateDate() {
+// 		return create_date;
+// 	}
 
-	public void setCreateDate(Date create_date) {
-		this.create_date = create_date;
-	}
+// 	public void setCreateDate(Date create_date) {
+// 		this.create_date = create_date;
+// 	}
 
-	public Boolean getIsOk() {
-		return is_ok;
-	}
+// 	public Boolean getIsOk() {
+// 		return is_ok;
+// 	}
 
-	public void setIsOk(Boolean is_ok) {
-		this.is_ok = is_ok;
-	}
+// 	public void setIsOk(Boolean is_ok) {
+// 		this.is_ok = is_ok;
+// 	}
 
-	public String getContents() {
-		return contents;
-	}
+// 	public String getContents() {
+// 		return contents;
+// 	}
 
-	public void setContents(String contents) {
-		this.contents = contents;
-	}
+// 	public void setContents(String contents) {
+// 		this.contents = contents;
+// 	}
 
-}
+// }

+ 6 - 6
src/main/resources/application.yml

@@ -1,8 +1,8 @@
 spring:
     datasource:
-        url: jdbc:mysql://localhost:3306/MyTest?useUnicode=true&characterEncoding=utf8
-        username: root
-        password: 123456
+        url: jdbc:mysql://47.109.31.237:3306/MyTest?useUnicode=true&characterEncoding=utf8
+        username: KxsMainServer
+        password: FrW8ZfxlcaVdm1r0
         driver-class-name: com.mysql.cj.jdbc.Driver
     jpa:
         show-sql: true
@@ -10,8 +10,8 @@ spring:
         date-format: yyyy-MM-dd HH:mm:ss
     data:
         redis:
-            database: 2
-            password: ym87540628
-            host: 47.108.209.1
+            database: 1
+            password: klm@redis
+            host: 47.109.31.237
             port: 6379
             timeout: 5000