diff --git a/javaweb_ai/.idea/compiler.xml b/javaweb_ai/.idea/compiler.xml index e4e3d73..a4a7111 100644 --- a/javaweb_ai/.idea/compiler.xml +++ b/javaweb_ai/.idea/compiler.xml @@ -9,18 +9,22 @@ + + diff --git a/javaweb_ai/.idea/encodings.xml b/javaweb_ai/.idea/encodings.xml index 573b89b..138a748 100644 --- a/javaweb_ai/.idea/encodings.xml +++ b/javaweb_ai/.idea/encodings.xml @@ -2,6 +2,8 @@ + + diff --git a/javaweb_ai/.idea/misc.xml b/javaweb_ai/.idea/misc.xml index 228be2d..eebfaa3 100644 --- a/javaweb_ai/.idea/misc.xml +++ b/javaweb_ai/.idea/misc.xml @@ -10,11 +10,14 @@ diff --git a/javaweb_ai/.idea/vcs.xml b/javaweb_ai/.idea/vcs.xml index 94a25f7..288b36b 100644 --- a/javaweb_ai/.idea/vcs.xml +++ b/javaweb_ai/.idea/vcs.xml @@ -1,6 +1,7 @@ + \ No newline at end of file diff --git a/javaweb_ai/Mybatis_demo/target/classes/top/lejings/mybatis_demo/mapper/UserMapper.class b/javaweb_ai/Mybatis_demo/target/classes/top/lejings/mybatis_demo/mapper/UserMapper.class index 89a4cb7..8663328 100644 Binary files a/javaweb_ai/Mybatis_demo/target/classes/top/lejings/mybatis_demo/mapper/UserMapper.class and b/javaweb_ai/Mybatis_demo/target/classes/top/lejings/mybatis_demo/mapper/UserMapper.class differ diff --git a/javaweb_ai/http_demo/pom.xml b/javaweb_ai/http_demo/pom.xml new file mode 100644 index 0000000..3ed93fb --- /dev/null +++ b/javaweb_ai/http_demo/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 3.4.0 + + + top.lejings + http_demo + 0.0.1-SNAPSHOT + http_demo + http_demo + + + + + + + + + + + + + + + 17 + + + + org.springframework.boot + spring-boot-starter-web + + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/HttpDemoApplication.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/HttpDemoApplication.java new file mode 100644 index 0000000..ba9421f --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/HttpDemoApplication.java @@ -0,0 +1,13 @@ +package top.lejings.http_demo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class HttpDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(HttpDemoApplication.class, args); + } + +} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/Path.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/Path.java new file mode 100644 index 0000000..c9817e0 --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/Path.java @@ -0,0 +1,16 @@ +package top.lejings.http_demo; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class Path { + //路径参数 + + @RequestMapping("/path/{id}") + public String pathParam(@PathVariable Integer id) { + System.out.println("id:" + id); + return "pathParam:" + id; + } +} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/list.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/list.java new file mode 100644 index 0000000..9cf4fca --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/list.java @@ -0,0 +1,29 @@ +package top.lejings.http_demo; + +//数组集合参数 + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.List; + +@RestController +public class list { + +// //数组 +// @RequestMapping("/arrayParam") +// public String arrayParam(String[] hobby){ +// System.out.println(Arrays.toString(hobby)); +// return "ArrayOk"; +// } + + //集合 + @RequestMapping("/listParam") + public String listParam(@RequestParam List hobby){ + System.out.println(hobby); + return "ListOk"; + } + +} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/Address.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/Address.java new file mode 100644 index 0000000..babce3d --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/Address.java @@ -0,0 +1,10 @@ +package top.lejings.http_demo.pojo; + +import lombok.Data; + +@Data +public class Address { +private String province; +private String city; + +} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/User.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/User.java new file mode 100644 index 0000000..11b634a --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/pojo/User.java @@ -0,0 +1,13 @@ +package top.lejings.http_demo.pojo; + +import lombok.Data; + +@Data +public class User { + private String name; + private Integer age; + private Address address; + + + +} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/shili.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/shili.java new file mode 100644 index 0000000..099a758 --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/shili.java @@ -0,0 +1,59 @@ +package top.lejings.http_demo; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import top.lejings.http_demo.pojo.User; + +@RestController +public class shili { + + //@RequestParam注解,可以映射请求参数 + + + + + + + //springboot形式 + + @RequestMapping("/simpleParam") + public String simpleParam(String name,Integer age){ + System.out.println("用户名:"+name+",年龄:"+age); + return "ok"; + } + + + @RequestMapping("/simplepojo") + public String simplepojo(User user){ + + System.out.println(user); + + return "okpojo"; + } + + +} + +/* + *原始方式: + * */ +//public class yuanshi { +// +// +// @RequestMapping("/simpleParam") +// public String simpleParam(HttpServletRequest request){ +// //获取请求参数 +// String name = request.getParameter("name"); +// String ageStr = request.getParameter("age"); +// +// int age = Integer.parseInt(ageStr); +// System.out.println("用户名:"+name+",年龄:"+age); +// return "ok"; +// } +// +// +// +// +// +//} diff --git a/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/time_json.java b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/time_json.java new file mode 100644 index 0000000..61ac1e0 --- /dev/null +++ b/javaweb_ai/http_demo/src/main/java/top/lejings/http_demo/time_json.java @@ -0,0 +1,19 @@ +package top.lejings.http_demo; + +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import top.lejings.http_demo.pojo.User; + +@RestController +public class time_json { + //日期时间 + + //json + @RequestMapping("/jsonParam") + public String jsonParam(@RequestBody User user){ + System.out.println(user); + return "jsonOk"; + } + +} diff --git a/javaweb_ai/http_demo/src/main/resources/application.properties b/javaweb_ai/http_demo/src/main/resources/application.properties new file mode 100644 index 0000000..614265d --- /dev/null +++ b/javaweb_ai/http_demo/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.application.name=http_demo diff --git a/javaweb_ai/http_demo/src/test/java/top/lejings/http_demo/HttpDemoApplicationTests.java b/javaweb_ai/http_demo/src/test/java/top/lejings/http_demo/HttpDemoApplicationTests.java new file mode 100644 index 0000000..9fc7b53 --- /dev/null +++ b/javaweb_ai/http_demo/src/test/java/top/lejings/http_demo/HttpDemoApplicationTests.java @@ -0,0 +1,13 @@ +package top.lejings.http_demo; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class HttpDemoApplicationTests { + + @Test + void contextLoads() { + } + +} diff --git a/javaweb_ai/http_demo/target/classes/application.properties b/javaweb_ai/http_demo/target/classes/application.properties new file mode 100644 index 0000000..614265d --- /dev/null +++ b/javaweb_ai/http_demo/target/classes/application.properties @@ -0,0 +1 @@ +spring.application.name=http_demo diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/HttpDemoApplication.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/HttpDemoApplication.class new file mode 100644 index 0000000..3698c79 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/HttpDemoApplication.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/Path.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/Path.class new file mode 100644 index 0000000..bff3d49 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/Path.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/list.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/list.class new file mode 100644 index 0000000..2eadfc3 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/list.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/Address.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/Address.class new file mode 100644 index 0000000..c817243 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/Address.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/User.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/User.class new file mode 100644 index 0000000..1674ca1 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/pojo/User.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/shili.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/shili.class new file mode 100644 index 0000000..640bb70 Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/shili.class differ diff --git a/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/time_json.class b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/time_json.class new file mode 100644 index 0000000..9c1bbec Binary files /dev/null and b/javaweb_ai/http_demo/target/classes/top/lejings/http_demo/time_json.class differ diff --git a/javaweb_ai/spring-webai-quickstart/src/main/java/top/lejings/springwebaiquickstart/yuanshi.java b/javaweb_ai/spring-webai-quickstart/src/main/java/top/lejings/springwebaiquickstart/yuanshi.java new file mode 100644 index 0000000..928a01f --- /dev/null +++ b/javaweb_ai/spring-webai-quickstart/src/main/java/top/lejings/springwebaiquickstart/yuanshi.java @@ -0,0 +1,52 @@ +package top.lejings.springwebaiquickstart; + +import jakarta.servlet.http.HttpServletRequest; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class yuanshi { + + //springboot形式 + + @RequestMapping("/simpleParam") + public String simpleParam(String name,Integer age){ + System.out.println("用户名:"+name+",年龄:"+age); + return "ok"; + } + + +} + +/* + * + * 原始方式: + * + * + * + * + * + * + * + * + * + * */ +//public class yuanshi { +// +// +// @RequestMapping("/simpleParam") +// public String simpleParam(HttpServletRequest request){ +// //获取请求参数 +// String name = request.getParameter("name"); +// String ageStr = request.getParameter("age"); +// +// int age = Integer.parseInt(ageStr); +// System.out.println("用户名:"+name+",年龄:"+age); +// return "ok"; +// } +// +// +// +// +// +//} diff --git a/javaweb_ai/spring-webai-quickstart/target/classes/application.properties b/javaweb_ai/spring-webai-quickstart/target/classes/application.properties new file mode 100644 index 0000000..1675bff --- /dev/null +++ b/javaweb_ai/spring-webai-quickstart/target/classes/application.properties @@ -0,0 +1 @@ +spring.application.name=spring-webai-quickstart diff --git a/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/Hello.class b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/Hello.class new file mode 100644 index 0000000..39d918b Binary files /dev/null and b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/Hello.class differ diff --git a/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/SpringWebaiQuickstartApplication.class b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/SpringWebaiQuickstartApplication.class new file mode 100644 index 0000000..211e874 Binary files /dev/null and b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/SpringWebaiQuickstartApplication.class differ diff --git a/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/yuanshi.class b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/yuanshi.class new file mode 100644 index 0000000..1f47260 Binary files /dev/null and b/javaweb_ai/spring-webai-quickstart/target/classes/top/lejings/springwebaiquickstart/yuanshi.class differ