2024年12月2日21:25:40

main
LeJingS 3 months ago
parent 81e00a5343
commit e1d1987fad

@ -9,18 +9,22 @@
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="spring-webai-quickstart" /> <module name="spring-webai-quickstart" />
<module name="jdbc-demo" /> <module name="jdbc-demo" />
<module name="http_demo" />
<module name="maven-hello" /> <module name="maven-hello" />
<module name="spring-list" /> <module name="spring-list" />
<module name="Mybatis_demo" /> <module name="Mybatis_demo" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
<bytecodeTargetLevel> <bytecodeTargetLevel>
<module name="http-demo" target="23" />
<module name="Mybatis-demo" target="17" /> <module name="Mybatis-demo" target="17" />
</bytecodeTargetLevel> </bytecodeTargetLevel>
</component> </component>
<component name="JavacSettings"> <component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="Mybatis_demo" options="-parameters" /> <module name="Mybatis_demo" options="-parameters" />
<module name="http-demo" options="-parameters" />
<module name="http_demo" options="-parameters" />
<module name="spring-list" options="-parameters" /> <module name="spring-list" options="-parameters" />
<module name="spring-webai-quickstart" options="-parameters" /> <module name="spring-webai-quickstart" options="-parameters" />
</option> </option>

@ -2,6 +2,8 @@
<project version="4"> <project version="4">
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8"> <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="file://$PROJECT_DIR$/Mybatis_demo/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/Mybatis_demo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/http-demo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/http_demo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jdbc-demo/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jdbc-demo/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/jdbc-demo/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/jdbc-demo/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/maven-hello/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/maven-hello/src/main/java" charset="UTF-8" />

@ -10,11 +10,14 @@
<option value="$PROJECT_DIR$/jdbc-demo/pom.xml" /> <option value="$PROJECT_DIR$/jdbc-demo/pom.xml" />
<option value="$PROJECT_DIR$/Mybatis_demo/pom.xml" /> <option value="$PROJECT_DIR$/Mybatis_demo/pom.xml" />
<option value="$PROJECT_DIR$/Mybatis-demo/pom.xml" /> <option value="$PROJECT_DIR$/Mybatis-demo/pom.xml" />
<option value="$PROJECT_DIR$/http-demo/pom.xml" />
<option value="$PROJECT_DIR$/http_demo/pom.xml" />
</list> </list>
</option> </option>
<option name="ignoredFiles"> <option name="ignoredFiles">
<set> <set>
<option value="$PROJECT_DIR$/Mybatis-demo/pom.xml" /> <option value="$PROJECT_DIR$/Mybatis-demo/pom.xml" />
<option value="$PROJECT_DIR$/http-demo/pom.xml" />
</set> </set>
</option> </option>
</component> </component>

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>top.lejings</groupId>
<artifactId>http_demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>http_demo</name>
<description>http_demo</description>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -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);
}
}

@ -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;
}
}

@ -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<String> hobby){
System.out.println(hobby);
return "ListOk";
}
}

@ -0,0 +1,10 @@
package top.lejings.http_demo.pojo;
import lombok.Data;
@Data
public class Address {
private String province;
private String city;
}

@ -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;
}

@ -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";
// }
//
//
//
//
//
//}

@ -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";
}
}

@ -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() {
}
}

@ -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";
// }
//
//
//
//
//
//}

@ -0,0 +1 @@
spring.application.name=spring-webai-quickstart
Loading…
Cancel
Save