Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
_江南一点雨
VBlog
提交
0a1be11a
V
VBlog
项目概览
_江南一点雨
/
VBlog
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
VBlog
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
0a1be11a
编写于
10月 29, 2019
作者:
江
江南一点雨
提交者:
GitHub
10月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #39 from linxbin/master
新建栏目时,增加栏目名称不为空的判断;增加回收站文章还原到原处的功能
上级
285383c6
3e0fd4a5
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
60 addition
and
7 deletion
+60
-7
blogserver/src/main/java/org/sang/controller/ArticleController.java
.../src/main/java/org/sang/controller/ArticleController.java
+8
-0
blogserver/src/main/java/org/sang/controller/CategoryController.java
...src/main/java/org/sang/controller/CategoryController.java
+6
-0
blogserver/src/main/java/org/sang/mapper/ArticleMapper.java
blogserver/src/main/java/org/sang/mapper/ArticleMapper.java
+2
-0
blogserver/src/main/java/org/sang/mapper/ArticleMapper.xml
blogserver/src/main/java/org/sang/mapper/ArticleMapper.xml
+3
-1
blogserver/src/main/java/org/sang/service/ArticleService.java
...server/src/main/java/org/sang/service/ArticleService.java
+4
-0
vueblog/src/components/ArticleList.vue
vueblog/src/components/ArticleList.vue
+5
-5
vueblog/src/components/BlogTable.vue
vueblog/src/components/BlogTable.vue
+32
-1
未找到文件。
blogserver/src/main/java/org/sang/controller/ArticleController.java
浏览文件 @
0a1be11a
...
@@ -93,6 +93,14 @@ public class ArticleController {
...
@@ -93,6 +93,14 @@ public class ArticleController {
return
new
RespBean
(
"error"
,
"删除失败!"
);
return
new
RespBean
(
"error"
,
"删除失败!"
);
}
}
@RequestMapping
(
value
=
"/restore"
,
method
=
RequestMethod
.
PUT
)
public
RespBean
restoreArticle
(
Integer
articleId
)
{
if
(
articleService
.
restoreArticle
(
articleId
)
==
1
)
{
return
new
RespBean
(
"success"
,
"还原成功!"
);
}
return
new
RespBean
(
"error"
,
"还原失败!"
);
}
@RequestMapping
(
"/dataStatistics"
)
@RequestMapping
(
"/dataStatistics"
)
public
Map
<
String
,
Object
>
dataStatistics
()
{
public
Map
<
String
,
Object
>
dataStatistics
()
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
...
blogserver/src/main/java/org/sang/controller/CategoryController.java
浏览文件 @
0a1be11a
...
@@ -36,7 +36,13 @@ public class CategoryController {
...
@@ -36,7 +36,13 @@ public class CategoryController {
@RequestMapping
(
value
=
"/"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/"
,
method
=
RequestMethod
.
POST
)
public
RespBean
addNewCate
(
Category
category
)
{
public
RespBean
addNewCate
(
Category
category
)
{
if
(
""
.
equals
(
category
.
getCateName
())
||
category
.
getCateName
()
==
null
)
{
return
new
RespBean
(
"error"
,
"请输入栏目名称!"
);
}
int
result
=
categoryService
.
addCategory
(
category
);
int
result
=
categoryService
.
addCategory
(
category
);
if
(
result
==
1
)
{
if
(
result
==
1
)
{
return
new
RespBean
(
"success"
,
"添加成功!"
);
return
new
RespBean
(
"success"
,
"添加成功!"
);
}
}
...
...
blogserver/src/main/java/org/sang/mapper/ArticleMapper.java
浏览文件 @
0a1be11a
...
@@ -23,6 +23,8 @@ public interface ArticleMapper {
...
@@ -23,6 +23,8 @@ public interface ArticleMapper {
int
updateArticleState
(
@Param
(
"aids"
)
Long
aids
[],
@Param
(
"state"
)
Integer
state
);
int
updateArticleState
(
@Param
(
"aids"
)
Long
aids
[],
@Param
(
"state"
)
Integer
state
);
int
updateArticleStateById
(
@Param
(
"articleId"
)
Integer
articleId
,
@Param
(
"state"
)
Integer
state
);
int
deleteArticleById
(
@Param
(
"aids"
)
Long
[]
aids
);
int
deleteArticleById
(
@Param
(
"aids"
)
Long
[]
aids
);
Article
getArticleById
(
Long
aid
);
Article
getArticleById
(
Long
aid
);
...
...
blogserver/src/main/java/org/sang/mapper/ArticleMapper.xml
浏览文件 @
0a1be11a
...
@@ -65,7 +65,9 @@
...
@@ -65,7 +65,9 @@
#{aid}
#{aid}
</foreach>
</foreach>
</update>
</update>
<update
id=
"updateArticleStateById"
>
UPDATE article SET state=#{state} WHERE id = #{articleId}
</update>
<delete
id=
"deleteArticleById"
>
<delete
id=
"deleteArticleById"
>
DELETE FROM article WHERE id IN
DELETE FROM article WHERE id IN
<foreach
collection=
"aids"
item=
"aid"
open=
"("
close=
")"
separator=
","
>
<foreach
collection=
"aids"
item=
"aid"
open=
"("
close=
")"
separator=
","
>
...
...
blogserver/src/main/java/org/sang/service/ArticleService.java
浏览文件 @
0a1be11a
...
@@ -113,6 +113,10 @@ public class ArticleService {
...
@@ -113,6 +113,10 @@ public class ArticleService {
}
}
}
}
public
int
restoreArticle
(
Integer
articleId
)
{
return
articleMapper
.
updateArticleStateById
(
articleId
,
1
);
// 从回收站还原在原处
}
public
Article
getArticleById
(
Long
aid
)
{
public
Article
getArticleById
(
Long
aid
)
{
Article
article
=
articleMapper
.
getArticleById
(
aid
);
Article
article
=
articleMapper
.
getArticleById
(
aid
);
articleMapper
.
pvIncrement
(
aid
);
articleMapper
.
pvIncrement
(
aid
);
...
...
vueblog/src/components/ArticleList.vue
浏览文件 @
0a1be11a
...
@@ -3,19 +3,19 @@
...
@@ -3,19 +3,19 @@
<el-main
class=
"main"
>
<el-main
class=
"main"
>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick"
type=
"card"
>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick"
type=
"card"
>
<el-tab-pane
label=
"全部文章"
name=
"all"
>
<el-tab-pane
label=
"全部文章"
name=
"all"
>
<blog_table
state=
"-1"
:showEdit=
"false"
:showDelete=
"false"
:activeName=
"activeName"
></blog_table>
<blog_table
state=
"-1"
:showEdit=
"false"
:showDelete=
"false"
:
showRestore=
"false"
:
activeName=
"activeName"
></blog_table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"已发表"
name=
"post"
>
<el-tab-pane
label=
"已发表"
name=
"post"
>
<blog_table
state=
"1"
:showEdit=
"true"
:showDelete=
"true"
:activeName=
"activeName"
></blog_table>
<blog_table
state=
"1"
:showEdit=
"true"
:showDelete=
"true"
:
showRestore=
"false"
:
activeName=
"activeName"
></blog_table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"草稿箱"
name=
"draft"
>
<el-tab-pane
label=
"草稿箱"
name=
"draft"
>
<blog_table
state=
"0"
:showEdit=
"true"
:showDelete=
"true"
:activeName=
"activeName"
></blog_table>
<blog_table
state=
"0"
:showEdit=
"true"
:showDelete=
"true"
:
showRestore=
"false"
:
activeName=
"activeName"
></blog_table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"回收站"
name=
"dustbin"
>
<el-tab-pane
label=
"回收站"
name=
"dustbin"
>
<blog_table
state=
"2"
:showEdit=
"false"
:showDelete=
"true"
:activeName=
"activeName"
></blog_table>
<blog_table
state=
"2"
:showEdit=
"false"
:showDelete=
"true"
:
showRestore=
"true"
:
activeName=
"activeName"
></blog_table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"博客管理"
name=
"blogmana"
v-if=
"isAdmin"
>
<el-tab-pane
label=
"博客管理"
name=
"blogmana"
v-if=
"isAdmin"
>
<blog_table
state=
"-2"
:showEdit=
"false"
:showDelete=
"true"
:activeName=
"activeName"
></blog_table>
<blog_table
state=
"-2"
:showEdit=
"false"
:showDelete=
"true"
:
showRestore=
"false"
:
activeName=
"activeName"
></blog_table>
</el-tab-pane>
</el-tab-pane>
<el-tab-pane
label=
"博客配置"
name=
"blogcfg"
>
<el-tab-pane
label=
"博客配置"
name=
"blogcfg"
>
<blog_cfg></blog_cfg>
<blog_cfg></blog_cfg>
...
...
vueblog/src/components/BlogTable.vue
浏览文件 @
0a1be11a
...
@@ -57,6 +57,10 @@
...
@@ -57,6 +57,10 @@
size=
"mini"
size=
"mini"
@
click=
"handleEdit(scope.$index, scope.row)"
v-if=
"showEdit"
>
编辑
@
click=
"handleEdit(scope.$index, scope.row)"
v-if=
"showEdit"
>
编辑
</el-button>
</el-button>
<el-button
size=
"mini"
@
click=
"handleRestore(scope.$index, scope.row)"
v-if=
"showRestore"
>
还原
</el-button>
<el-button
<el-button
size=
"mini"
size=
"mini"
type=
"danger"
type=
"danger"
...
@@ -168,6 +172,33 @@
...
@@ -168,6 +172,33 @@
this
.
dustbinData
.
push
(
row
.
id
);
this
.
dustbinData
.
push
(
row
.
id
);
this
.
deleteToDustBin
(
row
.
state
);
this
.
deleteToDustBin
(
row
.
state
);
},
},
handleRestore
(
index
,
row
)
{
let
_this
=
this
;
this
.
$confirm
(
'
将该文件还原到原处,是否继续?
'
,
'
提示
'
,{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}
).
then
(()
=>
{
_this
.
loading
=
true
;
putRequest
(
'
/article/restore
'
,
{
articleId
:
row
.
id
}).
then
(
resp
=>
{
if
(
resp
.
status
==
200
)
{
var
data
=
resp
.
data
;
_this
.
$message
({
type
:
data
.
status
,
message
:
data
.
msg
});
if
(
data
.
status
==
'
success
'
)
{
window
.
bus
.
$emit
(
'
blogTableReload
'
)
//通过选项卡都重新加载数据
}
}
else
{
_this
.
$message
({
type
:
'
error
'
,
message
:
'
还原失败!
'
});
}
_this
.
loading
=
false
;
});
}).
catch
(()
=>
{
_this
.
$message
({
type
:
'
info
'
,
message
:
'
已取消还原
'
});
});
},
deleteToDustBin
(
state
){
deleteToDustBin
(
state
){
var
_this
=
this
;
var
_this
=
this
;
this
.
$confirm
(
state
!=
2
?
'
将该文件放入回收站,是否继续?
'
:
'
永久删除该文件, 是否继续?
'
,
'
提示
'
,
{
this
.
$confirm
(
state
!=
2
?
'
将该文件放入回收站,是否继续?
'
:
'
永久删除该文件, 是否继续?
'
,
'
提示
'
,
{
...
@@ -208,6 +239,6 @@
...
@@ -208,6 +239,6 @@
});
});
}
}
},
},
props
:
[
'
state
'
,
'
showEdit
'
,
'
showDelete
'
,
'
activeName
'
]
props
:
[
'
state
'
,
'
showEdit
'
,
'
showDelete
'
,
'
activeName
'
,
'
showRestore
'
]
}
}
</
script
>
</
script
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录