shuzheng 9 år sedan
förälder
incheckning
7d6e48a4a1

+ 2 - 1
.gitignore

@@ -1,3 +1,4 @@
 .idea
 *.iml
-target
+target
+.log

+ 4 - 4
README.md

@@ -12,6 +12,10 @@ zheng
 |    ├── qa-dao
 |    ├── qa-service
 |    └── qa-web
+├── upms 通用用户权限系统
+|    ├── upms-dao
+|    ├── upms-service
+|    └── upms-admin
 ├── pay 支付系统
 |    ├── pay-service
 |    ├── pay-sdk
@@ -28,10 +32,6 @@ zheng
 |    └── wechat-app 小程序
 |         ├── wechat-app-sdk
 |         └── wechat-app-example
-├── upms 通用用户权限系统
-|    ├── upms-dao
-|    ├── upms-service
-|    └── upms-admin
 ├── api 接口系统
 └── oss 对象存储系统
      ├── oss-sdk

+ 0 - 5
springboot/pom.xml

@@ -83,11 +83,6 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-redis</artifactId>
 		</dependency>
-		<!-- mongodb -->
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-data-mongodb</artifactId>
-		</dependency>
 	</dependencies>
 
 	<build>

+ 17 - 1
springboot/src/main/java/com/zheng/springboot/web/HelloController.java

@@ -1,5 +1,6 @@
 package com.zheng.springboot.web;
 
+import com.zheng.springboot.domain.User;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.stereotype.Controller;
@@ -7,6 +8,9 @@ import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Created by ZhangShuzheng on 2016/11/16.
  */
@@ -15,9 +19,21 @@ public class HelloController {
 
 	@ApiOperation(value="测试首页", notes="测试首页get请求")
 	@ApiImplicitParam(name = "map", value = "ModelMap实体map", required = false, dataType = "ModelMap")
-	@RequestMapping(value = "/index", method = RequestMethod.GET)
+	@RequestMapping(value = "/hello", method = RequestMethod.GET)
 	public String index(ModelMap map) {
 		map.addAttribute("host", "http://www.zhangshuzheng.cn");
+		List<User> users = new ArrayList<>();
+		User user = new User();
+		user.setId(null);
+		user.setAge(11);
+		user.setName("");
+		users.add(user);
+		user = new User();
+		user.setId(2l);
+		user.setAge(22);
+		user.setName("lisi");
+		users.add(user);
+		map.addAttribute("users", users);
 		return "/index";
 	}
 

+ 1 - 0
springboot/src/main/resources/application-dev.properties

@@ -0,0 +1 @@
+profile.env=dev

+ 1 - 0
springboot/src/main/resources/application-prod.properties

@@ -0,0 +1 @@
+profile.env=prod

+ 1 - 0
springboot/src/main/resources/application-test.properties

@@ -0,0 +1 @@
+profile.env=test

+ 3 - 0
springboot/src/main/resources/application.properties

@@ -1,3 +1,6 @@
+########## »·¾³ ##########
+spring.profiles.active=dev
+evn=${profile.env}
 ########## µ¥Êý¾ÝÔ´ ##########
 #spring.datasource.url=jdbc:mysql://localhost:3306/zheng
 #spring.datasource.username=root

+ 7 - 1
springboot/src/main/resources/templates/index.html

@@ -1,10 +1,16 @@
 <!DOCTYPE html>
-<html lang="en">
+<html xmlns:th="http://www.thymeleaf.org"
+      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
 <head>
     <meta charset="UTF-8"/>
     <title></title>
 </head>
 <body>
 <h1 th:text="${host}">Hello World</h1>
+<ul  th:each="user : ${users}">
+    <li th:text="${user.id}"></li>
+    <li th:text="${user.age}"></li>
+    <li th:text="${user.name}"></li>
+</ul>
 </body>
 </html>

+ 2 - 3
springboot/src/test/java/com/zheng/SpringbootApplicationTests.java

@@ -1,7 +1,6 @@
 package com.zheng;
 
 import com.zheng.springboot.SpringbootApplication;
-import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,8 +19,8 @@ public class SpringbootApplicationTests {
 	public void contextLoads() {
 		System.out.println("=============================== redis start ===============================");
 		// 保存字符串
-		stringRedisTemplate.opsForValue().set("aaa", "111");
-		Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));
+//		stringRedisTemplate.opsForValue().set("aaa", "111");
+//		Assert.assertEquals("111", stringRedisTemplate.opsForValue().get("aaa"));
 		System.out.println("=============================== redis end ===============================");
 	}