运维社区运维论坛评论帖子功能

This commit is contained in:
zhangjunwen 2024-05-07 16:14:13 +08:00
parent 515a41fb3e
commit fb0c710d5a
36 changed files with 3135 additions and 457 deletions

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.community;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.community.domain.CommunityPostHeat;
import com.inspur.community.service.ICommunityPostHeatService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 社区帖子热度Controller
*
* @author inspur
* @date 2024-04-30
*/
@RestController
@RequestMapping("/community/heat")
public class CommunityPostHeatController extends BaseController
{
@Autowired
private ICommunityPostHeatService communityPostHeatService;
/**
* 查询社区帖子热度列表
*/
@PreAuthorize("@ss.hasPermi('community:heat:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityPostHeat communityPostHeat)
{
startPage();
List<CommunityPostHeat> list = communityPostHeatService.selectCommunityPostHeatList(communityPostHeat);
return getDataTable(list);
}
/**
* 导出社区帖子热度列表
*/
@PreAuthorize("@ss.hasPermi('community:heat:export')")
@Log(title = "社区帖子热度", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CommunityPostHeat communityPostHeat)
{
List<CommunityPostHeat> list = communityPostHeatService.selectCommunityPostHeatList(communityPostHeat);
ExcelUtil<CommunityPostHeat> util = new ExcelUtil<CommunityPostHeat>(CommunityPostHeat.class);
util.exportExcel(response, list, "社区帖子热度数据");
}
/**
* 获取社区帖子热度详细信息
*/
@PreAuthorize("@ss.hasPermi('community:heat:query')")
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable("postId") String postId)
{
return success(communityPostHeatService.selectCommunityPostHeatByPostId(postId));
}
/**
* 新增社区帖子热度
*/
@PreAuthorize("@ss.hasPermi('community:heat:add')")
@Log(title = "社区帖子热度", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CommunityPostHeat communityPostHeat)
{
return toAjax(communityPostHeatService.insertCommunityPostHeat(communityPostHeat));
}
/**
* 修改社区帖子热度
*/
@PreAuthorize("@ss.hasPermi('community:heat:edit')")
@Log(title = "社区帖子热度", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CommunityPostHeat communityPostHeat)
{
return toAjax(communityPostHeatService.updateCommunityPostHeat(communityPostHeat));
}
/**
* 删除社区帖子热度
*/
@PreAuthorize("@ss.hasPermi('community:heat:remove')")
@Log(title = "社区帖子热度", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable String[] postIds)
{
return toAjax(communityPostHeatService.deleteCommunityPostHeatByPostIds(postIds));
}
}

View File

@ -0,0 +1,115 @@
package com.inspur.web.controller.community;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.inspur.common.utils.SecurityUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.community.domain.CommunityPostLike;
import com.inspur.community.service.ICommunityPostLikeService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 社区点赞信息Controller
*
* @author inspur
* @date 2024-04-30
*/
@RestController
@RequestMapping("/community/like")
public class CommunityPostLikeController extends BaseController
{
@Autowired
private ICommunityPostLikeService communityPostLikeService;
/**
* 查询社区点赞信息列表
*/
@PreAuthorize("@ss.hasPermi('community:like:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityPostLike communityPostLike)
{
startPage();
List<CommunityPostLike> list = communityPostLikeService.selectCommunityPostLikeList(communityPostLike);
return getDataTable(list);
}
/**
* 导出社区点赞信息列表
*/
@PreAuthorize("@ss.hasPermi('community:like:export')")
@Log(title = "社区点赞信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CommunityPostLike communityPostLike)
{
List<CommunityPostLike> list = communityPostLikeService.selectCommunityPostLikeList(communityPostLike);
ExcelUtil<CommunityPostLike> util = new ExcelUtil<CommunityPostLike>(CommunityPostLike.class);
util.exportExcel(response, list, "社区点赞信息数据");
}
/**
* 获取社区点赞信息详细信息
*/
@PreAuthorize("@ss.hasPermi('community:like:query')")
@GetMapping(value = "/{userId}")
public AjaxResult getInfo(@PathVariable("userId") Long userId)
{
return success(communityPostLikeService.selectCommunityPostLikeByUserId(userId));
}
/**
* 新增社区点赞信息
*/
@PreAuthorize("@ss.hasPermi('community:like:add')")
@Log(title = "社区点赞信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CommunityPostLike communityPostLike)
{
return toAjax(communityPostLikeService.insertCommunityPostLike(communityPostLike));
}
/**
* 修改社区点赞信息
*/
@PreAuthorize("@ss.hasPermi('community:like:edit')")
@Log(title = "社区点赞信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CommunityPostLike communityPostLike)
{
return toAjax(communityPostLikeService.updateCommunityPostLike(communityPostLike));
}
/**
* 删除点赞信息
*/
// @PreAuthorize("@ss.hasPermi('community:like:remove')")
// @Log(title = "社区点赞信息", businessType = BusinessType.DELETE)
// @DeleteMapping("/{userIds}")
// public AjaxResult remove(@PathVariable Long[] userIds)
// {
// return toAjax(communityPostLikeService.deleteCommunityPostLikeByUserIds(userIds));
// }
@PreAuthorize("@ss.hasPermi('community:like:remove')")
@Log(title = "社区点赞信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{likePostId}")
public AjaxResult remove(@PathVariable String likePostId)
{
return toAjax(communityPostLikeService.deleteCommunityPostLikeByUserIdandPostId(SecurityUtils.getLoginUser().getUserId(), likePostId));
}
}

View File

@ -0,0 +1,118 @@
package com.inspur.web.controller.community;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.inspur.community.domain.CommunityComment;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.service.ICommunityPostReplyService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 社区帖子回复Controller
*
* @author inspur
* @date 2024-04-30
*/
@RestController
@RequestMapping("/community/reply")
public class CommunityPostReplyController extends BaseController
{
@Autowired
private ICommunityPostReplyService communityPostReplyService;
/**
* 查询社区帖子回复列表
*/
@PreAuthorize("@ss.hasPermi('community:reply:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityPostReply communityPostReply)
{
startPage();
List<CommunityComment> list = communityPostReplyService.selectCommunityPostReplyList(communityPostReply);
return getDataTable(list);
}
// /**
// * 导出社区帖子回复列表
// */
// @PreAuthorize("@ss.hasPermi('community:reply:export')")
// @Log(title = "社区帖子回复", businessType = BusinessType.EXPORT)
// @PostMapping("/export")
// public void export(HttpServletResponse response, CommunityPostReply communityPostReply)
// {
// List<CommunityPostReply> list = communityPostReplyService.selectCommunityPostReplyList(communityPostReply);
// ExcelUtil<CommunityPostReply> util = new ExcelUtil<CommunityPostReply>(CommunityPostReply.class);
// util.exportExcel(response, list, "社区帖子回复数据");
// }
/**
* 获取社区帖子回复详细信息
*/
@PreAuthorize("@ss.hasPermi('community:reply:query')")
@GetMapping(value = "/{replyId}")
public AjaxResult getInfo(@PathVariable("replyId") String replyId)
{
return success(communityPostReplyService.selectCommunityPostReplyByReplyId(replyId));
}
/**
* 新增社区帖子回复
*/
@PreAuthorize("@ss.hasPermi('community:reply:add')")
@Log(title = "社区帖子回复", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CommunityPostReply communityPostReply)
{
if(communityPostReply.getParentReplyId() == null){
communityPostReply.setParentReplyId("0");
}else{
CommunityPostReply reply = communityPostReplyService.selectCommunityPostReplyByReplyId(communityPostReply.getParentReplyId());
if(reply.getRootReplyId() != null) {
communityPostReply.setRootReplyId(reply.getRootReplyId());
}else{
communityPostReply.setRootReplyId(reply.getReplyId());
}
}
return toAjax(communityPostReplyService.insertCommunityPostReply(communityPostReply));
}
/**
* 修改社区帖子回复
*/
@PreAuthorize("@ss.hasPermi('community:reply:edit')")
@Log(title = "社区帖子回复", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CommunityPostReply communityPostReply)
{
return toAjax(communityPostReplyService.updateCommunityPostReply(communityPostReply));
}
/**
* 删除社区帖子回复
*/
@PreAuthorize("@ss.hasPermi('community:reply:remove')")
@Log(title = "社区帖子回复", businessType = BusinessType.DELETE)
@DeleteMapping("/{replyIds}")
public AjaxResult remove(@PathVariable String[] replyIds)
{
return toAjax(communityPostReplyService.deleteCommunityPostReplyByReplyIds(replyIds));
}
}

View File

@ -0,0 +1,105 @@
package com.inspur.web.controller.community;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.inspur.common.annotation.Log;
import com.inspur.common.core.controller.BaseController;
import com.inspur.common.core.domain.AjaxResult;
import com.inspur.common.enums.BusinessType;
import com.inspur.community.domain.CommunityPostReport;
import com.inspur.community.service.ICommunityPostReportService;
import com.inspur.common.utils.poi.ExcelUtil;
import com.inspur.common.core.page.TableDataInfo;
/**
* 社区帖子举报Controller
*
* @author inspur
* @date 2024-04-30
*/
@RestController
@RequestMapping("/community/report")
public class CommunityPostReportController extends BaseController
{
@Autowired
private ICommunityPostReportService communityPostReportService;
/**
* 查询社区帖子举报列表
*/
@PreAuthorize("@ss.hasPermi('community:report:list')")
@GetMapping("/list")
public TableDataInfo list(CommunityPostReport communityPostReport)
{
startPage();
List<CommunityPostReport> list = communityPostReportService.selectCommunityPostReportList(communityPostReport);
return getDataTable(list);
}
/**
* 导出社区帖子举报列表
*/
@PreAuthorize("@ss.hasPermi('community:report:export')")
@Log(title = "社区帖子举报", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CommunityPostReport communityPostReport)
{
List<CommunityPostReport> list = communityPostReportService.selectCommunityPostReportList(communityPostReport);
ExcelUtil<CommunityPostReport> util = new ExcelUtil<CommunityPostReport>(CommunityPostReport.class);
util.exportExcel(response, list, "社区帖子举报数据");
}
/**
* 获取社区帖子举报详细信息
*/
@PreAuthorize("@ss.hasPermi('community:report:query')")
@GetMapping(value = "/{reportId}")
public AjaxResult getInfo(@PathVariable("reportId") String reportId)
{
return success(communityPostReportService.selectCommunityPostReportByReportId(reportId));
}
/**
* 新增社区帖子举报
*/
@PreAuthorize("@ss.hasPermi('community:report:add')")
@Log(title = "社区帖子举报", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CommunityPostReport communityPostReport)
{
return toAjax(communityPostReportService.insertCommunityPostReport(communityPostReport));
}
/**
* 修改社区帖子举报
*/
@PreAuthorize("@ss.hasPermi('community:report:edit')")
@Log(title = "社区帖子举报", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CommunityPostReport communityPostReport)
{
return toAjax(communityPostReportService.updateCommunityPostReport(communityPostReport));
}
/**
* 删除社区帖子举报
*/
@PreAuthorize("@ss.hasPermi('community:report:remove')")
@Log(title = "社区帖子举报", businessType = BusinessType.DELETE)
@DeleteMapping("/{reportIds}")
public AjaxResult remove(@PathVariable String[] reportIds)
{
return toAjax(communityPostReportService.deleteCommunityPostReportByReportIds(reportIds));
}
}

View File

@ -0,0 +1,174 @@
package com.inspur.community.domain;
import com.inspur.common.annotation.Excel;
import java.util.List;
/**
* @Author zhangjunwen
* @create 2024/5/6
*/
public class CommunityComment {
private static final long serialVersionUID = 1L;
/** 主键 */
private String replyId;
/** 帖子id */
@Excel(name = "帖子id")
private String postId;
private Long userId;
/** 回复用户名称 */
@Excel(name = "回复用户名称")
private String userName;
/** 回复内容 */
@Excel(name = "回复内容")
private String replyContent;
/** 回复时间 */
@Excel(name = "回复时间")
private String replyTime;
/** 父级回复id */
@Excel(name = "父级回复id")
private String parentReplyId;
/** 根回复id */
@Excel(name = "根回复id")
private String rootReplyId;
/** 状态0 正常1 封禁2 删除 */
@Excel(name = "状态0 正常1 封禁2 删除")
private String status;
/** 点赞数量 */
@Excel(name = "点赞数量")
private Long likeNum;
/** 头像 */
private String avatar;
/** 回复 */
private List<CommunityComment> children;
/** 点赞 */
private boolean isLike;
private String parentReplyUserName;
public String getReplyId() {
return replyId;
}
public void setReplyId(String replyId) {
this.replyId = replyId;
}
public String getPostId() {
return postId;
}
public void setPostId(String postId) {
this.postId = postId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getReplyContent() {
return replyContent;
}
public void setReplyContent(String replyContent) {
this.replyContent = replyContent;
}
public String getReplyTime() {
return replyTime;
}
public void setReplyTime(String replyTime) {
this.replyTime = replyTime;
}
public String getParentReplyId() {
return parentReplyId;
}
public void setParentReplyId(String parentReplyId) {
this.parentReplyId = parentReplyId;
}
public String getRootReplyId() {
return rootReplyId;
}
public void setRootReplyId(String rootReplyId) {
this.rootReplyId = rootReplyId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getLikeNum() {
return likeNum;
}
public void setLikeNum(Long likeNum) {
this.likeNum = likeNum;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public List<CommunityComment> getChildren() {
return children;
}
public void setChildren(List<CommunityComment> children) {
this.children = children;
}
public boolean getIsLike() {
return isLike;
}
public void setLike(boolean like) {
this.isLike = like;
}
public String getParentReplyUserName() {
return parentReplyUserName;
}
public void setParentReplyUserName(String parentReplyUserName) {
this.parentReplyUserName = parentReplyUserName;
}
}

View File

@ -0,0 +1,80 @@
package com.inspur.community.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 社区帖子热度对象 community_post_heat
*
* @author inspur
* @date 2024-04-30
*/
public class CommunityPostHeat extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 帖子id */
@Excel(name = "帖子id")
private String postId;
/** 点赞数 */
@Excel(name = "点赞数")
private Integer likes;
/** 浏览数 */
@Excel(name = "浏览数")
private Integer views;
/** 回复数 */
@Excel(name = "回复数")
private Integer replies;
public void setPostId(String postId)
{
this.postId = postId;
}
public String getPostId()
{
return postId;
}
public void setLikes(Integer likes)
{
this.likes = likes;
}
public Integer getLikes()
{
return likes;
}
public void setViews(Integer views)
{
this.views = views;
}
public Integer getViews()
{
return views;
}
public void setReplies(Integer replies)
{
this.replies = replies;
}
public Integer getReplies()
{
return replies;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("postId", getPostId())
.append("likes", getLikes())
.append("views", getViews())
.append("replies", getReplies())
.toString();
}
}

View File

@ -0,0 +1,69 @@
package com.inspur.community.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 社区点赞信息对象 community_post_like
*
* @author inspur
* @date 2024-04-30
*/
public class CommunityPostLike extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户id */
private Long userId;
/** 点赞帖子id */
private String likePostId;
/** 点赞时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "点赞时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date likeTime;
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setLikePostId(String likePostId)
{
this.likePostId = likePostId;
}
public String getLikePostId()
{
return likePostId;
}
public void setLikeTime(Date likeTime)
{
this.likeTime = likeTime;
}
public Date getLikeTime()
{
return likeTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("userId", getUserId())
.append("likePostId", getLikePostId())
.append("likeTime", getLikeTime())
.toString();
}
}

View File

@ -0,0 +1,136 @@
package com.inspur.community.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 社区帖子回复对象 community_post_reply
*
* @author zhangjunwen
* @date 2024-04-30
*/
public class CommunityPostReply extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String replyId;
/** 帖子id */
@Excel(name = "帖子id")
private String postId;
/** 回复用户id */
@Excel(name = "回复用户id")
private Long userId;
/** 回复内容 */
@Excel(name = "回复内容")
private String replyContent;
/** 回复时间 */
@Excel(name = "回复时间")
private String replyTime;
/** 父级回复id */
@Excel(name = "父级回复id")
private String parentReplyId;
/** 根回复id */
@Excel(name = "根回复id")
private String rootReplyId;
/** 状态0 正常1 封禁2 删除 */
@Excel(name = "状态0 正常1 封禁2 删除")
private String status;
public void setReplyId(String replyId)
{
this.replyId = replyId;
}
public String getReplyId()
{
return replyId;
}
public void setPostId(String postId)
{
this.postId = postId;
}
public String getPostId()
{
return postId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setReplyContent(String replyContent)
{
this.replyContent = replyContent;
}
public String getReplyContent()
{
return replyContent;
}
public void setReplyTime(String replyTime)
{
this.replyTime = replyTime;
}
public String getReplyTime()
{
return replyTime;
}
public void setParentReplyId(String parentReplyId)
{
this.parentReplyId = parentReplyId;
}
public String getParentReplyId()
{
return parentReplyId;
}
public void setRootReplyId(String rootReplyId)
{
this.rootReplyId = rootReplyId;
}
public String getRootReplyId()
{
return rootReplyId;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("replyId", getReplyId())
.append("postId", getPostId())
.append("userId", getUserId())
.append("replyContent", getReplyContent())
.append("replyTime", getReplyTime())
.append("parentReplyId", getParentReplyId())
.append("rootReplyId", getRootReplyId())
.append("status", getStatus())
.toString();
}
}

View File

@ -0,0 +1,136 @@
package com.inspur.community.domain;
import com.inspur.common.annotation.Excel;
import com.inspur.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 社区帖子举报对象 community_post_report
*
* @author inspur
* @date 2024-04-30
*/
public class CommunityPostReport extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 举报id */
private String reportId;
/** 举报用户id */
@Excel(name = "举报用户id")
private Long reportUserId;
/** 被举报内容id */
@Excel(name = "被举报内容id")
private String reportContentId;
/** 举报时间 */
@Excel(name = "举报时间")
private String reportTime;
/** 举报原因 */
@Excel(name = "举报原因")
private String reportReason;
/** 状态0 未处理1 已处理 */
@Excel(name = "状态0 未处理1 已处理")
private String status;
/** 举报类型0 帖子1 回复 */
@Excel(name = "举报类型0 帖子1 回复")
private String reportType;
/** 处理结果 */
@Excel(name = "处理结果")
private String result;
public void setReportId(String reportId)
{
this.reportId = reportId;
}
public String getReportId()
{
return reportId;
}
public void setReportUserId(Long reportUserId)
{
this.reportUserId = reportUserId;
}
public Long getReportUserId()
{
return reportUserId;
}
public void setReportContentId(String reportContentId)
{
this.reportContentId = reportContentId;
}
public String getReportContentId()
{
return reportContentId;
}
public void setReportTime(String reportTime)
{
this.reportTime = reportTime;
}
public String getReportTime()
{
return reportTime;
}
public void setReportReason(String reportReason)
{
this.reportReason = reportReason;
}
public String getReportReason()
{
return reportReason;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setReportType(String reportType)
{
this.reportType = reportType;
}
public String getReportType()
{
return reportType;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
{
return result;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("reportId", getReportId())
.append("reportUserId", getReportUserId())
.append("reportContentId", getReportContentId())
.append("reportTime", getReportTime())
.append("reportReason", getReportReason())
.append("status", getStatus())
.append("reportType", getReportType())
.append("result", getResult())
.toString();
}
}

View File

@ -0,0 +1,71 @@
package com.inspur.community.mapper;
import java.util.List;
import com.inspur.community.domain.CommunityPostHeat;
/**
* 社区帖子热度Mapper接口
*
* @author inspur
* @date 2024-04-30
*/
public interface CommunityPostHeatMapper
{
/**
* 查询社区帖子热度
*
* @param postId 社区帖子热度主键
* @return 社区帖子热度
*/
public CommunityPostHeat selectCommunityPostHeatByPostId(String postId);
/**
* 查询社区帖子热度列表
*
* @param communityPostHeat 社区帖子热度
* @return 社区帖子热度集合
*/
public List<CommunityPostHeat> selectCommunityPostHeatList(CommunityPostHeat communityPostHeat);
/**
* 新增社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat);
/**
* 修改社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat);
/**
* 浏览量加一
*/
public int addViews(String postId);
/**
* 回复量加一
*/
public int addReplies(String postId);
/**
* 删除社区帖子热度
*
* @param postId 社区帖子热度主键
* @return 结果
*/
public int deleteCommunityPostHeatByPostId(String postId);
/**
* 批量删除社区帖子热度
*
* @param postIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommunityPostHeatByPostIds(String[] postIds);
}

View File

@ -0,0 +1,69 @@
package com.inspur.community.mapper;
import java.util.List;
import com.inspur.community.domain.CommunityPostLike;
import org.apache.ibatis.annotations.Param;
/**
* 社区点赞信息Mapper接口
*
* @author inspur
* @date 2024-04-30
*/
public interface CommunityPostLikeMapper
{
/**
* 查询社区点赞信息
*
* @param userId 社区点赞信息主键
* @return 社区点赞信息
*/
public CommunityPostLike selectCommunityPostLikeByUserId(Long userId);
/**
* 查询社区点赞信息列表
*
* @param communityPostLike 社区点赞信息
* @return 社区点赞信息集合
*/
public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike);
/**
* 根据postid统计点赞数
*/
public long countCommunityPostLikeByLikePostId(String likePostId);
/**
* 新增社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
public int insertCommunityPostLike(CommunityPostLike communityPostLike);
/**
* 修改社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
public int updateCommunityPostLike(CommunityPostLike communityPostLike);
/**
* 删除社区点赞信息
*
* @param userId 社区点赞信息主键
* @return 结果
*/
public int deleteCommunityPostLikeByUserIdandPostId(@Param("userId")Long userId,
@Param("likePostId")String likePostId);
/**
* 批量删除社区点赞信息
*
* @param userIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommunityPostLikeByUserIds(Long[] userIds);
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.mapper;
import java.util.List;
import com.inspur.community.domain.CommunityPostReply;
/**
* 社区帖子回复Mapper接口
*
* @author zhangjunwen
* @date 2024-04-30
*/
public interface CommunityPostReplyMapper
{
/**
* 查询社区帖子回复
*
* @param replyId 社区帖子回复主键
* @return 社区帖子回复
*/
public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId);
/**
* 查询社区帖子回复列表
*
* @param communityPostReply 社区帖子回复
* @return 社区帖子回复集合
*/
public List<CommunityPostReply> selectCommunityPostReplyList(CommunityPostReply communityPostReply);
/**
* 新增社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
public int insertCommunityPostReply(CommunityPostReply communityPostReply);
/**
* 修改社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
public int updateCommunityPostReply(CommunityPostReply communityPostReply);
/**
* 删除社区帖子回复
*
* @param replyId 社区帖子回复主键
* @return 结果
*/
public int deleteCommunityPostReplyByReplyId(String replyId);
/**
* 批量删除社区帖子回复
*
* @param replyIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommunityPostReplyByReplyIds(String[] replyIds);
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.mapper;
import java.util.List;
import com.inspur.community.domain.CommunityPostReport;
/**
* 社区帖子举报Mapper接口
*
* @author inspur
* @date 2024-04-30
*/
public interface CommunityPostReportMapper
{
/**
* 查询社区帖子举报
*
* @param reportId 社区帖子举报主键
* @return 社区帖子举报
*/
public CommunityPostReport selectCommunityPostReportByReportId(String reportId);
/**
* 查询社区帖子举报列表
*
* @param communityPostReport 社区帖子举报
* @return 社区帖子举报集合
*/
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport);
/**
* 新增社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
public int insertCommunityPostReport(CommunityPostReport communityPostReport);
/**
* 修改社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
public int updateCommunityPostReport(CommunityPostReport communityPostReport);
/**
* 删除社区帖子举报
*
* @param reportId 社区帖子举报主键
* @return 结果
*/
public int deleteCommunityPostReportByReportId(String reportId);
/**
* 批量删除社区帖子举报
*
* @param reportIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteCommunityPostReportByReportIds(String[] reportIds);
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.service;
import java.util.List;
import com.inspur.community.domain.CommunityPostHeat;
/**
* 社区帖子热度Service接口
*
* @author inspur
* @date 2024-04-30
*/
public interface ICommunityPostHeatService
{
/**
* 查询社区帖子热度
*
* @param postId 社区帖子热度主键
* @return 社区帖子热度
*/
public CommunityPostHeat selectCommunityPostHeatByPostId(String postId);
/**
* 查询社区帖子热度列表
*
* @param communityPostHeat 社区帖子热度
* @return 社区帖子热度集合
*/
public List<CommunityPostHeat> selectCommunityPostHeatList(CommunityPostHeat communityPostHeat);
/**
* 新增社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat);
/**
* 修改社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat);
/**
* 批量删除社区帖子热度
*
* @param postIds 需要删除的社区帖子热度主键集合
* @return 结果
*/
public int deleteCommunityPostHeatByPostIds(String[] postIds);
/**
* 删除社区帖子热度信息
*
* @param postId 社区帖子热度主键
* @return 结果
*/
public int deleteCommunityPostHeatByPostId(String postId);
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.service;
import java.util.List;
import com.inspur.community.domain.CommunityPostLike;
/**
* 社区点赞信息Service接口
*
* @author inspur
* @date 2024-04-30
*/
public interface ICommunityPostLikeService
{
/**
* 查询社区点赞信息
*
* @param userId 社区点赞信息主键
* @return 社区点赞信息
*/
public CommunityPostLike selectCommunityPostLikeByUserId(Long userId);
/**
* 查询社区点赞信息列表
*
* @param communityPostLike 社区点赞信息
* @return 社区点赞信息集合
*/
public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike);
/**
* 新增社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
public int insertCommunityPostLike(CommunityPostLike communityPostLike);
/**
* 修改社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
public int updateCommunityPostLike(CommunityPostLike communityPostLike);
/**
* 批量删除社区点赞信息
*
* @param userIds 需要删除的社区点赞信息主键集合
* @return 结果
*/
public int deleteCommunityPostLikeByUserIds(Long[] userIds);
/**
* 删除社区点赞信息信息
*
* @param userId 社区点赞信息主键
* @return 结果
*/
public int deleteCommunityPostLikeByUserIdandPostId(Long userId,String likePostId);
}

View File

@ -0,0 +1,63 @@
package com.inspur.community.service;
import java.util.List;
import com.inspur.community.domain.CommunityComment;
import com.inspur.community.domain.CommunityPostReply;
/**
* 社区帖子回复Service接口
*
* @author inspur
* @date 2024-04-30
*/
public interface ICommunityPostReplyService
{
/**
* 查询社区帖子回复
*
* @param replyId 社区帖子回复主键
* @return 社区帖子回复
*/
public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId);
/**
* 查询社区帖子回复列表
*
* @param communityPostReply 社区帖子回复
* @return 社区帖子回复集合
*/
public List<CommunityComment> selectCommunityPostReplyList(CommunityPostReply communityPostReply);
/**
* 新增社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
public int insertCommunityPostReply(CommunityPostReply communityPostReply);
/**
* 修改社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
public int updateCommunityPostReply(CommunityPostReply communityPostReply);
/**
* 批量删除社区帖子回复
*
* @param replyIds 需要删除的社区帖子回复主键集合
* @return 结果
*/
public int deleteCommunityPostReplyByReplyIds(String[] replyIds);
/**
* 删除社区帖子回复信息
*
* @param replyId 社区帖子回复主键
* @return 结果
*/
public int deleteCommunityPostReplyByReplyId(String replyId);
}

View File

@ -0,0 +1,62 @@
package com.inspur.community.service;
import java.util.List;
import com.inspur.community.domain.CommunityPostReport;
/**
* 社区帖子举报Service接口
*
* @author inspur
* @date 2024-04-30
*/
public interface ICommunityPostReportService
{
/**
* 查询社区帖子举报
*
* @param reportId 社区帖子举报主键
* @return 社区帖子举报
*/
public CommunityPostReport selectCommunityPostReportByReportId(String reportId);
/**
* 查询社区帖子举报列表
*
* @param communityPostReport 社区帖子举报
* @return 社区帖子举报集合
*/
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport);
/**
* 新增社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
public int insertCommunityPostReport(CommunityPostReport communityPostReport);
/**
* 修改社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
public int updateCommunityPostReport(CommunityPostReport communityPostReport);
/**
* 批量删除社区帖子举报
*
* @param reportIds 需要删除的社区帖子举报主键集合
* @return 结果
*/
public int deleteCommunityPostReportByReportIds(String[] reportIds);
/**
* 删除社区帖子举报信息
*
* @param reportId 社区帖子举报主键
* @return 结果
*/
public int deleteCommunityPostReportByReportId(String reportId);
}

View File

@ -0,0 +1,94 @@
package com.inspur.community.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostHeatMapper;
import com.inspur.community.domain.CommunityPostHeat;
import com.inspur.community.service.ICommunityPostHeatService;
/**
* 社区帖子热度Service业务层处理
*
* @author inspur
* @date 2024-04-30
*/
@Service
public class CommunityPostHeatServiceImpl implements ICommunityPostHeatService
{
@Autowired
private CommunityPostHeatMapper communityPostHeatMapper;
/**
* 查询社区帖子热度
*
* @param postId 社区帖子热度主键
* @return 社区帖子热度
*/
@Override
public CommunityPostHeat selectCommunityPostHeatByPostId(String postId)
{
return communityPostHeatMapper.selectCommunityPostHeatByPostId(postId);
}
/**
* 查询社区帖子热度列表
*
* @param communityPostHeat 社区帖子热度
* @return 社区帖子热度
*/
@Override
public List<CommunityPostHeat> selectCommunityPostHeatList(CommunityPostHeat communityPostHeat)
{
return communityPostHeatMapper.selectCommunityPostHeatList(communityPostHeat);
}
/**
* 新增社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
@Override
public int insertCommunityPostHeat(CommunityPostHeat communityPostHeat)
{
return communityPostHeatMapper.insertCommunityPostHeat(communityPostHeat);
}
/**
* 修改社区帖子热度
*
* @param communityPostHeat 社区帖子热度
* @return 结果
*/
@Override
public int updateCommunityPostHeat(CommunityPostHeat communityPostHeat)
{
return communityPostHeatMapper.updateCommunityPostHeat(communityPostHeat);
}
/**
* 批量删除社区帖子热度
*
* @param postIds 需要删除的社区帖子热度主键
* @return 结果
*/
@Override
public int deleteCommunityPostHeatByPostIds(String[] postIds)
{
return communityPostHeatMapper.deleteCommunityPostHeatByPostIds(postIds);
}
/**
* 删除社区帖子热度信息
*
* @param postId 社区帖子热度主键
* @return 结果
*/
@Override
public int deleteCommunityPostHeatByPostId(String postId)
{
return communityPostHeatMapper.deleteCommunityPostHeatByPostId(postId);
}
}

View File

@ -5,12 +5,15 @@ import java.util.List;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.community.domain.CommunityPostHeat;
import com.inspur.community.domain.vo.CommunityPostInfoVO;
import com.inspur.community.mapper.CommunityPostHeatMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostInfoMapper;
import com.inspur.community.domain.CommunityPostInfo;
import com.inspur.community.service.ICommunityPostInfoService;
import org.springframework.transaction.annotation.Transactional;
/**
* 社区帖子信息Service业务层处理
@ -23,6 +26,8 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService
{
@Autowired
private CommunityPostInfoMapper communityPostInfoMapper;
@Autowired
private CommunityPostHeatMapper communityPostHeatMapper;
/**
* 查询社区帖子信息
@ -54,13 +59,19 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService
* @param communityPostInfo 社区帖子信息
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertCommunityPostInfo(CommunityPostInfo communityPostInfo)
{
communityPostInfo.setPostId(IdUtils.simpleUUID());
communityPostInfo.setPostTime(new Date());
communityPostInfo.setUserId(SecurityUtils.getUserId());
return communityPostInfoMapper.insertCommunityPostInfo(communityPostInfo);
//热度榜单新增记录
CommunityPostHeat postHeat = new CommunityPostHeat();
postHeat.setPostId(communityPostInfo.getPostId());
postHeat.setLikes(0);
postHeat.setViews(0);
return communityPostInfoMapper.insertCommunityPostInfo(communityPostInfo) & communityPostHeatMapper.insertCommunityPostHeat(postHeat);
}
/**
@ -81,9 +92,11 @@ public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService
* @param postId
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int addViews(String postId){
return communityPostInfoMapper.addViews(postId);
//热度榜单浏览记录加一
return communityPostInfoMapper.addViews(postId) & communityPostHeatMapper.addViews(postId);
}
/**

View File

@ -0,0 +1,106 @@
package com.inspur.community.service.impl;
import java.util.Date;
import java.util.List;
import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.community.mapper.CommunityPostHeatMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostLikeMapper;
import com.inspur.community.domain.CommunityPostLike;
import com.inspur.community.service.ICommunityPostLikeService;
/**
* 社区点赞信息Service业务层处理
*
* @author inspur
* @date 2024-04-30
*/
@Service
public class CommunityPostLikeServiceImpl implements ICommunityPostLikeService
{
@Autowired
private CommunityPostLikeMapper communityPostLikeMapper;
@Autowired
private CommunityPostHeatMapper communityPostHeatMapper;
/**
* 查询社区点赞信息
*
* @param userId 社区点赞信息主键
* @return 社区点赞信息
*/
@Override
public CommunityPostLike selectCommunityPostLikeByUserId(Long userId)
{
return communityPostLikeMapper.selectCommunityPostLikeByUserId(userId);
}
/**
* 查询社区点赞信息列表
*
* @param communityPostLike 社区点赞信息
* @return 社区点赞信息
*/
@Override
public List<CommunityPostLike> selectCommunityPostLikeList(CommunityPostLike communityPostLike)
{
return communityPostLikeMapper.selectCommunityPostLikeList(communityPostLike);
}
/**
* 新增社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
@Override
public int insertCommunityPostLike(CommunityPostLike communityPostLike)
{
communityPostLike.setUserId(SecurityUtils.getLoginUser().getUserId());
communityPostLike.setLikeTime(new Date());
//增加热度榜点赞记录加一
return communityPostLikeMapper.insertCommunityPostLike(communityPostLike);
}
/**
* 修改社区点赞信息
*
* @param communityPostLike 社区点赞信息
* @return 结果
*/
@Override
public int updateCommunityPostLike(CommunityPostLike communityPostLike)
{
return communityPostLikeMapper.updateCommunityPostLike(communityPostLike);
}
/**
* 批量删除社区点赞信息
*
* @param userIds 需要删除的社区点赞信息主键
* @return 结果
*/
@Override
public int deleteCommunityPostLikeByUserIds(Long[] userIds)
{
return communityPostLikeMapper.deleteCommunityPostLikeByUserIds(userIds);
}
/**
* 删除社区点赞信息信息
*
* @param userId 社区点赞信息主键
* @return 结果
*/
@Override
public int deleteCommunityPostLikeByUserIdandPostId(Long userId,String likePostId)
{
return communityPostLikeMapper.deleteCommunityPostLikeByUserIdandPostId(userId,likePostId);
}
}

View File

@ -0,0 +1,254 @@
package com.inspur.community.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import com.inspur.common.core.domain.entity.SysUser;
import com.inspur.common.utils.DateUtils;
import com.inspur.common.utils.SecurityUtils;
import com.inspur.common.utils.uuid.IdUtils;
import com.inspur.community.domain.CommunityComment;
import com.inspur.community.domain.CommunityPostLike;
import com.inspur.community.mapper.CommunityPostHeatMapper;
import com.inspur.community.mapper.CommunityPostLikeMapper;
import com.inspur.system.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostReplyMapper;
import com.inspur.community.domain.CommunityPostReply;
import com.inspur.community.service.ICommunityPostReplyService;
import org.springframework.transaction.annotation.Transactional;
import javax.faces.application.Application;
/**
* 社区帖子回复Service业务层处理
*
* @author inspur
* @date 2024-04-30
*/
@Service
public class CommunityPostReplyServiceImpl implements ICommunityPostReplyService
{
@Autowired
private CommunityPostReplyMapper communityPostReplyMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private CommunityPostLikeMapper communityPostLikeMapper;
@Autowired
private CommunityPostHeatMapper communityPostHeatMapper;
/**
* 查询社区帖子回复
*
* @param replyId 社区帖子回复主键
* @return 社区帖子回复
*/
@Override
public CommunityPostReply selectCommunityPostReplyByReplyId(String replyId)
{
return communityPostReplyMapper.selectCommunityPostReplyByReplyId(replyId);
}
/**
* 查询社区帖子回复列表
*
* @param communityPostReply 社区帖子回复
* @return 社区帖子回复
*/
@Override
public List<CommunityComment> selectCommunityPostReplyList(CommunityPostReply communityPostReply)
{
communityPostReply.setStatus("0");
communityPostReply.setParentReplyId("0");
List<CommunityPostReply> communityPostReplyList = communityPostReplyMapper.selectCommunityPostReplyList(communityPostReply);
List<CommunityComment> communityComments = new ArrayList<>();
for (CommunityPostReply reply : communityPostReplyList) {
List<CommunityComment> childCommentList = new ArrayList<>();
CommunityComment comment = new CommunityComment();
comment.setUserId(reply.getUserId());
comment.setReplyId(reply.getReplyId());
comment.setReplyContent(reply.getReplyContent());
comment.setParentReplyId(reply.getParentReplyId());
comment.setUserId(reply.getUserId());
comment.setReplyTime(reply.getReplyTime());
Long userId = reply.getUserId();
if(userId != null) {
SysUser user = sysUserMapper.selectUserById(userId);
comment.setUserName(user.getNickName());
comment.setAvatar(user.getAvatar());
}
//是否被点赞
CommunityPostLike queryPostLike = new CommunityPostLike();
queryPostLike.setUserId(SecurityUtils.getLoginUser().getUserId());
queryPostLike.setLikePostId(reply.getReplyId());
List<CommunityPostLike> likeList = communityPostLikeMapper.selectCommunityPostLikeList(queryPostLike);
if(likeList.size() > 0) {
comment.setLike(true);
} else {
comment.setLike(false);
}
comment.setLikeNum(communityPostLikeMapper.countCommunityPostLikeByLikePostId(reply.getReplyId()));
//添加子评论
CommunityPostReply queryReply = new CommunityPostReply();
queryReply.setStatus("0");
queryReply.setRootReplyId(reply.getReplyId());
List<CommunityPostReply> childrenReplyList = communityPostReplyMapper.selectCommunityPostReplyList(queryReply);
if(childrenReplyList.size() > 0){
for (CommunityPostReply postReply : childrenReplyList) {
CommunityComment childComment = new CommunityComment();
//添加用户信息
Long childUserId = postReply.getUserId();
if(childUserId != null){
SysUser childUser = sysUserMapper.selectUserById(childUserId);
childComment.setUserId(childUser.getUserId());
childComment.setUserName(childUser.getNickName());
childComment.setAvatar(childUser.getAvatar());
}
//添加是否被点赞
CommunityPostLike queryChildPostLike = new CommunityPostLike();
queryChildPostLike.setUserId(SecurityUtils.getLoginUser().getUserId());
queryChildPostLike.setLikePostId(postReply.getReplyId());
List<CommunityPostLike> childLikeList = communityPostLikeMapper.selectCommunityPostLikeList(queryChildPostLike);
if(childLikeList.size() > 0) {
childComment.setLike(true);
} else {
childComment.setLike(false);
}
childComment.setLikeNum(communityPostLikeMapper.countCommunityPostLikeByLikePostId(postReply.getReplyId()));
if(!postReply.getParentReplyId().equals(postReply.getRootReplyId())){
CommunityPostReply parentReply = communityPostReplyMapper.selectCommunityPostReplyByReplyId(postReply.getParentReplyId());
SysUser parentUser = sysUserMapper.selectUserById(parentReply.getUserId());
childComment.setParentReplyUserName(parentUser.getNickName());
}
childComment.setPostId(postReply.getPostId());
childComment.setReplyId(postReply.getReplyId());
childComment.setReplyContent(postReply.getReplyContent());
childComment.setReplyTime(postReply.getReplyTime());
childComment.setParentReplyId(postReply.getParentReplyId());
childComment.setRootReplyId(postReply.getRootReplyId());
childCommentList.add(childComment);
}
}
comment.setChildren(childCommentList);
communityComments.add(comment);
}
return communityComments;
}
/**
* 新增社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int insertCommunityPostReply(CommunityPostReply communityPostReply)
{
communityPostReply.setReplyId(IdUtils.simpleUUID());
communityPostReply.setUserId(SecurityUtils.getLoginUser().getUserId());
communityPostReply.setReplyTime(DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS));
//帖子热度回复量加一
return communityPostReplyMapper.insertCommunityPostReply(communityPostReply) & communityPostHeatMapper.addReplies(communityPostReply.getPostId());
}
/**
* 修改社区帖子回复
*
* @param communityPostReply 社区帖子回复
* @return 结果
*/
@Override
public int updateCommunityPostReply(CommunityPostReply communityPostReply)
{
return communityPostReplyMapper.updateCommunityPostReply(communityPostReply);
}
/**
* 批量删除社区帖子回复
*
* @param replyIds 需要删除的社区帖子回复主键
* @return 结果
*/
@Override
public int deleteCommunityPostReplyByReplyIds(String[] replyIds)
{
return communityPostReplyMapper.deleteCommunityPostReplyByReplyIds(replyIds);
}
/**
* 删除社区帖子回复信息
*
* @param replyId 社区帖子回复主键
* @return 结果
*/
@Override
public int deleteCommunityPostReplyByReplyId(String replyId)
{
return communityPostReplyMapper.deleteCommunityPostReplyByReplyId(replyId);
}
/**
* 递归将评论连接
*/
private List<CommunityComment> getCommentList(List<CommunityPostReply> communityPostReplyList, String parentReplyId){
if(communityPostReplyList.size() == 0){
return new ArrayList<>();
}
List<CommunityComment> commentList = new ArrayList<>();
List<CommunityPostReply> list = new ArrayList<>();
// list = communityPostReplyList.stream().filter(reply -> reply.getParentRepayId().equals(parentReplyId)).collect(Collectors.toList());
//
// if(list.size() == 0){
// return new ArrayList<>();
// }
//
// for (CommunityPostReply communityPostReply : list) {
// CommunityComment comment = new CommunityComment();
// comment.setReplyId(communityPostReply.getReplyId());
// comment.setReplyContent(communityPostReply.getReplyContent());
// comment.setReplyTime(communityPostReply.getReplyTime());
// comment.setRootReplyId(communityPostReply.getRootReplyId());
// comment.setParentRepayId(communityPostReply.getParentRepayId());
// comment.setPostId(communityPostReply.getPostId());
// comment.setUserId(communityPostReply.getUserId());
// if(communityPostReply.getUserId() != null){
// SysUser user = sysUserMapper.selectUserById(communityPostReply.getUserId());
// if(user != null){
// comment.setUserName(user.getNickName());
// comment.setAvatar(user.getAvatar());
// }
// }else{
// comment.setUserName("匿名用户");
// }
//
// if(communityPostReply.getUserId() != null){
// CommunityPostLike query = new CommunityPostLike();
// query.setLikePostId(communityPostReply.getReplyId());
// query.setUserId(communityPostReply.getUserId());
// List<CommunityPostLike> likeList = communityPostLikeMapper.selectCommunityPostLikeList(query);
// comment.setLikeNum((long) likeList.size());
// if(likeList.size() > 0){
// comment.setLike(true);
// }else {
// comment.setLike(false);
// }
// }
// comment.setChildren(getCommentList(communityPostReplyList, communityPostReply.getReplyId()));
// commentList.add(comment);
// }
return commentList;
}
}

View File

@ -0,0 +1,94 @@
package com.inspur.community.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.inspur.community.mapper.CommunityPostReportMapper;
import com.inspur.community.domain.CommunityPostReport;
import com.inspur.community.service.ICommunityPostReportService;
/**
* 社区帖子举报Service业务层处理
*
* @author inspur
* @date 2024-04-30
*/
@Service
public class CommunityPostReportServiceImpl implements ICommunityPostReportService
{
@Autowired
private CommunityPostReportMapper communityPostReportMapper;
/**
* 查询社区帖子举报
*
* @param reportId 社区帖子举报主键
* @return 社区帖子举报
*/
@Override
public CommunityPostReport selectCommunityPostReportByReportId(String reportId)
{
return communityPostReportMapper.selectCommunityPostReportByReportId(reportId);
}
/**
* 查询社区帖子举报列表
*
* @param communityPostReport 社区帖子举报
* @return 社区帖子举报
*/
@Override
public List<CommunityPostReport> selectCommunityPostReportList(CommunityPostReport communityPostReport)
{
return communityPostReportMapper.selectCommunityPostReportList(communityPostReport);
}
/**
* 新增社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
@Override
public int insertCommunityPostReport(CommunityPostReport communityPostReport)
{
return communityPostReportMapper.insertCommunityPostReport(communityPostReport);
}
/**
* 修改社区帖子举报
*
* @param communityPostReport 社区帖子举报
* @return 结果
*/
@Override
public int updateCommunityPostReport(CommunityPostReport communityPostReport)
{
return communityPostReportMapper.updateCommunityPostReport(communityPostReport);
}
/**
* 批量删除社区帖子举报
*
* @param reportIds 需要删除的社区帖子举报主键
* @return 结果
*/
@Override
public int deleteCommunityPostReportByReportIds(String[] reportIds)
{
return communityPostReportMapper.deleteCommunityPostReportByReportIds(reportIds);
}
/**
* 删除社区帖子举报信息
*
* @param reportId 社区帖子举报主键
* @return 结果
*/
@Override
public int deleteCommunityPostReportByReportId(String reportId)
{
return communityPostReportMapper.deleteCommunityPostReportByReportId(reportId);
}
}

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.community.mapper.CommunityPostHeatMapper">
<resultMap type="CommunityPostHeat" id="CommunityPostHeatResult">
<result property="postId" column="post_id" />
<result property="likes" column="likes" />
<result property="views" column="views" />
<result property="replies" column="replies" />
</resultMap>
<sql id="selectCommunityPostHeatVo">
select post_id, likes, views, replies from community_post_heat
</sql>
<select id="selectCommunityPostHeatList" parameterType="CommunityPostHeat" resultMap="CommunityPostHeatResult">
<include refid="selectCommunityPostHeatVo"/>
<where>
<if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="likes != null "> and likes = #{likes}</if>
<if test="views != null "> and views = #{views}</if>
<if test="replies != null "> and replies = #{replies}</if>
</where>
</select>
<select id="selectCommunityPostHeatByPostId" parameterType="String" resultMap="CommunityPostHeatResult">
<include refid="selectCommunityPostHeatVo"/>
where post_id = #{postId}
</select>
<insert id="insertCommunityPostHeat" parameterType="CommunityPostHeat">
insert into community_post_heat
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="postId != null">post_id,</if>
<if test="likes != null">likes,</if>
<if test="views != null">views,</if>
<if test="replies != null">replies,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="postId != null">#{postId},</if>
<if test="likes != null">#{likes},</if>
<if test="views != null">#{views},</if>
<if test="replies != null">#{replies},</if>
</trim>
</insert>
<update id="updateCommunityPostHeat" parameterType="CommunityPostHeat">
update community_post_heat
<trim prefix="SET" suffixOverrides=",">
<if test="likes != null">likes = #{likes},</if>
<if test="views != null">views = #{views},</if>
<if test="replies != null">replies = #{replies},</if>
</trim>
where post_id = #{postId}
</update>
<!-- 浏览量加一 -->
<update id="addViews" parameterType="String">
update community_post_heat set views = views + 1 where post_id = #{postId}
</update>
<!-- 回复量加一 -->
<update id="addReplies" parameterType="String">
update community_post_heat set replies = replies + 1 where post_id = #{postId}
</update>
<delete id="deleteCommunityPostHeatByPostId" parameterType="String">
delete from community_post_heat where post_id = #{postId}
</delete>
<delete id="deleteCommunityPostHeatByPostIds" parameterType="String">
delete from community_post_heat where post_id in
<foreach item="postId" collection="array" open="(" separator="," close=")">
#{postId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.community.mapper.CommunityPostLikeMapper">
<resultMap type="CommunityPostLike" id="CommunityPostLikeResult">
<result property="userId" column="user_id" />
<result property="likePostId" column="like_post_id" />
<result property="likeTime" column="like_time" />
</resultMap>
<sql id="selectCommunityPostLikeVo">
select user_id, like_post_id, like_time from community_post_like
</sql>
<select id="selectCommunityPostLikeList" parameterType="CommunityPostLike" resultMap="CommunityPostLikeResult">
<include refid="selectCommunityPostLikeVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="likePostId != null "> and like_post_id = #{likePostId}</if>
<if test="likeTime != null "> and like_time = #{likeTime}</if>
</where>
</select>
<select id="selectCommunityPostLikeByUserId" parameterType="Long" resultMap="CommunityPostLikeResult">
<include refid="selectCommunityPostLikeVo"/>
where user_id = #{userId}
</select>
<!--根据postid统计点赞数
public int countCommunityPostLikeByLikePostId-->
<select id="countCommunityPostLikeByLikePostId" parameterType="String" resultType="long">
select count(1) from community_post_like where like_post_id = #{likePostId}
</select>
<insert id="insertCommunityPostLike" parameterType="CommunityPostLike">
insert into community_post_like
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="likePostId != null">like_post_id,</if>
<if test="likeTime != null">like_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="likePostId != null">#{likePostId},</if>
<if test="likeTime != null">#{likeTime},</if>
</trim>
</insert>
<update id="updateCommunityPostLike" parameterType="CommunityPostLike">
update community_post_like
<trim prefix="SET" suffixOverrides=",">
<if test="likePostId != null">like_post_id = #{likePostId},</if>
<if test="likeTime != null">like_time = #{likeTime},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteCommunityPostLikeByUserIdandPostId">
delete from community_post_like where user_id = #{userId} and like_post_id = #{likePostId}
</delete>
<delete id="deleteCommunityPostLikeByUserIds" parameterType="String">
delete from community_post_like where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.community.mapper.CommunityPostReplyMapper">
<resultMap type="CommunityPostReply" id="CommunityPostReplyResult">
<result property="replyId" column="reply_id" />
<result property="postId" column="post_id" />
<result property="userId" column="user_id" />
<result property="replyContent" column="reply_content" />
<result property="replyTime" column="reply_time" />
<result property="parentReplyId" column="parent_reply_id" />
<result property="rootReplyId" column="root_reply_id" />
<result property="status" column="status" />
</resultMap>
<sql id="selectCommunityPostReplyVo">
select reply_id, post_id, user_id, reply_content, reply_time, parent_reply_id, root_reply_id, status from community_post_reply
</sql>
<select id="selectCommunityPostReplyList" parameterType="CommunityPostReply" resultMap="CommunityPostReplyResult">
<include refid="selectCommunityPostReplyVo"/>
<where>
<if test="postId != null and postId != ''"> and post_id = #{postId}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="replyContent != null and replyContent != ''"> and reply_content = #{replyContent}</if>
<if test="replyTime != null and replyTime != ''"> and reply_time = #{replyTime}</if>
<if test="parentReplyId != null and parentReplyId != ''"> and parent_reply_id = #{parentReplyId}</if>
<if test="rootReplyId != null and rootReplyId != ''"> and root_reply_id = #{rootReplyId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by reply_time desc
</select>
<select id="selectCommunityPostReplyByReplyId" parameterType="String" resultMap="CommunityPostReplyResult">
<include refid="selectCommunityPostReplyVo"/>
where reply_id = #{replyId}
</select>
<insert id="insertCommunityPostReply" parameterType="CommunityPostReply">
insert into community_post_reply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="replyId != null">reply_id,</if>
<if test="postId != null">post_id,</if>
<if test="userId != null">user_id,</if>
<if test="replyContent != null">reply_content,</if>
<if test="replyTime != null">reply_time,</if>
<if test="parentReplyId != null">parent_reply_id,</if>
<if test="rootReplyId != null">root_reply_id,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="replyId != null">#{replyId},</if>
<if test="postId != null">#{postId},</if>
<if test="userId != null">#{userId},</if>
<if test="replyContent != null">#{replyContent},</if>
<if test="replyTime != null">#{replyTime},</if>
<if test="parentReplyId != null">#{parentReplyId},</if>
<if test="rootReplyId != null">#{rootReplyId},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateCommunityPostReply" parameterType="CommunityPostReply">
update community_post_reply
<trim prefix="SET" suffixOverrides=",">
<if test="postId != null">post_id = #{postId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="replyContent != null">reply_content = #{replyContent},</if>
<if test="replyTime != null">reply_time = #{replyTime},</if>
<if test="parentReplyId != null">parent_repay_id = #{parentReplyId},</if>
<if test="rootReplyId != null">root_reply_id = #{rootReplyId},</if>
<if test="status != null">status = #{status},</if>
</trim>
where reply_id = #{replyId}
</update>
<delete id="deleteCommunityPostReplyByReplyId" parameterType="String">
delete from community_post_reply where reply_id = #{replyId}
</delete>
<delete id="deleteCommunityPostReplyByReplyIds" parameterType="String">
delete from community_post_reply where reply_id in
<foreach item="replyId" collection="array" open="(" separator="," close=")">
#{replyId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspur.community.mapper.CommunityPostReportMapper">
<resultMap type="CommunityPostReport" id="CommunityPostReportResult">
<result property="reportId" column="report_id" />
<result property="reportUserId" column="report_user_id" />
<result property="reportContentId" column="report_content_id" />
<result property="reportTime" column="report_time" />
<result property="reportReason" column="report_reason" />
<result property="status" column="status" />
<result property="reportType" column="report_type" />
<result property="result" column="result" />
</resultMap>
<sql id="selectCommunityPostReportVo">
select report_id, report_user_id, report_content_id, report_time, report_reason, status, report_type, result from community_post_report
</sql>
<select id="selectCommunityPostReportList" parameterType="CommunityPostReport" resultMap="CommunityPostReportResult">
<include refid="selectCommunityPostReportVo"/>
<where>
<if test="reportUserId != null "> and report_user_id = #{reportUserId}</if>
<if test="reportContentId != null and reportContentId != ''"> and report_content_id = #{reportContentId}</if>
<if test="reportTime != null and reportTime != ''"> and report_time = #{reportTime}</if>
<if test="reportReason != null and reportReason != ''"> and report_reason = #{reportReason}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="reportType != null and reportType != ''"> and report_type = #{reportType}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
</where>
</select>
<select id="selectCommunityPostReportByReportId" parameterType="String" resultMap="CommunityPostReportResult">
<include refid="selectCommunityPostReportVo"/>
where report_id = #{reportId}
</select>
<insert id="insertCommunityPostReport" parameterType="CommunityPostReport">
insert into community_post_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="reportId != null">report_id,</if>
<if test="reportUserId != null">report_user_id,</if>
<if test="reportContentId != null">report_content_id,</if>
<if test="reportTime != null">report_time,</if>
<if test="reportReason != null">report_reason,</if>
<if test="status != null">status,</if>
<if test="reportType != null">report_type,</if>
<if test="result != null">result,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="reportId != null">#{reportId},</if>
<if test="reportUserId != null">#{reportUserId},</if>
<if test="reportContentId != null">#{reportContentId},</if>
<if test="reportTime != null">#{reportTime},</if>
<if test="reportReason != null">#{reportReason},</if>
<if test="status != null">#{status},</if>
<if test="reportType != null">#{reportType},</if>
<if test="result != null">#{result},</if>
</trim>
</insert>
<update id="updateCommunityPostReport" parameterType="CommunityPostReport">
update community_post_report
<trim prefix="SET" suffixOverrides=",">
<if test="reportUserId != null">report_user_id = #{reportUserId},</if>
<if test="reportContentId != null">report_content_id = #{reportContentId},</if>
<if test="reportTime != null">report_time = #{reportTime},</if>
<if test="reportReason != null">report_reason = #{reportReason},</if>
<if test="status != null">status = #{status},</if>
<if test="reportType != null">report_type = #{reportType},</if>
<if test="result != null">result = #{result},</if>
</trim>
where report_id = #{reportId}
</update>
<delete id="deleteCommunityPostReportByReportId" parameterType="String">
delete from community_post_report where report_id = #{reportId}
</delete>
<delete id="deleteCommunityPostReportByReportIds" parameterType="String">
delete from community_post_report where report_id in
<foreach item="reportId" collection="array" open="(" separator="," close=")">
#{reportId}
</foreach>
</delete>
</mapper>

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询社区帖子热度列表
export function listHeat(query) {
return request({
url: "/community/heat/list",
method: "get",
params: query,
});
}
// 查询社区帖子热度详细
export function getHeat(postId) {
return request({
url: "/community/heat/" + postId,
method: "get",
});
}
// 新增社区帖子热度
export function addHeat(data) {
return request({
url: "/community/heat",
method: "post",
data: data,
});
}
// 修改社区帖子热度
export function updateHeat(data) {
return request({
url: "/community/heat",
method: "put",
data: data,
});
}
// 删除社区帖子热度
export function delHeat(postId) {
return request({
url: "/community/heat/" + postId,
method: "delete",
});
}

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询社区点赞信息列表
export function listLike(query) {
return request({
url: "/community/like/list",
method: "get",
params: query,
});
}
// 查询社区点赞信息详细
export function getLike(userId) {
return request({
url: "/community/like/" + userId,
method: "get",
});
}
// 新增社区点赞信息
export function addLike(data) {
return request({
url: "/community/like",
method: "post",
data: data,
});
}
// 修改社区点赞信息
export function updateLike(data) {
return request({
url: "/community/like",
method: "put",
data: data,
});
}
// 删除社区点赞信息
export function delLike(likePostId) {
return request({
url: "/community/like/" + likePostId,
method: "delete",
});
}

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询社区帖子回复列表
export function listReply(query) {
return request({
url: "/community/reply/list",
method: "get",
params: query,
});
}
// 查询社区帖子回复详细
export function getReply(replyId) {
return request({
url: "/community/reply/" + replyId,
method: "get",
});
}
// 新增社区帖子回复
export function addReply(data) {
return request({
url: "/community/reply",
method: "post",
data: data,
});
}
// 修改社区帖子回复
export function updateReply(data) {
return request({
url: "/community/reply",
method: "put",
data: data,
});
}
// 删除社区帖子回复
export function delReply(replyId) {
return request({
url: "/community/reply/" + replyId,
method: "delete",
});
}

View File

@ -0,0 +1,44 @@
import request from "@/utils/request";
// 查询社区帖子举报列表
export function listReport(query) {
return request({
url: "/community/report/list",
method: "get",
params: query,
});
}
// 查询社区帖子举报详细
export function getReport(reportId) {
return request({
url: "/community/report/" + reportId,
method: "get",
});
}
// 新增社区帖子举报
export function addReport(data) {
return request({
url: "/community/report",
method: "post",
data: data,
});
}
// 修改社区帖子举报
export function updateReport(data) {
return request({
url: "/community/report",
method: "put",
data: data,
});
}
// 删除社区帖子举报
export function delReport(reportId) {
return request({
url: "/community/report/" + reportId,
method: "delete",
});
}

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1642500780486" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2923" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M322.09 904.448c-3.705 0-7.436-0.792-10.935-2.402a26.158 26.158 0 0 1-15.228-23.76V766.76c0-13.847-11.268-25.115-25.14-25.115h-128.03c-42.72 0-77.467-34.747-77.467-77.44V197.005c0-42.707 34.747-77.454 77.466-77.454h738.512c42.694 0 77.441 34.747 77.441 77.454v467.2c0 42.694-34.747 77.441-77.44 77.441H530.982a25.15 25.15 0 0 0-16.402 6.08L339.105 898.138a26.007 26.007 0 0 1-17.015 6.311zM142.756 171.877c-13.873 0-25.14 11.267-25.14 25.128v467.2c0 13.848 11.267 25.116 25.14 25.116h128.03c42.718 0 77.466 34.747 77.466 77.44v54.625l132.321-113.415c14.078-12.034 31.963-18.65 50.41-18.65h350.284c13.848 0 25.115-11.268 25.115-25.115V197.005c0-13.86-11.267-25.128-25.115-25.128h-738.51z" p-id="2924"></path></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1642500468204" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2137" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css"></style></defs><path d="M933.248 335.104c-40-10.496-134.048-10.368-271.616-14.016 6.496-30.016 8-57.088 8-105.152 0-114.816-83.648-215.936-157.632-215.936-52.256 0-95.328 42.72-96 95.264-0.704 64.448-20.64 175.744-128 232.192-7.872 4.16-30.4 15.264-33.696 16.704l1.696 1.44c-16.8-14.496-40.096-25.6-64-25.6l-96 0c-52.928 0-96 43.072-96 96l0 512c0 52.928 43.072 96 96 96l96 0c38.08 0 69.952-23.008 85.376-55.264 0.384 0.128 1.056 0.32 1.504 0.384 2.112 0.576 4.608 1.184 7.648 1.984 0.576 0.16 0.864 0.224 1.472 0.384 18.432 4.576 53.92 13.056 129.76 30.496 16.256 3.712 102.144 22.016 191.104 22.016l174.944 0c53.312 0 91.744-20.512 114.624-61.696 0.32-0.64 7.68-15.008 13.696-34.432 4.512-14.624 6.176-35.328 0.736-56.32 34.368-23.616 45.44-59.328 52.64-82.56 12.064-38.112 8.448-66.752 0.064-87.264 19.328-18.24 35.808-46.048 42.752-88.512 4.32-26.304-0.32-53.376-12.448-75.904 18.112-20.352 26.368-45.952 27.328-69.632l0.384-6.688c0.224-4.192 0.416-6.784 0.416-16 0-40.416-28-91.968-90.752-109.888zM224 928c0 17.696-14.304 32-32 32l-96 0c-17.696 0-32-14.304-32-32l0-512c0-17.696 14.304-32 32-32l96 0c17.696 0 32 14.304 32 32l0 512zM959.264 465.12c-0.64 15.808-7.264 46.88-63.264 46.88-48 0-64 0-64 0-8.864 0-16 7.168-16 16s7.136 16 16 16c0 0 14.016 0 62.016 0s54.304 39.808 51.2 59.008c-3.968 23.872-15.168 68.992-69.216 68.992-53.984 0-76 0-76 0-8.864 0-16 7.136-16 16 0 8.8 7.136 16 16 16 0 0 38.016 0 63.008 0 54.016 0 49.248 41.184 41.504 65.76-10.208 32.288-16.448 62.24-84.512 62.24-23.008 0-52.192 0-52.192 0-8.864 0-16 7.136-16 16 0 8.8 7.136 16 16 16 0 0 22.176 0 50.176 0 35.008 0 36.64 33.12 32.992 44.992-4 12.992-8.736 22.624-8.928 23.072-9.664 17.44-25.248 27.936-58.24 27.936l-174.944 0c-87.872 0-175.04-19.936-177.28-20.448-132.928-30.624-139.936-32.992-148.288-35.36 0 0-27.072-4.576-27.072-28.192l-0.224-441.984c0-15.008 9.568-28.576 25.408-33.344 1.984-0.768 4.672-1.6 6.592-2.4 146.176-60.544 190.688-193.28 192-302.272 0.192-15.328 12-32 32-32 33.824 0 93.632 67.904 93.632 151.936 0 75.872-3.072 88.992-29.632 168.064 320 0 317.76 4.608 345.984 12 35.008 10.016 38.016 39.008 38.016 48.992 0 10.976-0.32 9.376-0.736 20.128zM144 832c-26.496 0-48 21.504-48 48s21.504 48 48 48 48-21.504 48-48-21.504-48-48-48zM144 896c-8.8 0-16-7.2-16-16s7.2-16 16-16 16 7.2 16 16-7.2 16-16 16z" p-id="2138"></path></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -70,7 +70,7 @@ export default {
},
//input
toId: {
type: Number,
type: String,
},
//end(), comment(),
type: {

View File

@ -27,15 +27,15 @@
</div>
</div>
<el-form
:model="messageForm"
:rules="messageFormRules"
ref="messageFormRef"
:model="replyForm"
:rules="replyFormRules"
ref="replyFormRef"
>
<el-form-item prop="content">
<el-input
@blur="blur"
:rows="5"
v-model="messageForm.content"
v-model="replyForm.replyContent"
type="textarea"
maxlength="100"
show-word-limit
@ -80,10 +80,7 @@
<script>
import { mapGetters } from "vuex";
import { getToken } from "@/utils/auth";
// import {
// cmsListComment,
// cmsAddComment,
// } from "@/api/cms/comment"
import { listReply, getReply, addReply, delReply } from "@/api/community/reply";
import comment from "./comments.vue";
import Emoji from "@/components/Emoji";
export default {
@ -98,7 +95,7 @@ export default {
userId: -1,
content: "",
},
messageForm: {},
replyForm: {},
//
total: 0,
//
@ -110,13 +107,13 @@ export default {
likeNum: null,
content: null,
type: null,
blogId: this.$route.query.id,
postId: this.$route.query.id,
userId: null,
delFlag: null,
createBy: null,
},
messageFormRules: {
content: [
replyFormRules: {
replyContent: [
{
min: 0,
max: 100,
@ -148,46 +145,40 @@ export default {
methods: {
//
reset() {
this.messageForm = {
id: null,
parentId: null,
mainId: null,
likeNum: null,
content: null,
type: null,
blogId: this.$route.query.id,
this.replyForm = {
replyContent: null,
status: null,
postId: this.$route.query.id,
parentReplyId: null,
rootReplyId: null,
userId: null,
delFlag: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("messageForm");
this.resetForm("replyForm");
},
//
publish() {
let token = getToken();
this.$refs.messageFormRef.validate(async (valid) => {
this.$refs.replyFormRef.validate(async (valid) => {
if (!valid) return;
if (
this.messageForm.content == null ||
this.messageForm.content == ""
this.replyForm.replyContent == null ||
this.replyForm.replyContent == ""
) {
this.$modal.msgError("评论内容不能为空!");
return;
}
if (token == null || token == "") {
this.messageForm.createBy = "匿名用户";
this.messageForm.type = "0";
// this.replyForm.createBy = "";
this.replyForm.status = "0";
} else {
this.messageForm.createBy = this.$store.getters.name;
this.messageForm.type = "0";
// this.replyForm.createBy = this.$store.getters.name;
this.replyForm.status = "0";
}
cmsAddComment(this.messageForm).then((response) => {
console.log("aaa:", this.replyForm);
addReply(this.replyForm).then((response) => {
this.$modal.msgSuccess("评论发表成功");
this.reset();
this.getMessageList();
this.listReply();
});
});
},
@ -196,26 +187,27 @@ export default {
*/
commitComment(value) {
this.reset();
this.messageForm.content = value.inputComment;
this.messageForm.parentId = value.id;
console.log("接收的数据:", value);
this.replyForm.replyContent = value.inputComment;
this.replyForm.parentReplyId = value.id;
let token = getToken();
this.$refs.messageFormRef.validate(async (valid) => {
this.$refs.replyFormRef.validate(async (valid) => {
if (!valid) return;
if (
this.messageForm.content == null ||
this.messageForm.content == ""
this.replyForm.replyContent == null ||
this.replyForm.replyContent == ""
) {
this.$modal.msgError("评论内容不能为空!");
return;
}
if (token == null || token == "") {
this.messageForm.createBy = "匿名用户";
this.messageForm.type = "1";
// this.replyForm.createBy = "";
this.replyForm.status = "1";
} else {
this.messageForm.createBy = this.$store.getters.name;
this.messageForm.type = "1";
// this.replyForm.createBy = this.$store.getters.name;
this.replyForm.status = "0";
}
cmsAddComment(this.messageForm).then((response) => {
addReply(this.replyForm).then((response) => {
this.$modal.msgSuccess("评论发表成功");
this.reset();
this.getMessageList();
@ -225,9 +217,41 @@ export default {
//
async getMessageList() {
let token = getToken();
if (token != null && token != "") {
this.queryParams.createBy = this.$store.getters.name;
}
// if (token != null && token != "") {
// this.queryParams.createBy = this.$store.getters.name;
// }
listReply(this.queryParams).then((response) => {
for (let i = 0; i < response.rows.length; i++) {
let mesInfo = response.rows[i];
if (mesInfo.avatar != null && mesInfo.avatar != "") {
response.rows[i].avatar =
process.env.VUE_APP_BASE_API + mesInfo.avatar;
}
if (mesInfo.children != null && mesInfo.children != "") {
for (let j = 0; j < response.rows[i].children.length; j++) {
let children = response.rows[i].children;
if (children.avatar != null && children.avatar != "") {
response.rows[i].children[j].avatar =
process.env.VUE_APP_BASE_API + children.avatar;
}
}
}
if (mesInfo.children.length > 0) {
let chl = mesInfo.children;
for (let i = 0; i < chl.length; i++) {
console.log("mes:", chl[i]);
console.log("parent:", chl[i].parentReplyId);
console.log("root:", chl[i].rootReplyId);
console.log(
"69696",
chl[i].parentReplyId != chl[i].rootReplyId
);
}
}
}
this.messageList = response.rows;
this.total = response.total;
});
// cmsListComment(this.queryParams).then((response) => {
// for (let i = 0; i < response.rows.length; i++) {
// let mesInfo = response.rows[i];
@ -254,23 +278,23 @@ export default {
this.cursorIndexEnd = e.srcElement.selectionEnd; // input
},
output(val) {
if (this.cursorIndexStart !== null && this.messageForm.content) {
if (this.cursorIndexStart !== null && this.replyForm.replyContent) {
// ,
this.messageForm.content =
this.messageForm.content.substring(0, this.cursorIndexStart) +
this.replyForm.replyContent =
this.replyForm.replyContent.substring(0, this.cursorIndexStart) +
val +
this.messageForm.content.substring(this.cursorIndexEnd);
this.replyForm.replyContent.substring(this.cursorIndexEnd);
} else {
// ,
this.messageForm.content = this.messageForm.content
? this.messageForm.content
this.replyForm.replyContent = this.replyForm.replyContent
? this.replyForm.replyContent
: "" + val;
}
},
//
to() {
if (this.$route.query.commentId != null) {
var toEl = document.getElementById(this.$route.query.commentId);
if (this.$route.query.id != null) {
var toEl = document.getElementById(this.$route.query.id);
if (toEl != null) {
if (toEl != null && toEl != "") {
// toEl DOM

View File

@ -1,52 +1,93 @@
<!--评论模块-->
<template>
<div class="container">
<div class="comment" v-for="item in comments">
<div class="info" :id="item.id">
<el-avatar v-if="item.avatar!==''&&item.avatar!=null" :src="item.avatar"></el-avatar>
<el-avatar v-else icon="el-icon-user-solid"></el-avatar>
<div
class="comment"
v-for="item in comments"
>
<div
class="info"
:id="item.id"
>
<el-avatar
v-if="item.avatar!==''&&item.avatar!=null"
:src="item.avatar"
></el-avatar>
<el-avatar
v-else
icon="el-icon-user-solid"
></el-avatar>
<div class="right">
<div class="name">{{item.createBy}}</div>
<div class="date">{{item.createTime}}</div>
<div class="name">{{item.userName}}</div>
<div class="date">{{item.replyTime}}</div>
</div>
</div>
<div class="content">{{item.content}}</div>
<div class="content">{{item.replyContent}}</div>
<div class="control">
<span class="like" :class="{active: item.isLike}" @click="likeClick(item)">
<span
class="like"
:class="{active: item.isLike}"
@click="likeClick(item)"
>
<svg-icon icon-class="like" />
<span class="like-num" style="margin-left: 5px;">{{item.likeNum > 0 ? item.likeNum + '人赞' : '赞'}}</span>
<span
class="like-num"
style="margin-left: 5px;"
>{{item.likeNum > 0 ? item.likeNum + '人赞' : '赞'}}</span>
</span>
<span class="comment-reply" @click="showCommentInput(item)">
<span
class="comment-reply"
@click="showCommentInput(item)"
>
<svg-icon icon-class="comment" />
<span style="margin-left: 5px;">回复</span>
</span>
</div>
<div class="reply">
<div class="item" v-for="reply in item.children" :id="reply.id">
<div
class="item"
v-for="reply in item.children"
:id="reply.replyId"
>
<div class="reply-content">
<span class="from-name">{{reply.createBy}}</span><span>: </span>
<span class="to-name" v-show="reply.parentId!=reply.mainId">@{{reply.pcreateBy}}</span>
<span v-show="reply.delFlag=='0'">{{reply.content}}</span>
<span v-show="reply.delFlag=='1'" style="color: #909399;">该评论已被删除</span>
<span class="from-name">{{reply.userName}}</span><span>: </span>
<span
class="to-name"
v-show="reply.parentReplyId!=reply.rootReplyId"
>@{{reply.parentReplyUserName}}</span>
<span>{{reply.replyContent}}</span>
<!-- <span
v-show="reply.delFlag=='2'"
style="color: #909399;"
>该评论已被删除</span> -->
</div>
<div class="reply-bottom">
<span>{{reply.createTime}}</span>
<span class="reply-text" @click="showCommentInput(item, reply)">
<span>{{reply.replyTime}}</span>
<span
class="reply-text"
@click="showCommentInput(item, reply)"
>
<svg-icon icon-class="comment" />
<span style="margin-left: 5px;">回复</span>
</span>
</div>
</div>
<div class="write-reply" v-if="item.children!=null" @click="showCommentInput(item)">
<div
class="write-reply"
v-if="item.children!=null"
@click="showCommentInput(item)"
>
<i class="el-icon-edit"></i>
<span class="add-comment">添加新评论</span>
</div>
<input-component :show="showItemId === item.id"
:value="inputComment"
:toComment="name"
:toId="id"
@cancel="cancelInput"
@confirm="commitComment">
<input-component
:show="showItemId === item.replyId"
:value="inputComment"
:toComment="name"
:toId="id"
@cancel="cancelInput"
@confirm="commitComment"
>
</input-component>
<!--<transition name="fade">-->
<!--<div class="input-wrapper" v-if="showItemId === item.id">-->
@ -69,301 +110,299 @@
</template>
<script>
import Vue from 'vue'
import InputComponent from './InputComponent'
import {
getToken
} from '@/utils/auth'
// import {
// addCmsCommentLike,
// delCmsCommentLike,
// } from "@/api/cms/comment"
export default {
props: {
comments: {
type: Array,
required: true
import Vue from "vue";
import InputComponent from "./InputComponent";
import { getToken } from "@/utils/auth";
import { listReply, getReply, addReply, delReply } from "@/api/community/reply";
import { listLike, getLike, addLike, delLike } from "@/api/community/like";
export default {
props: {
comments: {
type: Array,
required: true,
},
},
components: {
"input-component": InputComponent,
},
data() {
return {
inputComment: "",
name: "",
id: null,
showItemId: "",
commentLikeForm: {},
};
},
computed: {},
methods: {
//
reset() {
this.commentLikeForm = {
commentId: null,
userId: null,
likeNum: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
};
this.resetForm("commentLikeForm");
},
/**
* 新增点赞
*/
addCommentLike(item) {
let token = getToken();
this.reset();
if (token == null || token == "") {
// this.commentLikeForm.createBy = "";
this.commentLikeForm.likePostId = item.replyId;
this.commentLikeForm.likeNum = item.likeNum;
} else {
// this.commentLikeForm.createBy = this.$store.getters.name;
this.commentLikeForm.likePostId = item.replyId;
this.commentLikeForm.likeNum = item.likeNum;
}
},
components: {
"input-component": InputComponent
},
data() {
return {
inputComment: '',
name: '',
id: null,
showItemId: '',
commentLikeForm: {},
}
},
computed: {},
methods: {
//
reset() {
this.commentLikeForm = {
commentId: null,
userId: null,
likeNum: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("commentLikeForm");
},
/**
* 新增点赞
*/
addCommentLike(item){
let token = getToken();
addLike(this.commentLikeForm).then((response) => {
this.reset();
if (token==null || token == '') {
this.commentLikeForm.createBy = "匿名用户"
this.commentLikeForm.commentId = item.id
this.commentLikeForm.likeNum = item.likeNum
} else {
this.commentLikeForm.createBy = this.$store.getters.name
this.commentLikeForm.commentId = item.id
this.commentLikeForm.likeNum = item.likeNum
}
addCmsCommentLike(this.commentLikeForm).then(response => {
this.reset();
});
},
/**
* 删除点赞
*/
delCommentLike(item){
let token = getToken();
});
},
/**
* 删除点赞
*/
delCommentLike(item) {
let token = getToken();
this.reset();
if (token == null || token == "") {
// this.commentLikeForm.createBy = "";
this.commentLikeForm.likePostId = item.replyId;
this.commentLikeForm.likeNum = item.likeNum;
} else {
// this.commentLikeForm.createBy = this.$store.getters.name;
this.commentLikeForm.likePostId = item.replayId;
this.commentLikeForm.likeNum = item.likeNum;
}
delLike(item.replyId).then((response) => {
this.reset();
if (token==null || token == '') {
this.commentLikeForm.createBy = "匿名用户"
this.commentLikeForm.commentId = item.id
this.commentLikeForm.likeNum = item.likeNum
});
},
/**
* 点赞
*/
likeClick(item) {
if (item.isLike === null) {
Vue.$set(item, "isLike", true);
item.likeNum++;
this.addCommentLike(item);
} else {
if (item.isLike) {
item.likeNum--;
this.delCommentLike(item);
} else {
this.commentLikeForm.createBy = this.$store.getters.name
this.commentLikeForm.commentId = item.id
this.commentLikeForm.likeNum = item.likeNum
item.likeNum++;
this.addCommentLike(item);
}
delCmsCommentLike(this.commentLikeForm).then(response => {
this.reset();
});
},
/**
* 点赞
*/
likeClick(item) {
if (item.isLike === null) {
Vue.$set(item, "isLike", true);
item.likeNum++
this.addCommentLike(item)
} else {
if (item.isLike) {
item.likeNum--
this.delCommentLike(item)
} else {
item.likeNum++
this.addCommentLike(item)
}
item.isLike = !item.isLike;
}
},
/**
* 点击取消按钮
*/
cancelInput() {
this.showItemId = ''
},
/**
* 提交评论
*/
commitComment(value) {
this.$emit("replyConfirm", value)
// console.log(value);
},
/**
* 点击评论按钮显示输入框
* item: 当前大评论
* reply: 当前回复的评论
*/
showCommentInput(item, reply) {
if (reply) {
this.inputComment = ""
this.name = "回复@" + reply.createBy + ":"
this.id = reply.id
} else {
this.inputComment = ''
this.name = '写下你的评论'
this.id = item.id
}
this.showItemId = item.id
item.isLike = !item.isLike;
}
},
created() {
// console.log(this.comments)
}
}
/**
* 点击取消按钮
*/
cancelInput() {
this.showItemId = "";
},
/**
* 提交评论
*/
commitComment(value) {
this.$emit("replyConfirm", value);
// console.log(value);
},
/**
* 点击评论按钮显示输入框
* item: 当前大评论
* reply: 当前回复的评论
*/
showCommentInput(item, reply) {
console.log("111:", item);
console.log("222:", reply);
if (reply != null) {
this.inputComment = "";
this.name = "回复@" + reply.userName + ":";
this.id = reply.replyId;
} else {
this.inputComment = "";
this.name = "写下你的评论";
this.id = item.replyId;
}
this.showItemId = item.replyId;
},
},
created() {
// console.log(this.comments)
},
};
</script>
<style scoped rel="stylesheet/scss" lang="scss">
.container {
padding: 0 10px;
box-sizing: border-box;
.comment {
.container {
padding: 0 10px;
box-sizing: border-box;
.comment {
display: flex;
flex-direction: column;
padding: 10px;
border-bottom: 1px solid #f2f6fc;
.info {
display: flex;
flex-direction: column;
padding: 10px;
border-bottom: 1px solid #F2F6FC;
.info {
align-items: center;
.right {
display: flex;
flex-direction: column;
margin-left: 10px;
.name {
font-size: 16px;
color: #303133;
margin-bottom: 5px;
font-weight: 500;
}
.date {
font-size: 12px;
color: #909399;
}
}
}
.content {
font-size: 16px;
color: #303133;
line-height: 20px;
padding: 10px 0;
}
.control {
display: flex;
align-items: center;
font-size: 14px;
color: #909399;
.like {
display: flex;
align-items: center;
.right {
margin-right: 20px;
cursor: pointer;
&.active,
&:hover {
color: #409eff;
}
.iconfont {
font-size: 14px;
margin-right: 5px;
}
}
.comment-reply {
display: flex;
align-items: center;
cursor: pointer;
&:hover {
color: #333;
}
.iconfont {
font-size: 16px;
margin-right: 5px;
}
}
}
.reply {
margin: 10px 0;
border-left: 2px solid #dcdfe6;
.item {
margin: 0 10px;
padding: 10px 0;
border-bottom: 1px dashed #ebeef5;
.reply-content {
display: flex;
flex-direction: column;
margin-left: 10px;
.name {
font-size: 16px;
color: #303133;
margin-bottom: 5px;
font-weight: 500;
align-items: center;
font-size: 14px;
color: #303133;
.from-name {
color: #409eff;
}
.date {
font-size: 12px;
color: #909399;
.to-name {
color: #409eff;
margin-left: 5px;
margin-right: 5px;
}
}
.reply-bottom {
display: flex;
align-items: center;
margin-top: 6px;
font-size: 12px;
color: #909399;
.reply-text {
display: flex;
align-items: center;
margin-left: 10px;
cursor: pointer;
&:hover {
color: #333;
}
.icon-comment {
margin-right: 5px;
}
}
}
}
.content {
font-size: 16px;
color: #303133;
line-height: 20px;
padding: 10px 0;
}
.control {
.write-reply {
display: flex;
align-items: center;
font-size: 14px;
color: #909399;
.like {
display: flex;
align-items: center;
margin-right: 20px;
cursor: pointer;
&.active, &:hover {
color: #409EFF;
}
.iconfont {
font-size: 14px;
margin-right: 5px;
}
padding: 10px;
cursor: pointer;
&:hover {
color: #303133;
}
.comment-reply {
display: flex;
align-items: center;
cursor: pointer;
&:hover {
color: #333;
}
.iconfont {
font-size: 16px;
margin-right: 5px;
}
.el-icon-edit {
margin-right: 5px;
}
}
.reply {
margin: 10px 0;
border-left: 2px solid #DCDFE6;
.item {
margin: 0 10px;
padding: 10px 0;
border-bottom: 1px dashed #EBEEF5;
.reply-content {
display: flex;
align-items: center;
font-size: 14px;
color: #303133;
.from-name {
color: #409EFF;
}
.to-name {
color: #409EFF;
margin-left: 5px;
margin-right: 5px;
}
}
.reply-bottom {
display: flex;
align-items: center;
margin-top: 6px;
font-size: 12px;
color: #909399;
.reply-text {
display: flex;
align-items: center;
margin-left: 10px;
cursor: pointer;
&:hover {
color: #333;
}
.icon-comment {
margin-right: 5px;
}
}
}
.fade-enter-active,
fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
.input-wrapper {
padding: 10px;
.gray-bg-input,
.el-input__inner {
/*background-color: #67C23A;*/
}
.write-reply {
.btn-control {
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 14px;
color: #909399;
padding: 10px;
cursor: pointer;
&:hover {
color: #303133;
}
.el-icon-edit {
margin-right: 5px;
}
}
.fade-enter-active, fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
.input-wrapper {
padding: 10px;
.gray-bg-input, .el-input__inner {
/*background-color: #67C23A;*/
}
.btn-control {
display: flex;
justify-content: flex-end;
align-items: center;
padding-top: 10px;
.cancel {
font-size: 16px;
color: #606266;
margin-right: 20px;
cursor: pointer;
&:hover {
color: #333;
}
}
.confirm {
font-size: 16px;
padding-top: 10px;
.cancel {
font-size: 16px;
color: #606266;
margin-right: 20px;
cursor: pointer;
&:hover {
color: #333;
}
}
.confirm {
font-size: 16px;
}
}
}
}
}
}
</style>

View File

@ -1,35 +1,36 @@
<template>
<div class="app-container">
<div>
<div style="text-align:center;margin-bottom:5px">
<i
class="el-icon-chat-line-round"
style="color:blue"
></i>
<span style="font-weight:bold">发表新贴</span>
</div>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="80px"
>
<el-form-item
label="标题"
prop="postTitle"
<div>
<div class="app-container ">
<div>
<div style="text-align:center;margin-bottom:5px">
<i
class="el-icon-chat-line-round"
style="color:blue"
></i>
<span style="font-weight:bold">发表新贴</span>
</div>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="80px"
>
<el-row>
<el-col :span="24">
<el-input
v-model="form.postTitle"
placeholder="请输入标题"
/>
</el-col>
</el-row>
</el-form-item>
<!-- <el-row>
<el-form-item
label="标题"
prop="postTitle"
>
<el-row>
<el-col :span="24">
<el-input
v-model="form.postTitle"
placeholder="请输入标题"
/>
</el-col>
</el-row>
</el-form-item>
<!-- <el-row>
<el-col :span="8">
<el-form-item label="首图">
<el-radio-group v-model="form.blogPicType">
@ -87,94 +88,92 @@
</el-form-item>
</el-col>
</el-row> -->
<el-row>
<el-col :span="24">
<el-form-item
prop="postContent"
label="内容"
>
<Editor
v-model="form.postContent"
type="base64"
:min-height="192"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item
prop="postType"
label="帖子类型"
>
<el-select
v-model="form.postType"
placeholder="请选择"
filterable
clearable
<el-row>
<el-col :span="24">
<el-form-item
prop="postContent"
label="内容"
>
<el-option
v-for="item in dict.type.post_type"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
prop="omField"
label="运维领域"
>
<el-select
v-model="form.omField"
placeholder="请选择"
clearable
<Editor
v-model="form.postContent"
type="base64"
:min-height="192"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item
prop="postType"
label="帖子类型"
>
<el-option
v-for="item in dict.type.community_field"
:key="item.value"
:label="item.label"
:value="item.value"
<el-select
v-model="form.postType"
placeholder="请选择"
filterable
clearable
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
prop="omIndustry"
label="运维行业"
>
<el-select
v-model="form.omIndustry"
placeholder="请选择"
clearable
<el-option
v-for="item in dict.type.post_type"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
prop="omField"
label="运维领域"
>
<el-option
v-for="item in dict.type.community_industry"
:key="item.value"
:label="item.label"
:value="item.value"
<el-select
v-model="form.omField"
placeholder="请选择"
clearable
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-option
v-for="item in dict.type.community_field"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
prop="omIndustry"
label="运维行业"
>
<el-select
v-model="form.omIndustry"
placeholder="请选择"
clearable
>
<el-option
v-for="item in dict.type.community_industry"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div style="text-align:right">
<el-button
type="primary"
@click="releaseForm"
> </el-button>
</div>
</div>
<div style="text-align:right">
<el-button
type="primary"
@click="releaseForm"
> </el-button>
</div>
</div>
</template>
<script>