Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
C
chinafrica
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
chinafrica
Commits
a1952163
提交
a1952163
authored
6月 29, 2020
作者:
吴德鹏
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
帖子管理代码提交
上级
fab8a6ae
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
113 行增加
和
21 行删除
+113
-21
PostController.java
...src/main/java/com/platform/controller/PostController.java
+18
-3
PostDao.java
platform-admin/src/main/java/com/platform/dao/PostDao.java
+4
-1
PostService.java
...admin/src/main/java/com/platform/service/PostService.java
+4
-1
PostServiceImpl.java
.../main/java/com/platform/service/impl/PostServiceImpl.java
+20
-4
PostDao.xml
...orm-admin/src/main/resources/com/platform/dao/PostDao.xml
+7
-3
complain.js
platform-admin/src/main/webapp/js/sys/complain.js
+3
-3
post.js
platform-admin/src/main/webapp/js/sys/post.js
+57
-6
没有找到文件。
platform-admin/src/main/java/com/platform/controller/PostController.java
浏览文件 @
a1952163
...
...
@@ -87,11 +87,12 @@ public class PostController {
/**
* 删除
*/
@RequestMapping
(
"/
delete
"
)
@RequestMapping
(
"/
changeStatus
"
)
@RequiresPermissions
(
"post:delete"
)
@ResponseBody
public
R
delete
(
@RequestBody
String
[]
ids
)
{
postService
.
deleteBatch
(
ids
);
public
R
changeStatus
(
@RequestParam
(
"archived"
)
Integer
archived
,
@RequestBody
String
[]
ids
)
{
postService
.
changeStatus
(
archived
,
ids
);
return
R
.
ok
();
}
...
...
@@ -107,4 +108,18 @@ public class PostController {
return
R
.
ok
().
put
(
"list"
,
list
);
}
/**
* 置顶 or 取消置顶
*/
@RequestMapping
(
"/placedPostTop/{id}"
)
@ResponseBody
public
R
placedPostTop
(
@PathVariable
(
"id"
)
String
id
)
{
postService
.
placedPostTop
(
id
);
return
R
.
ok
();
}
}
platform-admin/src/main/java/com/platform/dao/PostDao.java
浏览文件 @
a1952163
package
com
.
platform
.
dao
;
import
com.platform.entity.PostEntity
;
import
org.apache.ibatis.annotations.Param
;
/**
* Dao
...
...
@@ -10,5 +11,7 @@ import com.platform.entity.PostEntity;
*/
public
interface
PostDao
extends
BaseDao
<
PostEntity
>
{
int
changePostStatus
(
String
ids
[]);
int
changePostStatus
(
@Param
(
"archived"
)
Integer
archived
,
@Param
(
"ids"
)
String
ids
[]);
int
placedTop
(
Integer
id
,
Integer
isTop
);
}
platform-admin/src/main/java/com/platform/service/PostService.java
浏览文件 @
a1952163
...
...
@@ -2,6 +2,7 @@ package com.platform.service;
import
com.platform.entity.PostEntity
;
import
com.platform.vo.PostVo
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -68,5 +69,7 @@ public interface PostService {
* @param ids
* @return 删除条数
*/
int
deleteBatch
(
String
[]
ids
);
int
changeStatus
(
Integer
archived
,
String
[]
ids
);
int
placedPostTop
(
String
id
);
}
platform-admin/src/main/java/com/platform/service/impl/PostServiceImpl.java
浏览文件 @
a1952163
...
...
@@ -122,17 +122,33 @@ public class PostServiceImpl implements PostService {
@Override
public
int
delete
(
String
id
)
{
String
[]
ids
=
new
String
[]{
id
};
return
postDao
.
changePostStatus
(
ids
);
return
postDao
.
changePostStatus
(
0
,
ids
);
}
/**
*
逻辑删除
*
修改状态
*
* @param ids
* @return
*/
@Override
public
int
deleteBatch
(
String
[]
ids
)
{
return
postDao
.
changePostStatus
(
ids
);
public
int
changeStatus
(
Integer
archived
,
String
[]
ids
)
{
return
postDao
.
changePostStatus
(
archived
,
ids
);
}
/**
* 置顶 or 取消置顶
* 1)如果已置顶,则取消置顶
*
* @param id
* @return int
*/
@Override
public
int
placedPostTop
(
String
id
)
{
//根据ID查询帖子信息
PostEntity
post
=
postDao
.
queryObject
(
id
);
Integer
isTop
=
post
.
getIsTop
();
post
.
setIsTop
(
isTop
==
0
?
1
:
0
);
return
postDao
.
update
(
post
);
}
}
platform-admin/src/main/resources/com/platform/dao/PostDao.xml
浏览文件 @
a1952163
...
...
@@ -42,6 +42,10 @@
where id = #{id}
</select>
<update
id=
"placedTop"
parameterType=
"com.platform.entity.PostEntity"
>
update post set is_top=#{isTop} where id=#{id}
</update>
<select
id=
"queryList"
resultType=
"com.platform.vo.PostVo"
>
SELECT
p.*,
...
...
@@ -72,7 +76,7 @@
order by ${sidx} ${order}
</when>
<otherwise>
order by
createD
ate desc
order by
is_top desc ,create_d
ate desc
</otherwise>
</choose>
<if
test=
"offset != null and limit != null"
>
...
...
@@ -165,8 +169,8 @@
</delete>
<update
id=
"changePostStatus"
>
update post set archived=
0
where id in
<foreach
item=
"id"
collection=
"
array
"
open=
"("
separator=
","
close=
")"
>
update post set archived=
#{archived}
where id in
<foreach
item=
"id"
collection=
"
ids
"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</update>
...
...
platform-admin/src/main/webapp/js/sys/complain.js
浏览文件 @
a1952163
...
...
@@ -35,9 +35,9 @@ $(function () {
{
label
:
'创建时间'
,
name
:
'createDate'
,
index
:
'create_date'
,
width
:
80
},
{
label
:
'操作'
,
index
:
'operate'
,
width
:
80
,
formatter
:
function
(
value
,
grid
,
rows
)
{
return
'<span class="label label-info pointer" onclick="vm.audit(
'
+
rows
.
id
+
')">审核</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
'
+
rows
.
id
+
')" ">下线</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
'
+
rows
.
id
+
')" ">激活</span>'
;
return
'<span class="label label-info pointer" onclick="vm.audit(
\'
'
+
rows
.
id
+
'
\
'
)">审核</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\
'
)" ">下线</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
\'
'
+
rows
.
id
+
'
\
'
)" ">激活</span>'
;
}
}]
});
...
...
platform-admin/src/main/webapp/js/sys/post.js
浏览文件 @
a1952163
...
...
@@ -3,6 +3,7 @@ $(function () {
url
:
'../post/list'
,
colModel
:
[
{
label
:
'id'
,
name
:
'id'
,
index
:
'id'
,
key
:
true
,
hidden
:
true
},
{
label
:
'isTop'
,
name
:
'isTop'
,
index
:
'isTop'
,
hidden
:
true
},
{
label
:
'标题'
,
name
:
'caption'
,
index
:
'caption'
,
width
:
80
},
{
label
:
'用户ID'
,
name
:
'userId'
,
index
:
'user_id'
,
width
:
80
},
{
label
:
'评论数量'
,
name
:
'count'
,
index
:
'count'
,
width
:
80
},
...
...
@@ -20,7 +21,14 @@ $(function () {
{
label
:
'作者'
,
name
:
'createdBy'
,
index
:
'created_by'
,
width
:
80
},
{
label
:
'操作'
,
index
:
'operate'
,
width
:
80
,
formatter
:
function
(
value
,
grid
,
rows
)
{
return
'<span class="label label-info pointer" onclick="vm.placedTop('
+
rows
.
id
+
')">置顶</span>'
;
if
(
rows
.
isTop
===
1
)
{
return
'<span class="label label-danger pointer" onclick="vm.placedTop(
\'
'
+
rows
.
id
+
'
\'
)">置顶</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\'
)" ">下线</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
\'
'
+
rows
.
id
+
'
\'
)" ">激活</span>'
;
}
return
'<span class="label label-info pointer" onclick="vm.placedTop(
\'
'
+
rows
.
id
+
'
\'
)">置顶</span> '
+
'<span class="label label-warning pointer" onclick="vm.off(
\'
'
+
rows
.
id
+
'
\'
)" ">下线</span> '
+
'<span class="label label-success pointer" onclick="vm.activate(
\'
'
+
rows
.
id
+
'
\'
)" ">激活</span>'
;
}
}
]
...
...
@@ -61,6 +69,50 @@ let vm = new Vue({
}
},
methods
:
{
placedTop
:
function
(
id
)
{
let
url
=
'../post/placedPostTop/'
+
id
;
Ajax
.
request
({
url
:
url
,
type
:
"GET"
,
contentType
:
"application/json"
,
successCallback
:
function
()
{
alert
(
'操作成功'
,
function
(
index
)
{
vm
.
reload
();
});
}
});
},
off
:
function
(
id
)
{
let
ids
=
[
id
];
let
url
=
'../post/changeStatus?archived=2'
;
Ajax
.
request
({
url
:
url
,
type
:
"POST"
,
params
:
JSON
.
stringify
(
ids
),
contentType
:
"application/json"
,
successCallback
:
function
()
{
alert
(
'操作成功'
,
function
(
index
)
{
vm
.
reload
();
});
}
});
},
activate
:
function
(
id
)
{
let
ids
=
[
id
];
let
url
=
'../post/changeStatus?archived=1'
;
Ajax
.
request
({
url
:
url
,
type
:
"POST"
,
params
:
JSON
.
stringify
(
ids
),
contentType
:
"application/json"
,
successCallback
:
function
()
{
alert
(
'操作成功'
,
function
(
index
)
{
vm
.
reload
();
});
}
});
},
changeType
:
function
()
{
let
type
=
this
.
post
.
userType
;
if
(
type
===
0
)
{
...
...
@@ -103,9 +155,7 @@ let vm = new Vue({
// 限制上传文件的宽高
// return this.checkImageWH(file,750,320);
},
placedTop
:
function
()
{
},
handleSuccess
(
response
,
file
,
fileList
)
{
// "http://diaosaas-prod.oss-cn-shenzhen.aliyuncs.com/education/155728894307110106.jpg"
vm
.
uploadList
.
push
(
response
);
...
...
@@ -190,7 +240,7 @@ let vm = new Vue({
confirm
(
'确定要删除选中的记录?'
,
function
()
{
Ajax
.
request
({
url
:
"../post/
delete
"
,
url
:
"../post/
changeStatus?archived=0
"
,
params
:
JSON
.
stringify
(
ids
),
type
:
"POST"
,
contentType
:
"application/json"
,
...
...
@@ -204,15 +254,16 @@ let vm = new Vue({
}
,
getInfo
:
function
(
id
)
{
console
.
log
(
id
);
Ajax
.
request
({
url
:
"../post/info/"
+
id
,
async
:
true
,
successCallback
:
function
(
r
)
{
vm
.
disabled
=
true
//
vm.disabled = true
vm
.
post
=
r
.
post
;
vm
.
isShow
=
false
;
vm
.
uploadList
=
[];
let
status
=
vm
.
post
.
archived
let
status
=
vm
.
post
.
archived
;
//正常
if
(
status
===
1
)
{
vm
.
isShow
=
true
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论