Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
3a216db4
提交
3a216db4
authored
6月 30, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
帖子管理优化
上级
be0f0664
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
46 行增加
和
8 行删除
+46
-8
PostController.java
...src/main/java/com/platform/controller/PostController.java
+10
-3
PostDao.java
platform-admin/src/main/java/com/platform/dao/PostDao.java
+3
-1
PostServiceImpl.java
.../main/java/com/platform/service/impl/PostServiceImpl.java
+27
-3
PostDao.xml
...orm-admin/src/main/resources/com/platform/dao/PostDao.xml
+5
-0
post.js
platform-admin/src/main/webapp/js/sys/post.js
+1
-1
没有找到文件。
platform-admin/src/main/java/com/platform/controller/PostController.java
浏览文件 @
3a216db4
...
@@ -116,9 +116,16 @@ public class PostController {
...
@@ -116,9 +116,16 @@ public class PostController {
@ResponseBody
@ResponseBody
public
R
placedPostTop
(
@PathVariable
(
"id"
)
String
id
)
{
public
R
placedPostTop
(
@PathVariable
(
"id"
)
String
id
)
{
postService
.
placedPostTop
(
id
);
int
res
=
postService
.
placedPostTop
(
id
);
if
(
res
>
0
)
{
return
R
.
ok
();
return
R
.
ok
();
}
else
if
(
res
==
0
)
{
return
R
.
error
(
"置顶数量最多4个"
);
}
else
if
(
res
==
-
1
)
{
return
R
.
error
(
"改帖子已下线或删除"
);
}
return
R
.
error
(
"操作失败"
);
}
}
...
...
platform-admin/src/main/java/com/platform/dao/PostDao.java
浏览文件 @
3a216db4
...
@@ -11,7 +11,9 @@ import org.apache.ibatis.annotations.Param;
...
@@ -11,7 +11,9 @@ import org.apache.ibatis.annotations.Param;
*/
*/
public
interface
PostDao
extends
BaseDao
<
PostEntity
>
{
public
interface
PostDao
extends
BaseDao
<
PostEntity
>
{
int
changePostStatus
(
@Param
(
"archived"
)
Integer
archived
,
@Param
(
"ids"
)
String
ids
[]);
int
changePostStatus
(
@Param
(
"archived"
)
Integer
archived
,
@Param
(
"ids"
)
String
ids
[]);
int
placedTop
(
Integer
id
,
Integer
isTop
);
int
placedTop
(
Integer
id
,
Integer
isTop
);
int
getPostTopNum
();
}
}
platform-admin/src/main/java/com/platform/service/impl/PostServiceImpl.java
浏览文件 @
3a216db4
...
@@ -132,6 +132,18 @@ public class PostServiceImpl implements PostService {
...
@@ -132,6 +132,18 @@ public class PostServiceImpl implements PostService {
*/
*/
@Override
@Override
public
int
changeStatus
(
Integer
archived
,
String
[]
ids
)
{
public
int
changeStatus
(
Integer
archived
,
String
[]
ids
)
{
System
.
err
.
println
(
"======>>>>>"
+
archived
);
//下线帖子
if
(
"2"
.
equals
(
archived
.
toString
()))
{
for
(
int
i
=
0
;
i
<
ids
.
length
;
i
++)
{
PostEntity
post
=
postDao
.
queryObject
(
ids
[
i
]);
Integer
isTop
=
post
.
getIsTop
();
if
(
"1"
.
equals
(
isTop
.
toString
()))
{
post
.
setIsTop
(
0
);
//取消置顶
postDao
.
update
(
post
);
}
}
}
return
postDao
.
changePostStatus
(
archived
,
ids
);
return
postDao
.
changePostStatus
(
archived
,
ids
);
}
}
...
@@ -144,10 +156,22 @@ public class PostServiceImpl implements PostService {
...
@@ -144,10 +156,22 @@ public class PostServiceImpl implements PostService {
*/
*/
@Override
@Override
public
int
placedPostTop
(
String
id
)
{
public
int
placedPostTop
(
String
id
)
{
int
res
=
0
;
//根据ID查询帖子信息
//根据ID查询帖子信息
PostEntity
post
=
postDao
.
queryObject
(
id
);
PostEntity
post
=
postDao
.
queryObject
(
id
);
Integer
isTop
=
post
.
getIsTop
();
Integer
isTop
=
post
.
getIsTop
();
//置顶标志
Integer
archived
=
post
.
getArchived
();
//状态
//最多置顶4个帖子
if
(
postDao
.
getPostTopNum
()
>=
4
&&
"0"
.
equals
(
isTop
.
toString
()))
{
return
res
;
}
if
(
"1"
.
equals
(
archived
.
toString
()))
{
post
.
setIsTop
(
isTop
==
0
?
1
:
0
);
post
.
setIsTop
(
isTop
==
0
?
1
:
0
);
return
postDao
.
update
(
post
);
res
=
postDao
.
update
(
post
);
}
else
{
res
=
-
1
;
}
return
res
;
}
}
}
}
platform-admin/src/main/resources/com/platform/dao/PostDao.xml
浏览文件 @
3a216db4
...
@@ -174,4 +174,9 @@
...
@@ -174,4 +174,9 @@
#{id}
#{id}
</foreach>
</foreach>
</update>
</update>
<!--统计置顶帖子数量-->
<select
id=
"getPostTopNum"
resultType=
"int"
>
select count(1) from post where is_top=1 and archived=1
</select>
</mapper>
</mapper>
\ No newline at end of file
platform-admin/src/main/webapp/js/sys/post.js
浏览文件 @
3a216db4
...
@@ -211,7 +211,7 @@ let vm = new Vue({
...
@@ -211,7 +211,7 @@ let vm = new Vue({
if
(
!
vm
.
isShow
)
{
if
(
!
vm
.
isShow
)
{
vm
.
post
.
archived
=
2
;
vm
.
post
.
archived
=
2
;
}
else
{
}
else
{
vm
.
post
.
isShow
=
1
;
vm
.
post
.
archived
=
1
;
}
}
let
url
=
vm
.
post
.
id
==
null
?
"../post/save"
:
"../post/update"
;
let
url
=
vm
.
post
.
id
==
null
?
"../post/save"
:
"../post/update"
;
vm
.
post
.
picture
=
this
.
uploadList
.
map
(
res
=>
res
).
join
(
','
);
vm
.
post
.
picture
=
this
.
uploadList
.
map
(
res
=>
res
).
join
(
','
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论