From d7bd217571a75558dff24f9e967919fd4d42eee0 Mon Sep 17 00:00:00 2001 From: ma-zhongxu Date: Tue, 20 Jan 2026 15:16:22 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=89=A7=E6=88=B7=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E5=8C=BA=E5=88=92=E8=8A=82=E7=82=B9=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=202.=E7=AE=A1=E7=90=86=E7=AB=AF=E5=92=A8=E8=AF=A2?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E5=8A=9F=E8=83=BD=203.=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=96=B0svg=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/muhu/MuhuUserController.java | 38 ++ .../system/SysInfoReleaseController.java | 126 +++++ .../chenhai/system/domain/SysInfoRelease.java | 117 +++++ .../system/mapper/SysInfoReleaseMapper.java | 77 +++ .../service/ISysInfoReleaseService.java | 78 ++++ .../impl/SysInfoReleaseServiceImpl.java | 136 ++++++ .../mapper/system/SysInfoReleaseMapper.xml | 119 +++++ chenhai-ui/src/api/system/infoRelease.js | 61 +++ .../src/assets/icons/svg/infoRelease.svg | 1 + .../src/views/system/infoRelease/index.vue | 441 ++++++++++++++++++ 10 files changed, 1194 insertions(+) create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java create mode 100644 chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysInfoReleaseController.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/domain/SysInfoRelease.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/mapper/SysInfoReleaseMapper.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/service/ISysInfoReleaseService.java create mode 100644 chenhai-system/src/main/java/com/chenhai/system/service/impl/SysInfoReleaseServiceImpl.java create mode 100644 chenhai-system/src/main/resources/mapper/system/SysInfoReleaseMapper.xml create mode 100644 chenhai-ui/src/api/system/infoRelease.js create mode 100644 chenhai-ui/src/assets/icons/svg/infoRelease.svg create mode 100644 chenhai-ui/src/views/system/infoRelease/index.vue diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java new file mode 100644 index 0000000..a3e47a1 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/muhu/MuhuUserController.java @@ -0,0 +1,38 @@ +package com.chenhai.web.controller.muhu; + +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.core.domain.entity.SysArea; +import com.chenhai.system.service.ISysAreaService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @author : mazhongxu + * @date : 2026-01-14 17:08 + * @modyified By : + */ +@RestController +@RequestMapping("/muhu/user") +public class MuhuUserController extends BaseController +{ + + @Autowired + private ISysAreaService sysAreaService; + + @PreAuthorize("@ss.hasRole('muhu')") + @GetMapping("/areaChildren") + public AjaxResult getAreaChildren(@RequestParam(value = "parentCode", required = false, defaultValue = "152900") String parentCode) { + SysArea query = new SysArea(); + query.setParentCode(parentCode); + query.setDeleted(0); + List list = sysAreaService.selectSysAreaList(query); + return success(list); + } +} diff --git a/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysInfoReleaseController.java b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysInfoReleaseController.java new file mode 100644 index 0000000..d6eed14 --- /dev/null +++ b/chenhai-admin/src/main/java/com/chenhai/web/controller/system/SysInfoReleaseController.java @@ -0,0 +1,126 @@ +package com.chenhai.web.controller.system; + +import java.util.List; +import jakarta.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.chenhai.common.annotation.Log; +import com.chenhai.common.core.controller.BaseController; +import com.chenhai.common.core.domain.AjaxResult; +import com.chenhai.common.enums.BusinessType; +import com.chenhai.system.domain.SysInfoRelease; +import com.chenhai.system.service.ISysInfoReleaseService; +import com.chenhai.common.utils.poi.ExcelUtil; +import com.chenhai.common.core.page.TableDataInfo; + +/** + * 资讯发布Controller + * + * @author ruoyi + * @date 2026-01-19 + */ +@RestController +@RequestMapping("/system/infoRelease") +public class SysInfoReleaseController extends BaseController +{ + @Autowired + private ISysInfoReleaseService sysInfoReleaseService; + + /** + * 查询资讯发布列表 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:list')") + @GetMapping("/list") + public TableDataInfo list(SysInfoRelease sysInfoRelease) + { + startPage(); + List list = sysInfoReleaseService.selectSysInfoReleaseList(sysInfoRelease); + return getDataTable(list); + } + + /** + * 导出资讯发布列表 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:export')") + @Log(title = "资讯发布", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, SysInfoRelease sysInfoRelease) + { + List list = sysInfoReleaseService.selectSysInfoReleaseList(sysInfoRelease); + ExcelUtil util = new ExcelUtil(SysInfoRelease.class); + util.exportExcel(response, list, "资讯发布数据"); + } + + /** + * 获取资讯发布详细信息 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return success(sysInfoReleaseService.selectSysInfoReleaseById(id)); + } + + /** + * 新增资讯发布 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:add')") + @Log(title = "资讯发布", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody SysInfoRelease sysInfoRelease) + { + return toAjax(sysInfoReleaseService.insertSysInfoRelease(sysInfoRelease)); + } + + /** + * 修改资讯发布 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:edit')") + @Log(title = "资讯发布", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody SysInfoRelease sysInfoRelease) + { + return toAjax(sysInfoReleaseService.updateSysInfoRelease(sysInfoRelease)); + } + + /** + * 删除资讯发布 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:remove')") + @Log(title = "资讯发布", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(sysInfoReleaseService.deleteSysInfoReleaseByIds(ids)); + } + + /** + * 上架资讯 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:publish')") + @Log(title = "资讯发布", businessType = BusinessType.UPDATE) + @PutMapping("/publish/{id}") + public AjaxResult publish(@PathVariable Long id) + { + return toAjax(sysInfoReleaseService.publishSysInfoRelease(id)); + } + + /** + * 下架资讯 + */ + @PreAuthorize("@ss.hasPermi('system:infoRelease:remove')") + @Log(title = "资讯发布", businessType = BusinessType.UPDATE) + @PutMapping("/remove/{id}") + public AjaxResult remove(@PathVariable Long id, @RequestBody(required = false) String removalReason) + { + return toAjax(sysInfoReleaseService.removeSysInfoRelease(id, removalReason)); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/domain/SysInfoRelease.java b/chenhai-system/src/main/java/com/chenhai/system/domain/SysInfoRelease.java new file mode 100644 index 0000000..8ce1d22 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/domain/SysInfoRelease.java @@ -0,0 +1,117 @@ +package com.chenhai.system.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.chenhai.common.annotation.Excel; +import com.chenhai.common.core.domain.BaseEntity; + +/** + * 资讯发布对象 sys_info_release + * + * @author ruoyi + * @date 2026-01-19 + */ +public class SysInfoRelease extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 标题 */ + @Excel(name = "标题") + private String title; + + /** 内容 */ + @Excel(name = "内容") + private String content; + + /** 分类 */ + @Excel(name = "分类") + private String category; + + /** 上架状态(0-未上架 1-已上架) */ + @Excel(name = "上架状态(0-未上架 1-已上架)") + private String publishStatus; + + /** + * 下架原因 + * @param + */ + @Excel(name = "下架原因") + private String removalReason; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + public void setCategory(String category) + { + this.category = category; + } + + public String getCategory() + { + return category; + } + + public void setPublishStatus(String publishStatus) + { + this.publishStatus = publishStatus; + } + + public String getPublishStatus() + { + return publishStatus; + } + + public String getRemovalReason() { + return removalReason; + } + + public void setRemovalReason(String removalReason) { + this.removalReason = removalReason; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("title", getTitle()) + .append("content", getContent()) + .append("category", getCategory()) + .append("publishStatus", getPublishStatus()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("remark", getRemark()) + .toString(); + } +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/mapper/SysInfoReleaseMapper.java b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysInfoReleaseMapper.java new file mode 100644 index 0000000..45d3558 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/mapper/SysInfoReleaseMapper.java @@ -0,0 +1,77 @@ +package com.chenhai.system.mapper; + +import java.util.List; +import com.chenhai.system.domain.SysInfoRelease; + +/** + * 资讯发布Mapper接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface SysInfoReleaseMapper +{ + /** + * 查询资讯发布 + * + * @param id 资讯发布主键 + * @return 资讯发布 + */ + public SysInfoRelease selectSysInfoReleaseById(Long id); + + /** + * 查询资讯发布列表 + * + * @param sysInfoRelease 资讯发布 + * @return 资讯发布集合 + */ + public List selectSysInfoReleaseList(SysInfoRelease sysInfoRelease); + + /** + * 新增资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int insertSysInfoRelease(SysInfoRelease sysInfoRelease); + + /** + * 修改资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int updateSysInfoRelease(SysInfoRelease sysInfoRelease); + + /** + * 删除资讯发布 + * + * @param id 资讯发布主键 + * @return 结果 + */ + public int deleteSysInfoReleaseById(Long id); + + /** + * 批量删除资讯发布 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteSysInfoReleaseByIds(Long[] ids); + + /** + * 上架资讯 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int publishSysInfoRelease(SysInfoRelease sysInfoRelease); + + /** + * 下架资讯 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int removeSysInfoRelease(SysInfoRelease sysInfoRelease); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/ISysInfoReleaseService.java b/chenhai-system/src/main/java/com/chenhai/system/service/ISysInfoReleaseService.java new file mode 100644 index 0000000..8b942a1 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/ISysInfoReleaseService.java @@ -0,0 +1,78 @@ +package com.chenhai.system.service; + +import java.util.List; +import com.chenhai.system.domain.SysInfoRelease; + +/** + * 资讯发布Service接口 + * + * @author ruoyi + * @date 2026-01-19 + */ +public interface ISysInfoReleaseService +{ + /** + * 查询资讯发布 + * + * @param id 资讯发布主键 + * @return 资讯发布 + */ + public SysInfoRelease selectSysInfoReleaseById(Long id); + + /** + * 查询资讯发布列表 + * + * @param sysInfoRelease 资讯发布 + * @return 资讯发布集合 + */ + public List selectSysInfoReleaseList(SysInfoRelease sysInfoRelease); + + /** + * 新增资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int insertSysInfoRelease(SysInfoRelease sysInfoRelease); + + /** + * 修改资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + public int updateSysInfoRelease(SysInfoRelease sysInfoRelease); + + /** + * 批量删除资讯发布 + * + * @param ids 需要删除的资讯发布主键集合 + * @return 结果 + */ + public int deleteSysInfoReleaseByIds(Long[] ids); + + /** + * 删除资讯发布信息 + * + * @param id 资讯发布主键 + * @return 结果 + */ + public int deleteSysInfoReleaseById(Long id); + + /** + * 上架资讯 + * + * @param id 资讯发布主键 + * @return 结果 + */ + public int publishSysInfoRelease(Long id); + + /** + * 下架资讯 + * + * @param id 资讯发布主键 + * @param removalReason 下架原因 + * @return 结果 + */ + public int removeSysInfoRelease(Long id, String removalReason); +} diff --git a/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysInfoReleaseServiceImpl.java b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysInfoReleaseServiceImpl.java new file mode 100644 index 0000000..3a189f2 --- /dev/null +++ b/chenhai-system/src/main/java/com/chenhai/system/service/impl/SysInfoReleaseServiceImpl.java @@ -0,0 +1,136 @@ +package com.chenhai.system.service.impl; + +import java.util.List; +import com.chenhai.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.chenhai.system.mapper.SysInfoReleaseMapper; +import com.chenhai.system.domain.SysInfoRelease; +import com.chenhai.system.service.ISysInfoReleaseService; +import org.springframework.transaction.annotation.Transactional; + +/** + * 资讯发布Service业务层处理 + * + * @author ruoyi + * @date 2026-01-19 + */ +@Service +public class SysInfoReleaseServiceImpl implements ISysInfoReleaseService +{ + @Autowired + private SysInfoReleaseMapper sysInfoReleaseMapper; + + /** + * 查询资讯发布 + * + * @param id 资讯发布主键 + * @return 资讯发布 + */ + @Override + public SysInfoRelease selectSysInfoReleaseById(Long id) + { + return sysInfoReleaseMapper.selectSysInfoReleaseById(id); + } + + /** + * 查询资讯发布列表 + * + * @param sysInfoRelease 资讯发布 + * @return 资讯发布 + */ + @Override + public List selectSysInfoReleaseList(SysInfoRelease sysInfoRelease) + { + return sysInfoReleaseMapper.selectSysInfoReleaseList(sysInfoRelease); + } + + /** + * 新增资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + @Override + public int insertSysInfoRelease(SysInfoRelease sysInfoRelease) + { + sysInfoRelease.setCreateTime(DateUtils.getNowDate()); + sysInfoRelease.setPublishStatus("0"); + return sysInfoReleaseMapper.insertSysInfoRelease(sysInfoRelease); + } + + /** + * 修改资讯发布 + * + * @param sysInfoRelease 资讯发布 + * @return 结果 + */ + @Override + public int updateSysInfoRelease(SysInfoRelease sysInfoRelease) + { + sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); + return sysInfoReleaseMapper.updateSysInfoRelease(sysInfoRelease); + } + + /** + * 批量删除资讯发布 + * + * @param ids 需要删除的资讯发布主键 + * @return 结果 + */ + @Override + public int deleteSysInfoReleaseByIds(Long[] ids) + { + return sysInfoReleaseMapper.deleteSysInfoReleaseByIds(ids); + } + + /** + * 删除资讯发布信息 + * + * @param id 资讯发布主键 + * @return 结果 + */ + @Override + public int deleteSysInfoReleaseById(Long id) + { + return sysInfoReleaseMapper.deleteSysInfoReleaseById(id); + } + + /** + * 上架资讯 + * + * @param id 资讯发布主键 + * @return 结果 + */ + @Override + @Transactional + public int publishSysInfoRelease(Long id) + { + SysInfoRelease sysInfoRelease = new SysInfoRelease(); + sysInfoRelease.setId(id); + sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); + + // 调用独立的上架方法 + return sysInfoReleaseMapper.publishSysInfoRelease(sysInfoRelease); + } + + /** + * 下架资讯 + * + * @param id 资讯发布主键 + * @param removalReason 下架原因 + * @return 结果 + */ + @Override + @Transactional + public int removeSysInfoRelease(Long id, String removalReason) + { + SysInfoRelease sysInfoRelease = new SysInfoRelease(); + sysInfoRelease.setId(id); + sysInfoRelease.setRemovalReason(removalReason); + sysInfoRelease.setUpdateTime(DateUtils.getNowDate()); + + // 调用独立的下架方法 + return sysInfoReleaseMapper.removeSysInfoRelease(sysInfoRelease); + } +} diff --git a/chenhai-system/src/main/resources/mapper/system/SysInfoReleaseMapper.xml b/chenhai-system/src/main/resources/mapper/system/SysInfoReleaseMapper.xml new file mode 100644 index 0000000..2330cfc --- /dev/null +++ b/chenhai-system/src/main/resources/mapper/system/SysInfoReleaseMapper.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + select id, title, content, category, publish_status, removal_reason, create_by, create_time, update_by, update_time, remark from sys_info_release + + + + + + + + insert into sys_info_release + + title, + content, + category, + publish_status, + removal_reason, + create_by, + create_time, + update_by, + update_time, + remark, + + + #{title}, + #{content}, + #{category}, + #{publishStatus}, + #{removalReason}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{remark}, + + + + + update sys_info_release + + title = #{title}, + content = #{content}, + category = #{category}, + publish_status = #{publishStatus}, + removal_reason = #{removalReason}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + remark = #{remark}, + + where id = #{id} + + + + + update sys_info_release + set publish_status = '1', + removal_reason = null, + update_time = #{updateTime} + where id = #{id} + + + + + update sys_info_release + set publish_status = '0', + + removal_reason = #{removalReason}, + + + removal_reason = null, + + update_time = #{updateTime} + where id = #{id} + + + + delete from sys_info_release where id = #{id} + + + + delete from sys_info_release where id in + + #{id} + + + \ No newline at end of file diff --git a/chenhai-ui/src/api/system/infoRelease.js b/chenhai-ui/src/api/system/infoRelease.js new file mode 100644 index 0000000..7d2cc4e --- /dev/null +++ b/chenhai-ui/src/api/system/infoRelease.js @@ -0,0 +1,61 @@ +import request from '@/utils/request' + +// 查询资讯发布列表 +export function listInfoRelease(query) { + return request({ + url: '/system/infoRelease/list', + method: 'get', + params: query + }) +} + +// 查询资讯发布详细 +export function getInfoRelease(id) { + return request({ + url: '/system/infoRelease/' + id, + method: 'get' + }) +} + +// 新增资讯发布 +export function addInfoRelease(data) { + return request({ + url: '/system/infoRelease', + method: 'post', + data: data + }) +} + +// 修改资讯发布 +export function updateInfoRelease(data) { + return request({ + url: '/system/infoRelease', + method: 'put', + data: data + }) +} + +// 删除资讯发布 +export function delInfoRelease(id) { + return request({ + url: '/system/infoRelease/' + id, + method: 'delete' + }) +} + +// 上架资讯发布 +export function publishInfoRelease(id) { + return request({ + url: '/system/infoRelease/publish/' + id, + method: 'put' + }) +} + +// 下架资讯发布 +export function removeInfoRelease(id, removalReason) { + return request({ + url: '/system/infoRelease/remove/' + id, + method: 'put', + data: removalReason + }) +} diff --git a/chenhai-ui/src/assets/icons/svg/infoRelease.svg b/chenhai-ui/src/assets/icons/svg/infoRelease.svg new file mode 100644 index 0000000..ebb718b --- /dev/null +++ b/chenhai-ui/src/assets/icons/svg/infoRelease.svg @@ -0,0 +1 @@ + diff --git a/chenhai-ui/src/views/system/infoRelease/index.vue b/chenhai-ui/src/views/system/infoRelease/index.vue new file mode 100644 index 0000000..0e798f8 --- /dev/null +++ b/chenhai-ui/src/views/system/infoRelease/index.vue @@ -0,0 +1,441 @@ + + + + +