留言板管理增加编辑功能

This commit is contained in:
joylink_zhangsai 2020-12-22 13:47:37 +08:00
parent 01b39f4129
commit 52d0218305
4 changed files with 44 additions and 12 deletions

View File

@ -5,10 +5,7 @@ import club.joylink.rtss.services.ILearnService;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostVO;
import club.joylink.rtss.vo.client.learn.*;
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
import club.joylink.rtss.vo.client.post.LearnMessageVO;
@ -49,6 +46,13 @@ public class LearnController {
return iLearnService.createPost(createVO, user);
}
@ApiOperation("编辑留言板基础信息")
@PutMapping("/{postId}")
public void updatePost(@PathVariable Long postId, @RequestBody @Validated LearnPostUpdateVO updateVO,
@RequestAttribute UserVO user) {
iLearnService.updatePost(postId, updateVO, user);
}
@ApiOperation(value = "获取帖子信息")
@GetMapping(path = "/{postId}")
public LearnPostVO getPostInfo(@PathVariable Long postId) {

View File

@ -4,10 +4,7 @@ import club.joylink.rtss.constants.Project;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostVO;
import club.joylink.rtss.vo.client.learn.*;
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
import club.joylink.rtss.vo.client.post.LearnMessageVO;
@ -124,6 +121,11 @@ public interface ILearnService {
*/
PageVO<LearnMessageVO> pagedQueryMessageByProject(Project project, LearnMessagePagedQueryVO queryVO);
/**
* 更新留言板
*/
void updatePost(Long postId, LearnPostUpdateVO updateVO, UserVO user);
// /**
// * 点赞留言
// */

View File

@ -14,10 +14,7 @@ import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.UserVO;
import club.joylink.rtss.vo.client.PageQueryVO;
import club.joylink.rtss.vo.client.PageVO;
import club.joylink.rtss.vo.client.learn.LearnCommentVO;
import club.joylink.rtss.vo.client.learn.LearnCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostCreateVO;
import club.joylink.rtss.vo.client.learn.LearnPostVO;
import club.joylink.rtss.vo.client.learn.*;
import club.joylink.rtss.vo.client.post.LearnMessageCreateVO;
import club.joylink.rtss.vo.client.post.LearnMessagePagedQueryVO;
import club.joylink.rtss.vo.client.post.LearnMessageVO;
@ -331,6 +328,16 @@ public class LearnService implements ILearnService {
return pagedQueryMessageByPostId(post.getId(), queryVO);
}
@Override
public void updatePost(Long postId, LearnPostUpdateVO updateVO, UserVO user) {
iSysUserService.confirmAdmin(user);
LearnPost entity = getPostEntity(postId);
if (Objects.equals(updateVO.getTitle(), entity.getTitle()))
return;
entity.setTitle(updateVO.getTitle());
learnPostDAO.updateByPrimaryKey(entity);
}
// @Override
// public Integer likeMessage(Long messageId) {
// LearnMessageWithBLOBs message = getMessage(messageId);

View File

@ -0,0 +1,19 @@
package club.joylink.rtss.vo.client.learn;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.validation.constraints.NotNull;
/**
* 留言板更新
*/
@Getter
@Setter
@NoArgsConstructor
public class LearnPostUpdateVO {
@NotNull(message = "留言板名称不能为空")
private String title;
}