Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sakura
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
徐瑞
sakura
Commits
c9e38db9
提交
c9e38db9
authored
2月 25, 2022
作者:
xurui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aaa
上级
03617e8d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
13 行增加
和
13 行删除
+13
-13
README.md
demo/README.md
+4
-4
Controller.java
...src/main/java/com/example/demo/Controller/Controller.java
+5
-5
readme.md
readme.md
+4
-4
没有找到文件。
demo/README.md
浏览文件 @
c9e38db9
...
@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
...
@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
##### 说明
##### 说明
```
```
Post /stu
s/add
Post /stu
dents/insertion
```
```
-
通过传递学生对象处理学生新增操作。
-
通过传递学生对象处理学生新增操作。
...
@@ -54,7 +54,7 @@ Post /stus/add
...
@@ -54,7 +54,7 @@ Post /stus/add
##### 说明
##### 说明
```
```
Delete /stu
s/delete
Delete /stu
dents/
```
```
-
通过传递学生id处理学生删除操作。
-
通过传递学生id处理学生删除操作。
...
@@ -72,7 +72,7 @@ Delete /stus/delete
...
@@ -72,7 +72,7 @@ Delete /stus/delete
通过传递学生对象处理学生修改操作。
通过传递学生对象处理学生修改操作。
```
```
Put /stu
s/update
Put /stu
dents/updation
```
```
-
业务层方法:update()
-
业务层方法:update()
...
@@ -89,7 +89,7 @@ Put /stus/update
...
@@ -89,7 +89,7 @@ Put /stus/update
通过传递学生id处理学生查询操作。
通过传递学生id处理学生查询操作。
```
```
Get /stu
s/select
Get /stu
dents/
```
```
-
业务层方法:select()
-
业务层方法:select()
...
...
demo/src/main/java/com/example/demo/Controller/Controller.java
浏览文件 @
c9e38db9
...
@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.*;
...
@@ -11,11 +11,11 @@ import org.springframework.web.bind.annotation.*;
* 浏览器通过映射地址找到本类方法
* 浏览器通过映射地址找到本类方法
*/
*/
@RestController
@RestController
@RequestMapping
(
"/stus"
)
@RequestMapping
(
"/stu
dent
s"
)
public
class
Controller
{
public
class
Controller
{
@Autowired
@Autowired
StuService
stuservice
;
StuService
stuservice
;
@RequestMapping
(
value
=
"/
select/
{id}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
GET
)
String
select
(
@PathVariable
Integer
id
){
String
select
(
@PathVariable
Integer
id
){
//通过id查找学生
//通过id查找学生
Student
select
=
stuservice
.
select
(
id
);
Student
select
=
stuservice
.
select
(
id
);
...
@@ -25,7 +25,7 @@ public class Controller{
...
@@ -25,7 +25,7 @@ public class Controller{
Gson
gson
=
new
Gson
();
Gson
gson
=
new
Gson
();
return
gson
.
toJson
(
select
);
return
gson
.
toJson
(
select
);
}
}
@RequestMapping
(
value
=
"/
add
"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/
insertion
"
,
method
=
RequestMethod
.
POST
)
String
add
(
@RequestBody
Student
s
)
{
String
add
(
@RequestBody
Student
s
)
{
try
{
try
{
if
(
s
.
getName
().
equals
(
""
)){
if
(
s
.
getName
().
equals
(
""
)){
...
@@ -48,7 +48,7 @@ public class Controller{
...
@@ -48,7 +48,7 @@ public class Controller{
return
"参数错误"
;
return
"参数错误"
;
}
}
}
}
@RequestMapping
(
value
=
"/updat
e
"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/updat
ion
"
,
method
=
RequestMethod
.
PUT
)
String
update
(
@RequestBody
Student
s
){
String
update
(
@RequestBody
Student
s
){
//修改学生
//修改学生
Integer
update
=
stuservice
.
update
(
s
);
Integer
update
=
stuservice
.
update
(
s
);
...
@@ -57,7 +57,7 @@ public class Controller{
...
@@ -57,7 +57,7 @@ public class Controller{
}
}
return
"修改成功!"
;
return
"修改成功!"
;
}
}
@RequestMapping
(
value
=
"/
delete/
{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/{id}"
,
method
=
RequestMethod
.
DELETE
)
String
delect
(
@PathVariable
Integer
id
){
String
delect
(
@PathVariable
Integer
id
){
//通过id删除学生
//通过id删除学生
Integer
delete
=
stuservice
.
delete
(
id
);
Integer
delete
=
stuservice
.
delete
(
id
);
...
...
readme.md
浏览文件 @
c9e38db9
...
@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
...
@@ -37,7 +37,7 @@ com.example.demo.mapper.StuMapper
##### 说明
##### 说明
```
```
Post /stu
s/add
Post /stu
dents/insertion
```
```
-
通过传递学生对象处理学生新增操作。
-
通过传递学生对象处理学生新增操作。
...
@@ -54,7 +54,7 @@ Post /stus/add
...
@@ -54,7 +54,7 @@ Post /stus/add
##### 说明
##### 说明
```
```
Delete /stu
s/delete
Delete /stu
dents/
```
```
-
通过传递学生id处理学生删除操作。
-
通过传递学生id处理学生删除操作。
...
@@ -72,7 +72,7 @@ Delete /stus/delete
...
@@ -72,7 +72,7 @@ Delete /stus/delete
通过传递学生对象处理学生修改操作。
通过传递学生对象处理学生修改操作。
```
```
Put /stu
s/update
Put /stu
dents/updation
```
```
-
业务层方法:update()
-
业务层方法:update()
...
@@ -89,7 +89,7 @@ Put /stus/update
...
@@ -89,7 +89,7 @@ Put /stus/update
通过传递学生id处理学生查询操作。
通过传递学生id处理学生查询操作。
```
```
Get /stu
s/select
Get /stu
dents/
```
```
-
业务层方法:select()
-
业务层方法:select()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论