From 6a9c997c5c7bcd27e62adbff50a30d0d107207d9 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Tue, 30 Apr 2024 15:57:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E7=BB=B4=E7=A4=BE=E5=8C=BA=E8=BF=90?= =?UTF-8?q?=E7=BB=B4=E8=AE=BA=E5=9D=9B=E8=B4=B4=E5=AD=90=E5=92=8C=E5=8F=91?= =?UTF-8?q?=E8=A1=A8=E5=B8=96=E5=AD=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inspur-service/inspur-admin/pom.xml | 7 +- .../CommunityPostInfoController.java | 118 +++++++++++ .../community/domain/CommunityPostInfo.java | 183 ++++++++++++++++++ .../domain/vo/CommunityPostInfoVO.java | 43 ++++ .../mapper/CommunityPostInfoMapper.java | 70 +++++++ .../service/ICommunityPostInfoService.java | 70 +++++++ .../impl/CommunityPostInfoServiceImpl.java | 113 +++++++++++ .../community/CommunityPostInfoMapper.xml | 111 +++++++++++ inspur-service/pom.xml | 12 ++ 9 files changed, 726 insertions(+), 1 deletion(-) create mode 100644 inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostInfoController.java create mode 100644 inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostInfo.java create mode 100644 inspur-service/inspur-community/src/main/java/com/inspur/community/domain/vo/CommunityPostInfoVO.java create mode 100644 inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostInfoMapper.java create mode 100644 inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostInfoService.java create mode 100644 inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java create mode 100644 inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostInfoMapper.xml diff --git a/inspur-service/inspur-admin/pom.xml b/inspur-service/inspur-admin/pom.xml index eed141b..263972a 100644 --- a/inspur-service/inspur-admin/pom.xml +++ b/inspur-service/inspur-admin/pom.xml @@ -84,7 +84,12 @@ 3.8.7 compile - + + com.inspur + inspur-community + 3.8.7 + compile + diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostInfoController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostInfoController.java new file mode 100644 index 0000000..c4f6f42 --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/community/CommunityPostInfoController.java @@ -0,0 +1,118 @@ +package com.inspur.web.controller.community; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.inspur.community.domain.vo.CommunityPostInfoVO; +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.CommunityPostInfo; +import com.inspur.community.service.ICommunityPostInfoService; +import com.inspur.common.utils.poi.ExcelUtil; +import com.inspur.common.core.page.TableDataInfo; + +/** + * 社区帖子信息Controller + * + * @author inspur + * @date 2024-04-26 + */ +@RestController +@RequestMapping("/community/info") +public class CommunityPostInfoController extends BaseController +{ + @Autowired + private ICommunityPostInfoService communityPostInfoService; + + /** + * 查询社区帖子信息列表 + */ + @PreAuthorize("@ss.hasPermi('community:info:list')") + @GetMapping("/list") + public TableDataInfo list(CommunityPostInfo communityPostInfo) + { + startPage(); + List list = communityPostInfoService.selectCommunityPostInfoList(communityPostInfo); + return getDataTable(list); + } + + /** + * 导出社区帖子信息列表 + */ + @PreAuthorize("@ss.hasPermi('community:info:export')") + @Log(title = "社区帖子信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, CommunityPostInfo communityPostInfo) + { + List list = communityPostInfoService.selectCommunityPostInfoList(communityPostInfo); + ExcelUtil util = new ExcelUtil(CommunityPostInfoVO.class); + util.exportExcel(response, list, "社区帖子信息数据"); + } + + /** + * 获取社区帖子信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('community:info:query')") + @GetMapping(value = "/{postId}") + public AjaxResult getInfo(@PathVariable("postId") String postId) + { + return success(communityPostInfoService.selectCommunityPostInfoByPostId(postId)); + } + + /** + * 新增社区帖子信息 + */ + @PreAuthorize("@ss.hasPermi('community:info:add')") + @Log(title = "社区帖子信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody CommunityPostInfo communityPostInfo) + { + return toAjax(communityPostInfoService.insertCommunityPostInfo(communityPostInfo)); + } + + + /** + * 修改社区帖子信息 + */ + @PreAuthorize("@ss.hasPermi('community:info:edit')") + @Log(title = "社区帖子信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody CommunityPostInfo communityPostInfo) + { + return toAjax(communityPostInfoService.updateCommunityPostInfo(communityPostInfo)); + } + + /** + * 添加浏览量 + */ + @Log(title = "社区帖子信息", businessType = BusinessType.UPDATE) + @PutMapping("/addViews/{postId}") + public AjaxResult addViews(@PathVariable("postId") String postId) + { + return toAjax(communityPostInfoService.addViews(postId)); + } + + /** + * 删除社区帖子信息 + */ + @PreAuthorize("@ss.hasPermi('community:info:remove')") + @Log(title = "社区帖子信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{postIds}") + public AjaxResult remove(@PathVariable String[] postIds) + { + return toAjax(communityPostInfoService.deleteCommunityPostInfoByPostIds(postIds)); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostInfo.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostInfo.java new file mode 100644 index 0000000..2552249 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/CommunityPostInfo.java @@ -0,0 +1,183 @@ +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_info + * + * @author zhangjunwen + * @date 2024-04-26 + */ +public class CommunityPostInfo extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private String postId; + + /** 帖子类型,0 经验交流 1 困难求助 2 观点吐槽 3 其他 */ + @Excel(name = "帖子类型,0 经验交流 1 困难求助 2 观点吐槽 3 其他") + private String postType; + + /** 运维领域:0故障机理、1信号采集方案、2信号处理方法、3维保策略 */ + @Excel(name = "运维领域:0故障机理、1信号采集方案、2信号处理方法、3维保策略") + private String omField; + + /** 运维行业:0 纺织,1 陶瓷,2 化工 */ + @Excel(name = "运维行业:0 纺织,1 陶瓷,2 化工") + private String omIndustry; + + /** 帖子标题 */ + @Excel(name = "帖子标题") + private String postTitle; + + /** 帖子内容 */ + @Excel(name = "帖子内容") + private String postContent; + + /** 发布时间 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss") + private Date postTime; + + /** 发布人 */ + @Excel(name = "发布人") + private Long userId; + + /** 最后编辑时间 */ + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @Excel(name = "最后编辑时间", width = 30, dateFormat = "yyyy-MM-dd hh:mm:ss") + private Date lastEditTime; + + /** + * 浏览量 + */ + private String views; + + /** 状态:0 正常;1 封禁;2 删除 */ + @Excel(name = "状态:0 正常;1 封禁;2 删除") + private String status; + + public void setPostId(String postId) + { + this.postId = postId; + } + + public String getPostId() + { + return postId; + } + public void setPostType(String postType) + { + this.postType = postType; + } + + public String getPostType() + { + return postType; + } + public void setOmField(String omField) + { + this.omField = omField; + } + + public String getOmField() + { + return omField; + } + public void setOmIndustry(String omIndustry) + { + this.omIndustry = omIndustry; + } + + public String getOmIndustry() + { + return omIndustry; + } + public void setPostTitle(String postTitle) + { + this.postTitle = postTitle; + } + + public String getPostTitle() + { + return postTitle; + } + public void setPostContent(String postContent) + { + this.postContent = postContent; + } + + public String getPostContent() + { + return postContent; + } + public void setPostTime(Date postTime) + { + this.postTime = postTime; + } + + public Date getPostTime() + { + return postTime; + } + public void setUserId(Long userId) + { + this.userId = userId; + } + + public Long getUserId() + { + return userId; + } + public void setLastEditTime(Date lastEditTime) + { + this.lastEditTime = lastEditTime; + } + + public Date getLastEditTime() + { + return lastEditTime; + } + + public String getViews() { + return views; + } + + public void setViews(String views) { + this.views = views; + } + + 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("postId", getPostId()) + .append("postType", getPostType()) + .append("omField", getOmField()) + .append("omIndustry", getOmIndustry()) + .append("postTitle", getPostTitle()) + .append("postContent", getPostContent()) + .append("postTime", getPostTime()) + .append("userId", getUserId()) + .append("lastEditTime", getLastEditTime()) + .append("views", getViews()) + .append("status", getStatus()) + .toString(); + } +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/vo/CommunityPostInfoVO.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/vo/CommunityPostInfoVO.java new file mode 100644 index 0000000..e480966 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/domain/vo/CommunityPostInfoVO.java @@ -0,0 +1,43 @@ +package com.inspur.community.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.inspur.common.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * @Author zhangjunwen + * @create 2024/4/30 + */ +@Data +public class CommunityPostInfoVO { + + private String postId; + + private String postType; + + private String omField; + + private String omIndustry; + + private String postTitle; + + private String postContent; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date postTime; + + private Long userId; + + private String userName; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date lastEditTime; + + private long views; + + private String status; + + +} diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostInfoMapper.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostInfoMapper.java new file mode 100644 index 0000000..52cb930 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/mapper/CommunityPostInfoMapper.java @@ -0,0 +1,70 @@ +package com.inspur.community.mapper; + +import java.util.List; +import com.inspur.community.domain.CommunityPostInfo; +import com.inspur.community.domain.vo.CommunityPostInfoVO; + +/** + * 社区帖子信息Mapper接口 + * + * @author inspur + * @date 2024-04-26 + */ +public interface CommunityPostInfoMapper +{ + /** + * 查询社区帖子信息 + * + * @param postId 社区帖子信息主键 + * @return 社区帖子信息 + */ + public CommunityPostInfoVO selectCommunityPostInfoByPostId(String postId); + + /** + * 查询社区帖子信息列表 + * + * @param communityPostInfo 社区帖子信息 + * @return 社区帖子信息集合 + */ + public List selectCommunityPostInfoList(CommunityPostInfo communityPostInfo); + + /** + * 新增社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + public int insertCommunityPostInfo(CommunityPostInfo communityPostInfo); + + /** + * 修改社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + public int updateCommunityPostInfo(CommunityPostInfo communityPostInfo); + + /** + * 添加浏览量 + * @param postId + * @return + */ + public int addViews(String postId); + + /** + * 删除社区帖子信息 + * + * @param postId 社区帖子信息主键 + * @return 结果 + */ + public int deleteCommunityPostInfoByPostId(String postId); + + /** + * 批量删除社区帖子信息 + * + * @param postIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteCommunityPostInfoByPostIds(String[] postIds); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostInfoService.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostInfoService.java new file mode 100644 index 0000000..2d7c1b5 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/ICommunityPostInfoService.java @@ -0,0 +1,70 @@ +package com.inspur.community.service; + +import java.util.List; +import com.inspur.community.domain.CommunityPostInfo; +import com.inspur.community.domain.vo.CommunityPostInfoVO; + +/** + * 社区帖子信息Service接口 + * + * @author zhangjunwen + * @date 2024-04-26 + */ +public interface ICommunityPostInfoService +{ + /** + * 查询社区帖子信息 + * + * @param postId 社区帖子信息主键 + * @return 社区帖子信息 + */ + public CommunityPostInfoVO selectCommunityPostInfoByPostId(String postId); + + /** + * 查询社区帖子信息列表 + * + * @param communityPostInfo 社区帖子信息 + * @return 社区帖子信息集合 + */ + public List selectCommunityPostInfoList(CommunityPostInfo communityPostInfo); + + /** + * 新增社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + public int insertCommunityPostInfo(CommunityPostInfo communityPostInfo); + + /** + * 修改社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + public int updateCommunityPostInfo(CommunityPostInfo communityPostInfo); + + /** + * 添加浏览量 + * @param postId + * @return + */ + public int addViews(String postId); + + /** + * 批量删除社区帖子信息 + * + * @param postIds 需要删除的社区帖子信息主键集合 + * @return 结果 + */ + public int deleteCommunityPostInfoByPostIds(String[] postIds); + + /** + * 删除社区帖子信息信息 + * + * @param postId 社区帖子信息主键 + * @return 结果 + */ + public int deleteCommunityPostInfoByPostId(String postId); +} + diff --git a/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java new file mode 100644 index 0000000..f44d830 --- /dev/null +++ b/inspur-service/inspur-community/src/main/java/com/inspur/community/service/impl/CommunityPostInfoServiceImpl.java @@ -0,0 +1,113 @@ +package com.inspur.community.service.impl; + +import java.util.Date; +import java.util.List; + +import com.inspur.common.utils.SecurityUtils; +import com.inspur.common.utils.uuid.IdUtils; +import com.inspur.community.domain.vo.CommunityPostInfoVO; +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; + +/** + * 社区帖子信息Service业务层处理 + * + * @author zhangjunwen + * @date 2024-04-26 + */ +@Service +public class CommunityPostInfoServiceImpl implements ICommunityPostInfoService +{ + @Autowired + private CommunityPostInfoMapper communityPostInfoMapper; + + /** + * 查询社区帖子信息 + * + * @param postId 社区帖子信息主键 + * @return 社区帖子信息 + */ + @Override + public CommunityPostInfoVO selectCommunityPostInfoByPostId(String postId) + { + return communityPostInfoMapper.selectCommunityPostInfoByPostId(postId); + } + + /** + * 查询社区帖子信息列表 + * + * @param communityPostInfo 社区帖子信息 + * @return 社区帖子信息 + */ + @Override + public List selectCommunityPostInfoList(CommunityPostInfo communityPostInfo) + { + return communityPostInfoMapper.selectCommunityPostInfoList(communityPostInfo); + } + + /** + * 新增社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + @Override + public int insertCommunityPostInfo(CommunityPostInfo communityPostInfo) + { + communityPostInfo.setPostId(IdUtils.simpleUUID()); + communityPostInfo.setPostTime(new Date()); + communityPostInfo.setUserId(SecurityUtils.getUserId()); + return communityPostInfoMapper.insertCommunityPostInfo(communityPostInfo); + } + + /** + * 修改社区帖子信息 + * + * @param communityPostInfo 社区帖子信息 + * @return 结果 + */ + @Override + public int updateCommunityPostInfo(CommunityPostInfo communityPostInfo) + { + communityPostInfo.setLastEditTime(new Date()); + return communityPostInfoMapper.updateCommunityPostInfo(communityPostInfo); + } + + /** + * 添加浏览量 + * @param postId + * @return + */ + @Override + public int addViews(String postId){ + return communityPostInfoMapper.addViews(postId); + } + + /** + * 批量删除社区帖子信息 + * + * @param postIds 需要删除的社区帖子信息主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostInfoByPostIds(String[] postIds) + { + return communityPostInfoMapper.deleteCommunityPostInfoByPostIds(postIds); + } + + /** + * 删除社区帖子信息信息 + * + * @param postId 社区帖子信息主键 + * @return 结果 + */ + @Override + public int deleteCommunityPostInfoByPostId(String postId) + { + return communityPostInfoMapper.deleteCommunityPostInfoByPostId(postId); + } +} + diff --git a/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostInfoMapper.xml b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostInfoMapper.xml new file mode 100644 index 0000000..6a02a37 --- /dev/null +++ b/inspur-service/inspur-community/src/main/resources/mapper/community/CommunityPostInfoMapper.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + select post_id, post_type, om_field, om_industry, post_title, post_content, post_time, a.user_id, last_edit_time,views, a.status, b.nick_name as user_name from community_post_info a + left join sys_user b on a.user_id = b.user_id + + + + + + + + insert into community_post_info + + post_id, + post_type, + om_field, + om_industry, + post_title, + post_content, + post_time, + user_id, + last_edit_time, + views, + mstatus, + + + #{postId}, + #{postType}, + #{omField}, + #{omIndustry}, + #{postTitle}, + #{postContent}, + #{postTime}, + #{userId}, + #{lastEditTime}, + #{views}, + #{status}, + + + + + update community_post_info + + post_type = #{postType}, + om_field = #{omField}, + om_industry = #{omIndustry}, + post_title = #{postTitle}, + post_content = #{postContent}, + post_time = #{postTime}, + user_id = #{userId}, + last_edit_time = #{lastEditTime}, + views = #{views}, + status = #{status}, + + where post_id = #{postId} + + + + + update community_post_info set views = views + 1 where post_id = #{postId} + + + + delete from community_post_info where post_id = #{postId} + + + + delete from community_post_info where post_id in + + #{postId} + + + \ No newline at end of file diff --git a/inspur-service/pom.xml b/inspur-service/pom.xml index f4dc1bf..0bfe7df 100644 --- a/inspur-service/pom.xml +++ b/inspur-service/pom.xml @@ -174,6 +174,17 @@ inspur-order ${inspur.version} + + + com.inspur + inspur-community + ${inspur.version} + + + com.inspur + inspur-knowledgeBase + ${inspur.version} + @@ -186,6 +197,7 @@ inspur-common inspur-om inspur-order + inspur-community inspur-knowledgeBase inspur-operations