-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
108 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
package com.markz.testApp.controller; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.markz.testApp.mappers.UserDetailsMapper; | ||
import com.markz.testApp.objects.UserDetail; | ||
|
||
@RestController | ||
public class MyTestController { | ||
|
||
@RequestMapping(value="/users/{user}") | ||
public UserDetail message(@PathVariable String user){ | ||
UserDetail userDetail = new UserDetail(); | ||
userDetail.setAge(21); | ||
userDetail.setName(user); | ||
userDetail.setUserId(user+"@markz.com"); | ||
userDetail.setZip(53717); | ||
|
||
return userDetail; | ||
@Autowired | ||
UserDetailsMapper userDetailsMapper; | ||
|
||
@RequestMapping(value = "/users/{id}") | ||
public UserDetail getUserById(@PathVariable int id) { | ||
return userDetailsMapper.getUserDetail(id); | ||
} | ||
|
||
@RequestMapping(value = "/users") | ||
public List<UserDetail> userList() { | ||
return userDetailsMapper.getAllUsers(); | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper | ||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
|
||
<mapper namespace="com.markz.testApp.mappers.UserDetailsMapper"> | ||
|
||
<resultMap type="com.markz.testApp.objects.UserDetail" id="UserResult"> | ||
<id property="id" column="id" /> | ||
<result property="userId" column="user_id" /> | ||
<result property="age" column="age" /> | ||
<result property="name" column="name" /> | ||
<result property="zip" column="zip" /> | ||
</resultMap> | ||
|
||
<select id="getUserDetail" parameterType="int" | ||
resultType="com.markz.testApp.objects.UserDetail"> | ||
SELECT | ||
id as id, | ||
user_id as userId, | ||
age as age, | ||
zip as zip, | ||
name as name | ||
FROM user_details | ||
WHERE id=#{id} | ||
</select> | ||
|
||
|
||
|
||
<select id="getAllUsers" parameterType="string" resultMap="UserResult"> | ||
SELECT * FROM user_details | ||
</select> | ||
|
||
<select id="getUserDetailByLoginId" resultMap="UserResult"> | ||
SELECT * FROM user_details | ||
WHERE user_id=#{loginId} | ||
</select> | ||
</mapper> |
This file was deleted.
Oops, something went wrong.
Binary file modified
BIN
+176 Bytes
(110%)
target/classes/com/markz/testApp/Objects/UserDetail.class
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-105 Bytes
(92%)
target/classes/com/markz/testApp/controller/MyTestController.class
Binary file not shown.
Binary file not shown.
37 changes: 37 additions & 0 deletions
37
target/classes/com/markz/testApp/mappers/UserDetailsMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE mapper | ||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
|
||
<mapper namespace="com.markz.testApp.mappers.UserDetailsMapper"> | ||
|
||
<resultMap type="com.markz.testApp.objects.UserDetail" id="UserResult"> | ||
<id property="id" column="id" /> | ||
<result property="userId" column="user_id" /> | ||
<result property="age" column="age" /> | ||
<result property="name" column="name" /> | ||
<result property="zip" column="zip" /> | ||
</resultMap> | ||
|
||
<select id="getUserDetail" parameterType="int" | ||
resultType="com.markz.testApp.objects.UserDetail"> | ||
SELECT | ||
id as id, | ||
user_id as userId, | ||
age as age, | ||
zip as zip, | ||
name as name | ||
FROM user_details | ||
WHERE id=#{id} | ||
</select> | ||
|
||
|
||
|
||
<select id="getAllUsers" parameterType="string" resultMap="UserResult"> | ||
SELECT * FROM user_details | ||
</select> | ||
|
||
<select id="getUserDetailByLoginId" resultMap="UserResult"> | ||
SELECT * FROM user_details | ||
WHERE user_id=#{loginId} | ||
</select> | ||
</mapper> |
2 changes: 1 addition & 1 deletion
2
target/m2e-wtp/web-resources/META-INF/maven/SpringMVC/SpringMVC/pom.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters