diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/javacode.iml b/.idea/javacode.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/javacode.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..133bfed --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..ad0f90e --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/spring/.idea/vcs.xml b/spring/.idea/vcs.xml index d843f34..6c0b863 100644 --- a/spring/.idea/vcs.xml +++ b/spring/.idea/vcs.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/spring/target/classes/com/spring/App.class b/spring/target/classes/com/spring/App.class deleted file mode 100644 index 0980dc5..0000000 Binary files a/spring/target/classes/com/spring/App.class and /dev/null differ diff --git a/spring/target/classes/com/spring/DBTools.class b/spring/target/classes/com/spring/DBTools.class deleted file mode 100644 index 3c482c1..0000000 Binary files a/spring/target/classes/com/spring/DBTools.class and /dev/null differ diff --git a/spring/target/classes/com/spring/UserDao.class b/spring/target/classes/com/spring/UserDao.class deleted file mode 100644 index ada32b7..0000000 Binary files a/spring/target/classes/com/spring/UserDao.class and /dev/null differ diff --git a/spring/target/classes/com/spring/UserService.class b/spring/target/classes/com/spring/UserService.class deleted file mode 100644 index f4eda53..0000000 Binary files a/spring/target/classes/com/spring/UserService.class and /dev/null differ diff --git a/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/JsaonControllor.java b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/JsaonControllor.java new file mode 100644 index 0000000..8025fda --- /dev/null +++ b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/JsaonControllor.java @@ -0,0 +1,20 @@ +package com.zhangzihao.springboot.springboot.Controllor; + +import com.zhangzihao.springboot.springboot.model.User; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +public class JsaonControllor { + //返回Json数据,App/小程序 前端分离 + @RequestMapping("getuser") + @ResponseBody + public User getUser() + { + User user = new User(); + user.setUsername("张三"); + user.setClassname("21医信"); + return user; + } +} diff --git a/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/LoginController.java b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/LoginController.java new file mode 100644 index 0000000..ae25d9e --- /dev/null +++ b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/LoginController.java @@ -0,0 +1,27 @@ +package com.zhangzihao.springboot.springboot.Controllor; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +@Controller +public class LoginController { + @RequestMapping("login") + public String login() + { + return "login"; + } + @RequestMapping("logincommit") + public String logincommit(String username,String password) + { + //todo 数据库验证 + if(username.equals("admin") && password.equals("123")) + { + //登陆成功 + return "success.html"; + }else{ + //登陆失败 + return "fail.html"; + } + + } +} diff --git a/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/TestController.java b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/TestController.java new file mode 100644 index 0000000..e4a078a --- /dev/null +++ b/springboot/src/main/java/com/zhangzihao/springboot/springboot/Controllor/TestController.java @@ -0,0 +1,32 @@ +package com.zhangzihao.springboot.springboot.Controllor; + +import com.zhangzihao.springboot.springboot.model.User; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestMapping; + +import java.util.ArrayList; +import java.util.List; + +@Controller +public class TestController { + @RequestMapping("test") + public String test(Model model) { + //返回网页+值 + User user = new User(); + user.setUsername("张三"); + user.setClassname("21医信"); + + List userList = new ArrayList<>(); + for (int i = 0; i < 10; i++){ + User user1 = new User(); + user1.setUsername("张三"+i); + user1.setClassname("21医信"+i); + userList.add(user1); + } + model.addAttribute("name","张三"); + model.addAttribute("user",user); + model.addAttribute("userList",userList); + return "test.html"; + } +} diff --git a/springboot/src/main/java/com/zhangzihao/springboot/springboot/TestController.java b/springboot/src/main/java/com/zhangzihao/springboot/springboot/TestController.java deleted file mode 100644 index 2550182..0000000 --- a/springboot/src/main/java/com/zhangzihao/springboot/springboot/TestController.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.zhangzihao.springboot.springboot; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -public class TestController { - @RequestMapping("test") - public String test() - { - return "test.html"; - } -} diff --git a/springboot/src/main/java/com/zhangzihao/springboot/springboot/model/User.java b/springboot/src/main/java/com/zhangzihao/springboot/springboot/model/User.java new file mode 100644 index 0000000..85a6d4f --- /dev/null +++ b/springboot/src/main/java/com/zhangzihao/springboot/springboot/model/User.java @@ -0,0 +1,10 @@ +package com.zhangzihao.springboot.springboot.model; + +import lombok.Data; + +//Data属性自动生成set,get方法 +@Data +public class User { + private String username; + private String classname; +} diff --git a/springboot/src/main/resources/application.properties b/springboot/src/main/resources/application.properties index ae64c68..d0bceb4 100644 --- a/springboot/src/main/resources/application.properties +++ b/springboot/src/main/resources/application.properties @@ -1 +1,4 @@ spring.application.name=springboot +#server.port=80 +#server.servlet.context-path=springboot +spring.web.resources.static-locations=classpath:/static/ \ No newline at end of file diff --git a/springboot/src/main/resources/templates/fail.html b/springboot/src/main/resources/templates/fail.html new file mode 100644 index 0000000..dc03bbe --- /dev/null +++ b/springboot/src/main/resources/templates/fail.html @@ -0,0 +1,11 @@ + + + + + Title + + +

登录失败

+ + + \ No newline at end of file diff --git a/springboot/src/main/resources/templates/login.html b/springboot/src/main/resources/templates/login.html new file mode 100644 index 0000000..52662f9 --- /dev/null +++ b/springboot/src/main/resources/templates/login.html @@ -0,0 +1,16 @@ + + + + + Title + + +

登录页面

+ +
+
+ +
+ + + \ No newline at end of file diff --git a/springboot/src/main/resources/templates/success.html b/springboot/src/main/resources/templates/success.html new file mode 100644 index 0000000..441add2 --- /dev/null +++ b/springboot/src/main/resources/templates/success.html @@ -0,0 +1,10 @@ + + + + + Title + + +

登录成功

+ + \ No newline at end of file diff --git a/springboot/src/main/resources/templates/test.html b/springboot/src/main/resources/templates/test.html index 566549b..a114e23 100644 --- a/springboot/src/main/resources/templates/test.html +++ b/springboot/src/main/resources/templates/test.html @@ -5,6 +5,17 @@ Title - +

woc wodefa

+
+
+ + + + + + + + +
\ No newline at end of file diff --git a/untitled1/.idea/uiDesigner.xml b/untitled1/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/untitled1/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/untitled1/.idea/vcs.xml b/untitled1/.idea/vcs.xml index d843f34..c57ac5a 100644 --- a/untitled1/.idea/vcs.xml +++ b/untitled1/.idea/vcs.xml @@ -1,4 +1,7 @@ - + + + + \ No newline at end of file