Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
御承扬
Campus
提交
85c3e102
C
Campus
项目概览
御承扬
/
Campus
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Campus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
85c3e102
编写于
6月 10, 2020
作者:
7
7wc98#14
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update
上级
adf1c182
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
9 deletion
+13
-9
src/main/java/com/pyc/campus/controller/WebController.java
src/main/java/com/pyc/campus/controller/WebController.java
+10
-2
src/main/java/com/pyc/campus/dao/NewsRepository.java
src/main/java/com/pyc/campus/dao/NewsRepository.java
+0
-3
src/main/resources/templates/page/BrowseNews.html
src/main/resources/templates/page/BrowseNews.html
+2
-3
src/main/resources/templates/page/PublishNews.html
src/main/resources/templates/page/PublishNews.html
+1
-1
未找到文件。
src/main/java/com/pyc/campus/controller/WebController.java
浏览文件 @
85c3e102
...
...
@@ -228,9 +228,17 @@ public class WebController {
String
currentStudentId
=
((
UserDetails
)
securityContext
.
getAuthentication
().
getPrincipal
()).
getUsername
();
Student
s
=
studentRepository
.
findNameByStudentID
(
currentStudentId
);
model
.
addAttribute
(
"curUse"
,
s
);
long
nextId
=
newsRepository
.
countAll
()+
1
;
long
i
=
0
;
List
<
News
>
list
=
newsRepository
.
findAll
();
for
(
News
l:
list
){
if
(
l
!=
null
)
{
i
++;
}
}
long
nextId
=
i
+
1
;
News
news
=
new
News
(
nextId
,
title
,
content
);
newsRepository
.
save
(
news
);
return
"/page/
Browse
News"
;
return
"/page/
Publish
News"
;
}
}
src/main/java/com/pyc/campus/dao/NewsRepository.java
浏览文件 @
85c3e102
...
...
@@ -10,9 +10,6 @@ package com.pyc.campus.dao;
import
com.pyc.campus.domain.News
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
public
interface
NewsRepository
extends
JpaRepository
<
News
,
Long
>
{
Long
countAll
();
}
src/main/resources/templates/page/BrowseNews.html
浏览文件 @
85c3e102
...
...
@@ -169,9 +169,8 @@
</div>
<div
id=
"footer"
>
<div
class=
"container"
>
<p>
<span>
Campus logo
</span>
<span>
@2020 御承扬Copyright
©
2020-05-04
</span>
<p
style=
"color: white;text-align: center;"
>
@2020 御承扬Copyright
©
2020-05-04
</p>
</div>
</div>
...
...
src/main/resources/templates/page/PublishNews.html
浏览文件 @
85c3e102
...
...
@@ -78,7 +78,7 @@
</div>
<div
class=
"main"
>
<h1><span
th:text=
"${curUse.getName()}"
></span>
您好!
</h1>
<form
class=
"form-horizontal"
name=
"newsForm"
method=
"post"
action=
"/saveNews"
onsubmit=
"return checkTitleAndContent(newsForm.title, newsForm.content)"
>
<form
class=
"form-horizontal"
name=
"newsForm"
method=
"post"
th:action=
"@{/saveNews}"
action=
"/saveNews"
onsubmit=
"return checkTitleAndContent(newsForm.title, newsForm.content)"
>
<table
style=
"text-align: center;width: 450px;height: 300px;border: 1px;"
>
<tr>
<td
style=
"text-align: center;height: 40px"
colspan=
"2"
>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录