From 515a41fb3ee533ff33b417ed0570831734b05fab Mon Sep 17 00:00:00 2001 From: xusd Date: Tue, 7 May 2024 14:25:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=80=83=E6=A0=B8=E8=AF=84=E4=BC=B0-?= =?UTF-8?q?=E6=88=90=E7=BB=A9=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examine/ExamInfoController.java | 13 + .../examine/ExamPaperInfoController.java | 104 ++++++ .../inspur/examine/domain/ExamPaperInfo.java | 78 ++++ .../inspur/examine/mapper/ExamInfoMapper.java | 9 + .../examine/mapper/ExamPaperInfoMapper.java | 61 ++++ .../examine/service/IExamInfoService.java | 9 + .../service/IExamPaperInfoService.java | 61 ++++ .../service/impl/ExamInfoServiceImpl.java | 12 + .../impl/ExamPaperInfoServiceImpl.java | 93 +++++ .../main/resources/mapper/ExamInfoMapper.xml | 7 +- .../resources/mapper/ExamPaperInfoMapper.xml | 103 ++++++ .../mapper/ExamQuestionBankMapper.xml | 1 + inspur-ui/src/api/examine/examInfo.js | 8 + inspur-ui/src/api/examine/paperInfo.js | 44 +++ .../src/views/examine/paperInfo/index.vue | 334 ++++++++++++++++++ 15 files changed, 936 insertions(+), 1 deletion(-) create mode 100644 inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamPaperInfoController.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamPaperInfo.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamPaperInfoMapper.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamPaperInfoService.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamPaperInfoServiceImpl.java create mode 100644 inspur-service/inspur-examine/src/main/resources/mapper/ExamPaperInfoMapper.xml create mode 100644 inspur-ui/src/api/examine/paperInfo.js create mode 100644 inspur-ui/src/views/examine/paperInfo/index.vue diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamInfoController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamInfoController.java index 7af79a3..f6080df 100644 --- a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamInfoController.java +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamInfoController.java @@ -102,4 +102,17 @@ public class ExamInfoController extends BaseController { return toAjax(examInfoService.deleteExamInfoByIds(ids)); } + + /** + * 考试信息下拉 + * + * @Author xusd + * @Date 11:21 2024/5/7 + * @return java.util.List + */ + @GetMapping("/selection") + @PreAuthorize("@ss.hasPermi('examine:examInfo:list')") + public List selection() { + return examInfoService.selection(); + } } diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamPaperInfoController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamPaperInfoController.java new file mode 100644 index 0000000..6896c2d --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamPaperInfoController.java @@ -0,0 +1,104 @@ +package com.inspur.web.controller.examine; + +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.examine.domain.ExamPaperInfo; +import com.inspur.examine.service.IExamPaperInfoService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 试卷信息Controller + * + * @author inspur + * @date 2024-05-07 + */ +@RestController +@RequestMapping("/examine/paperInfo") +public class ExamPaperInfoController extends BaseController +{ + @Autowired + private IExamPaperInfoService examPaperInfoService; + + /** + * 查询试卷信息列表 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:list')") + @GetMapping("/list") + public TableDataInfo list(ExamPaperInfo examPaperInfo) + { + startPage(); + List list = examPaperInfoService.selectExamPaperInfoList(examPaperInfo); + return getDataTable(list); + } + + /** + * 导出试卷信息列表 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:export')") + @Log(title = "试卷信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ExamPaperInfo examPaperInfo) + { + List list = examPaperInfoService.selectExamPaperInfoList(examPaperInfo); + ExcelUtil util = new ExcelUtil(ExamPaperInfo.class); + util.exportExcel(response, list, "试卷信息数据"); + } + + /** + * 获取试卷信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") String id) + { + return success(examPaperInfoService.selectExamPaperInfoById(id)); + } + + /** + * 新增试卷信息 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:add')") + @Log(title = "试卷信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ExamPaperInfo examPaperInfo) + { + return toAjax(examPaperInfoService.insertExamPaperInfo(examPaperInfo)); + } + + /** + * 修改试卷信息 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:edit')") + @Log(title = "试卷信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ExamPaperInfo examPaperInfo) + { + return toAjax(examPaperInfoService.updateExamPaperInfo(examPaperInfo)); + } + + /** + * 删除试卷信息 + */ + @PreAuthorize("@ss.hasPermi('examine:paperInfo:remove')") + @Log(title = "试卷信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids) + { + return toAjax(examPaperInfoService.deleteExamPaperInfoByIds(ids)); + } +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamPaperInfo.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamPaperInfo.java new file mode 100644 index 0000000..9e31597 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamPaperInfo.java @@ -0,0 +1,78 @@ +package com.inspur.examine.domain; + +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.inspur.common.annotation.Excel; +import lombok.Data; + +/** + * 试卷信息对象 exam_paper_info + * + * @author inspur + * @date 2024-05-07 + */ +@Data +public class ExamPaperInfo { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 考试id + */ + private String examId; + + /** + * 考试名称 + */ + @Excel(name = "考试名称") + private String examName; + + /** + * 考生id + */ + @Excel(name = "考生id") + private Long examineId; + + /** + * 考生名称 + */ + @Excel(name = "考生名称") + private String examineName; + + /** + * 考试开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "考试开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date examStartTime; + + /** + * 考试结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @Excel(name = "考试结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private Date examEndTime; + + /** + * 分数 + */ + @Excel(name = "分数") + private BigDecimal score; + + /** + * 状态 0 未通过,1 通过 + */ + @Excel(name = "状态",dictType = "examine_result") + private String status; + + /** + * 租户id + */ + private String tenantId; +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamInfoMapper.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamInfoMapper.java index 2ad45be..ce554ff 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamInfoMapper.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamInfoMapper.java @@ -58,4 +58,13 @@ public interface ExamInfoMapper * @return 结果 */ public int deleteExamInfoByIds(String[] ids); + + /** + * 考试信息下拉 + * + * @Author xusd + * @Date 11:21 2024/5/7 + * @return java.util.List + */ + List selection(); } diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamPaperInfoMapper.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamPaperInfoMapper.java new file mode 100644 index 0000000..9b12359 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamPaperInfoMapper.java @@ -0,0 +1,61 @@ +package com.inspur.examine.mapper; + +import java.util.List; +import com.inspur.examine.domain.ExamPaperInfo; + +/** + * 试卷信息Mapper接口 + * + * @author inspur + * @date 2024-05-07 + */ +public interface ExamPaperInfoMapper +{ + /** + * 查询试卷信息 + * + * @param id 试卷信息主键 + * @return 试卷信息 + */ + public ExamPaperInfo selectExamPaperInfoById(String id); + + /** + * 查询试卷信息列表 + * + * @param examPaperInfo 试卷信息 + * @return 试卷信息集合 + */ + public List selectExamPaperInfoList(ExamPaperInfo examPaperInfo); + + /** + * 新增试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + public int insertExamPaperInfo(ExamPaperInfo examPaperInfo); + + /** + * 修改试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + public int updateExamPaperInfo(ExamPaperInfo examPaperInfo); + + /** + * 删除试卷信息 + * + * @param id 试卷信息主键 + * @return 结果 + */ + public int deleteExamPaperInfoById(String id); + + /** + * 批量删除试卷信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteExamPaperInfoByIds(String[] ids); +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamInfoService.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamInfoService.java index 022491e..e177440 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamInfoService.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamInfoService.java @@ -58,4 +58,13 @@ public interface IExamInfoService * @return 结果 */ public int deleteExamInfoById(String id); + + /** + * 考试信息下拉 + * + * @Author xusd + * @Date 11:21 2024/5/7 + * @return java.util.List + */ + List selection(); } diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamPaperInfoService.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamPaperInfoService.java new file mode 100644 index 0000000..b1ee6b8 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamPaperInfoService.java @@ -0,0 +1,61 @@ +package com.inspur.examine.service; + +import java.util.List; +import com.inspur.examine.domain.ExamPaperInfo; + +/** + * 试卷信息Service接口 + * + * @author inspur + * @date 2024-05-07 + */ +public interface IExamPaperInfoService +{ + /** + * 查询试卷信息 + * + * @param id 试卷信息主键 + * @return 试卷信息 + */ + public ExamPaperInfo selectExamPaperInfoById(String id); + + /** + * 查询试卷信息列表 + * + * @param examPaperInfo 试卷信息 + * @return 试卷信息集合 + */ + public List selectExamPaperInfoList(ExamPaperInfo examPaperInfo); + + /** + * 新增试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + public int insertExamPaperInfo(ExamPaperInfo examPaperInfo); + + /** + * 修改试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + public int updateExamPaperInfo(ExamPaperInfo examPaperInfo); + + /** + * 批量删除试卷信息 + * + * @param ids 需要删除的试卷信息主键集合 + * @return 结果 + */ + public int deleteExamPaperInfoByIds(String[] ids); + + /** + * 删除试卷信息信息 + * + * @param id 试卷信息主键 + * @return 结果 + */ + public int deleteExamPaperInfoById(String id); +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java index 8d6e561..814b65f 100644 --- a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.inspur.examine.service.impl; +import java.util.Collections; import java.util.List; import java.util.Objects; @@ -103,4 +104,15 @@ public class ExamInfoServiceImpl implements IExamInfoService { return examInfoMapper.deleteExamInfoById(id); } + /** + * 考试信息下拉 + * + * @Author xusd + * @Date 11:21 2024/5/7 + * @return java.util.List + */ + @Override + public List selection() { + return examInfoMapper.selection(); + } } diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamPaperInfoServiceImpl.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamPaperInfoServiceImpl.java new file mode 100644 index 0000000..df2eb98 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/impl/ExamPaperInfoServiceImpl.java @@ -0,0 +1,93 @@ +package com.inspur.examine.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.inspur.examine.mapper.ExamPaperInfoMapper; +import com.inspur.examine.domain.ExamPaperInfo; +import com.inspur.examine.service.IExamPaperInfoService; + +/** + * 试卷信息Service业务层处理 + * + * @author inspur + * @date 2024-05-07 + */ +@Service +public class ExamPaperInfoServiceImpl implements IExamPaperInfoService +{ + @Autowired + private ExamPaperInfoMapper examPaperInfoMapper; + + /** + * 查询试卷信息 + * + * @param id 试卷信息主键 + * @return 试卷信息 + */ + @Override + public ExamPaperInfo selectExamPaperInfoById(String id) + { + return examPaperInfoMapper.selectExamPaperInfoById(id); + } + + /** + * 查询试卷信息列表 + * + * @param examPaperInfo 试卷信息 + * @return 试卷信息 + */ + @Override + public List selectExamPaperInfoList(ExamPaperInfo examPaperInfo) + { + return examPaperInfoMapper.selectExamPaperInfoList(examPaperInfo); + } + + /** + * 新增试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + @Override + public int insertExamPaperInfo(ExamPaperInfo examPaperInfo) + { + return examPaperInfoMapper.insertExamPaperInfo(examPaperInfo); + } + + /** + * 修改试卷信息 + * + * @param examPaperInfo 试卷信息 + * @return 结果 + */ + @Override + public int updateExamPaperInfo(ExamPaperInfo examPaperInfo) + { + return examPaperInfoMapper.updateExamPaperInfo(examPaperInfo); + } + + /** + * 批量删除试卷信息 + * + * @param ids 需要删除的试卷信息主键 + * @return 结果 + */ + @Override + public int deleteExamPaperInfoByIds(String[] ids) + { + return examPaperInfoMapper.deleteExamPaperInfoByIds(ids); + } + + /** + * 删除试卷信息信息 + * + * @param id 试卷信息主键 + * @return 结果 + */ + @Override + public int deleteExamPaperInfoById(String id) + { + return examPaperInfoMapper.deleteExamPaperInfoById(id); + } +} diff --git a/inspur-service/inspur-examine/src/main/resources/mapper/ExamInfoMapper.xml b/inspur-service/inspur-examine/src/main/resources/mapper/ExamInfoMapper.xml index 14ac1e7..2567682 100644 --- a/inspur-service/inspur-examine/src/main/resources/mapper/ExamInfoMapper.xml +++ b/inspur-service/inspur-examine/src/main/resources/mapper/ExamInfoMapper.xml @@ -36,13 +36,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and exam_level = #{examLevel} and exam_type = #{examType} + order by create_time desc - + + + insert into exam_info diff --git a/inspur-service/inspur-examine/src/main/resources/mapper/ExamPaperInfoMapper.xml b/inspur-service/inspur-examine/src/main/resources/mapper/ExamPaperInfoMapper.xml new file mode 100644 index 0000000..3dd4d0e --- /dev/null +++ b/inspur-service/inspur-examine/src/main/resources/mapper/ExamPaperInfoMapper.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + SELECT + epi.id, + epi.exam_id, + epi.examine_id, + epi.score, + epi.`status`, + epi.exam_start_time, + epi.exam_end_time, + epi.tenant_id, + su.nick_name, + ei.exam_name + FROM + exam_paper_info AS epi + LEFT JOIN sys_user AS su ON su.user_id = epi.examine_id + LEFT JOIN exam_info AS ei ON ei.id = epi.exam_id + + + + + + + + insert into exam_paper_info + + id, + exam_id, + examine_id, + score, + status, + exam_start_time, + exam_end_time, + tenant_id, + + + #{id}, + #{examId}, + #{examineId}, + #{score}, + #{status}, + #{examStartTime}, + #{examEndTime}, + #{tenantId}, + + + + + update exam_paper_info + + exam_id = #{examId}, + examine_id = #{examineId}, + score = #{score}, + status = #{status}, + exam_start_time = #{examStartTime}, + exam_end_time = #{examEndTime}, + tenant_id = #{tenantId}, + + where id = #{id} + + + + delete from exam_paper_info where id = #{id} + + + + delete from exam_paper_info where id in + + #{id} + + + \ No newline at end of file diff --git a/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml b/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml index d7ac4ab..b24bf93 100644 --- a/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml +++ b/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml @@ -33,6 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and question_title like concat('%', #{questionTitle}, '%') and status = #{status} + order by create_time desc + + + and post_id = #{postId} + and likes = #{likes} + and views = #{views} + and replies = #{replies} + + + + + + + insert into community_post_heat + + post_id, + likes, + views, + replies, + + + #{postId}, + #{likes}, + #{views}, + #{replies}, + + + + + update community_post_heat + + likes = #{likes}, + views = #{views}, + replies = #{replies}, + + where post_id = #{postId} + + + + + update community_post_heat set views = views + 1 where post_id = #{postId} + + + + + update community_post_heat set replies = replies + 1 where post_id = #{postId} + + + + delete from community_post_heat where post_id = #{postId} + + + + delete from community_post_heat where post_id in + + #{postId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml new file mode 100644 index 0000000..8af3169 --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostLikeMapper.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + select user_id, like_post_id, like_time from community_post_like + + + + + + + + + + + insert into community_post_like + + user_id, + like_post_id, + like_time, + + + #{userId}, + #{likePostId}, + #{likeTime}, + + + + + update community_post_like + + like_post_id = #{likePostId}, + like_time = #{likeTime}, + + where user_id = #{userId} + + + + delete from community_post_like where user_id = #{userId} and like_post_id = #{likePostId} + + + + delete from community_post_like where user_id in + + #{userId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml new file mode 100644 index 0000000..b916e3a --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReplyMapper.xml @@ -0,0 +1,89 @@ + + + + + + + + + + + + + + + + + select reply_id, post_id, user_id, reply_content, reply_time, parent_reply_id, root_reply_id, status from community_post_reply + + + + + + + + insert into community_post_reply + + reply_id, + post_id, + user_id, + reply_content, + reply_time, + parent_reply_id, + root_reply_id, + status, + + + #{replyId}, + #{postId}, + #{userId}, + #{replyContent}, + #{replyTime}, + #{parentReplyId}, + #{rootReplyId}, + #{status}, + + + + + update community_post_reply + + post_id = #{postId}, + user_id = #{userId}, + reply_content = #{replyContent}, + reply_time = #{replyTime}, + parent_repay_id = #{parentReplyId}, + root_reply_id = #{rootReplyId}, + status = #{status}, + + where reply_id = #{replyId} + + + + delete from community_post_reply where reply_id = #{replyId} + + + + delete from community_post_reply where reply_id in + + #{replyId} + + + \ No newline at end of file diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml new file mode 100644 index 0000000..285ee1f --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostReportMapper.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + select report_id, report_user_id, report_content_id, report_time, report_reason, status, report_type, result from community_post_report + + + + + + + + insert into community_post_report + + report_id, + report_user_id, + report_content_id, + report_time, + report_reason, + status, + report_type, + result, + + + #{reportId}, + #{reportUserId}, + #{reportContentId}, + #{reportTime}, + #{reportReason}, + #{status}, + #{reportType}, + #{result}, + + + + + update community_post_report + + report_user_id = #{reportUserId}, + report_content_id = #{reportContentId}, + report_time = #{reportTime}, + report_reason = #{reportReason}, + status = #{status}, + report_type = #{reportType}, + result = #{result}, + + where report_id = #{reportId} + + + + delete from community_post_report where report_id = #{reportId} + + + + delete from community_post_report where report_id in + + #{reportId} + + + \ No newline at end of file diff --git a/inspur-ui/src/api/community/heat.js b/inspur-ui/src/api/community/heat.js new file mode 100644 index 0000000..21536be --- /dev/null +++ b/inspur-ui/src/api/community/heat.js @@ -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", + }); +} diff --git a/inspur-ui/src/api/community/like.js b/inspur-ui/src/api/community/like.js new file mode 100644 index 0000000..8de61cf --- /dev/null +++ b/inspur-ui/src/api/community/like.js @@ -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", + }); +} diff --git a/inspur-ui/src/api/community/reply.js b/inspur-ui/src/api/community/reply.js new file mode 100644 index 0000000..1dd92e2 --- /dev/null +++ b/inspur-ui/src/api/community/reply.js @@ -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", + }); +} diff --git a/inspur-ui/src/api/community/report.js b/inspur-ui/src/api/community/report.js new file mode 100644 index 0000000..16aa775 --- /dev/null +++ b/inspur-ui/src/api/community/report.js @@ -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", + }); +} diff --git a/inspur-ui/src/assets/icons/svg/comment.svg b/inspur-ui/src/assets/icons/svg/comment.svg new file mode 100644 index 0000000..bf19192 --- /dev/null +++ b/inspur-ui/src/assets/icons/svg/comment.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inspur-ui/src/assets/icons/svg/like.svg b/inspur-ui/src/assets/icons/svg/like.svg new file mode 100644 index 0000000..199799b --- /dev/null +++ b/inspur-ui/src/assets/icons/svg/like.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/inspur-ui/src/views/community/comment/InputComponent.vue b/inspur-ui/src/views/community/comment/InputComponent.vue index fcb6852..d29a768 100644 --- a/inspur-ui/src/views/community/comment/InputComponent.vue +++ b/inspur-ui/src/views/community/comment/InputComponent.vue @@ -70,7 +70,7 @@ export default { }, //传入input框的默认值 toId: { - type: Number, + type: String, }, //类型,end(文章末尾处), comment(评论里), type: { diff --git a/inspur-ui/src/views/community/comment/Ipcomment.vue b/inspur-ui/src/views/community/comment/Ipcomment.vue index d217f2b..488f1fe 100644 --- a/inspur-ui/src/views/community/comment/Ipcomment.vue +++ b/inspur-ui/src/views/community/comment/Ipcomment.vue @@ -27,15 +27,15 @@ 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节点 diff --git a/inspur-ui/src/views/community/comment/comments.vue b/inspur-ui/src/views/community/comment/comments.vue index 9b50ada..1416e1b 100644 --- a/inspur-ui/src/views/community/comment/comments.vue +++ b/inspur-ui/src/views/community/comment/comments.vue @@ -1,52 +1,93 @@ diff --git a/inspur-ui/src/views/community/forum/forumForm.vue b/inspur-ui/src/views/community/forum/forumForm.vue index ba78424..6a46bb2 100644 --- a/inspur-ui/src/views/community/forum/forumForm.vue +++ b/inspur-ui/src/views/community/forum/forumForm.vue @@ -1,35 +1,36 @@