From e00a55efad51dfb54f658b54b52f5d3ab13b982d Mon Sep 17 00:00:00 2001 From: gognqingkai <1825346742@qq.com> Date: Tue, 16 Apr 2024 15:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E8=AE=AF=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E8=B5=84=E8=AE=AF=E4=BF=A1=E6=81=AF=E5=92=8C=E8=B5=84=E8=AE=AF?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=AE=9E=E7=8E=B0=20add=20by=20gqk=202024/04?= =?UTF-8?q?/16=2015:29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 7 +- .../common/config/SystemBusinessConfig.java | 13 + .../com/xinelu/common/constant/Constants.java | 15 ++ .../xinelu/common/utils/file/FileUtils.java | 50 ++++ .../controller/info/InfoController.java | 113 +++++++++ .../infocategory/InfoCategoryController.java | 104 ++++++++ .../com/xinelu/manage/domain/info/Info.java | 152 ++++++++++++ .../domain/infocategory/InfoCategory.java | 81 +++++++ .../dto/infocategory/InfoCategoryDTO.java | 17 ++ .../xinelu/manage/mapper/info/InfoMapper.java | 72 ++++++ .../infocategory/InfoCategoryMapper.java | 94 ++++++++ .../manage/service/info/IInfoService.java | 70 ++++++ .../service/info/impl/InfoServiceImpl.java | 225 ++++++++++++++++++ .../infocategory/IInfoCategoryService.java | 65 +++++ .../impl/InfoCategoryServiceImpl.java | 157 ++++++++++++ .../mapper/manage/info/InfoMapper.xml | 223 +++++++++++++++++ .../infocategory/InfoCategoryMapper.xml | 166 +++++++++++++ .../controller/info/MobileInfoController.java | 39 +++ 18 files changed, 1660 insertions(+), 3 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/controller/info/InfoController.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/controller/infocategory/InfoCategoryController.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/domain/info/Info.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/domain/infocategory/InfoCategory.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/infocategory/InfoCategoryDTO.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/mapper/info/InfoMapper.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/mapper/infocategory/InfoCategoryMapper.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/info/IInfoService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/info/impl/InfoServiceImpl.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/IInfoCategoryService.java create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/impl/InfoCategoryServiceImpl.java create mode 100644 postdischarge-manage/src/main/resources/mapper/manage/info/InfoMapper.xml create mode 100644 postdischarge-manage/src/main/resources/mapper/manage/infocategory/InfoCategoryMapper.xml create mode 100644 postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/info/MobileInfoController.java diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index c6131886..e7173d4d 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -26,6 +26,8 @@ xinelu: script-file-url: /scriptFileUrl # 获取管理端富文本的上传路径 rich-text-picture-url: /richTextPictureUrl + # 资讯富文本的上传路径 + info-rich-text-picture-url: /infoRichTextPictureUrl # 开发环境配置 server: @@ -80,7 +82,7 @@ spring: # 数据库索引 database: 6 # 密码 - password: xinelu@6990 + password: 123456 # 连接超时时间 timeout: 10s lettuce: @@ -103,8 +105,7 @@ token: # 令牌有效期(默认30分钟) expireTime: 30 # 请求拦截白名单 - ant-matchers: /postDischarge/**,/testMobile/** - + ant-matchers: /postDischarge/**,/testMobile/**,/mobile/** ## MyBatis-Plus配置 mybatis-plus: # 实体扫描,多个package用逗号或者分号分隔 diff --git a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java index a58a3a17..b9ae64c3 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/config/SystemBusinessConfig.java @@ -71,6 +71,11 @@ public class SystemBusinessConfig { */ private String scriptFileUrl; + /** + * 资讯图片地址 + */ + private String infoRichTextPictureUrl; + /** * 获取管理端富文本的上传路径 */ @@ -206,4 +211,12 @@ public class SystemBusinessConfig { public void setRichTextPictureUrl(String richTextPictureUrl) { this.richTextPictureUrl = richTextPictureUrl; } + + public String getInfoRichTextPictureUrl() { + return infoRichTextPictureUrl; + } + + public void setInfoRichTextPictureUrl(String infoRichTextPictureUrl) { + this.infoRichTextPictureUrl = infoRichTextPictureUrl; + } } diff --git a/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java b/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java index 9ae03f9a..5f9a2e81 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/constant/Constants.java @@ -283,4 +283,19 @@ public class Constants { * 成功 */ public static final int SUCCESS_ERROR_CODE = 0; + + /** + * 资讯分类编码前缀 + */ + public static final String INFO_CATEGORY_CODE = "ICC"; + + /** + * 资讯编码前缀 + */ + public static final String INFO_CODE = "IC"; + + /** + * 科室编码前缀 + */ + public static final String DEPARTMENT_CODE = "HDC"; } diff --git a/postdischarge-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java b/postdischarge-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java index e90126b7..131966d3 100644 --- a/postdischarge-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java +++ b/postdischarge-common/src/main/java/com/xinelu/common/utils/file/FileUtils.java @@ -4,6 +4,7 @@ import com.xinelu.common.config.SystemBusinessConfig; import com.xinelu.common.utils.DateUtils; import com.xinelu.common.utils.StringUtils; import com.xinelu.common.utils.uuid.IdUtils; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; @@ -13,6 +14,10 @@ import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; /** * 文件处理工具类 @@ -22,6 +27,16 @@ import java.nio.charset.StandardCharsets; public class FileUtils { public static String FILENAME_PATTERN = "[a-zA-Z0-9_\\-\\|\\.\\u4e00-\\u9fa5]+"; + /** + * 匹配content中的标签 + **/ + private static final String PATTEN_IMG = "<(img|IMG)(.*?)(/>|>|>)"; + + /** + * 匹配标签中的src + **/ + private static final String PATTEN_SRC = "(src|SRC)=(\"|\')(.*?)(\"|\')"; + /** * 输出指定文件的byte数组 * @@ -243,4 +258,39 @@ public class FileUtils { return baseName; } + /** + * 获取img标签中的src值 + * + * @param content img的内容 + * @return List + */ + public static List getImgSrc(String content) { + if (StringUtils.isBlank(content)) { + return Lists.newArrayList(); + } + List list = new ArrayList<>(); + //开始匹配content中的标签 + Pattern pImg = Pattern.compile(PATTEN_IMG); + Matcher mImg = pImg.matcher(content); + boolean resultImg = mImg.find(); + if (resultImg) { + while (resultImg) { + //获取到匹配的标签中的内容 + String strImg = mImg.group(2); + //开始匹配标签中的src + Pattern pSrc = Pattern.compile(PATTEN_SRC); + Matcher mSrc = pSrc.matcher(strImg); + if (mSrc.find()) { + String strSrc = mSrc.group(3); + if (StringUtils.isNotBlank(strSrc)) { + list.add(strSrc); + } + } + //匹配content中是否存在下一个标签,有则继续以上步骤匹配标签中的src + resultImg = mImg.find(); + } + } + return list; + } + } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/info/InfoController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/info/InfoController.java new file mode 100644 index 00000000..5d88d86f --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/info/InfoController.java @@ -0,0 +1,113 @@ +package com.xinelu.manage.controller.info; + +import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import com.xinelu.manage.service.infocategory.IInfoCategoryService; +import lombok.extern.slf4j.Slf4j; +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.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.manage.domain.info.Info; +import com.xinelu.manage.service.info.IInfoService; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 资讯信息Controller + * + * @author xinelu + * @date 2024-04-11 + */ +@Slf4j +@RestController +@RequestMapping("/manage/info") +public class InfoController extends BaseController { + @Resource + private IInfoService infoService; + @Resource + private IInfoCategoryService infoCategoryService; + + /** + * 查询资讯信息列表 + */ + @PreAuthorize("@ss.hasPermi('manage:info:list')") + @GetMapping("/list") + public TableDataInfo list(Info info) { + startPage(); + List list = infoService.selectInfoList(info); + return getDataTable(list); + } + + /** + * 导出资讯信息列表 + */ + @PreAuthorize("@ss.hasPermi('manage:info:export')") + @Log(title = "资讯信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, Info info) { + List list = infoService.selectInfoList(info); + ExcelUtil util = new ExcelUtil<>(Info.class); + util.exportExcel(response, list, "资讯信息数据"); + } + + /** + * 获取资讯信息详细信息 + */ + @PreAuthorize("@ss.hasPermi('manage:info:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(infoService.selectInfoById(id)); + } + + /** + * 新增资讯信息 + */ + @PreAuthorize("@ss.hasPermi('manage:info:add')") + @Log(title = "资讯信息", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody Info info) { + return toAjax(infoService.insertInfo(info)); + } + + /** + * 修改资讯信息 + */ + @PreAuthorize("@ss.hasPermi('manage:info:edit')") + @Log(title = "资讯信息", businessType = BusinessType.UPDATE) + @PutMapping("/edit") + public AjaxResult edit(@RequestBody Info info) { + return infoService.updateInfo(info); + } + + /** + * 删除资讯信息 + */ + @PreAuthorize("@ss.hasPermi('manage:info:remove')") + @Log(title = "资讯信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return infoService.deleteInfoByIds(ids); + } + + + @Log(title = "图片文件上传", businessType = BusinessType.OTHER) + @PostMapping("/picUpload") + public AjaxResult picUpload(@RequestBody MultipartFile file) { + + return infoService.picUpload(file); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/infocategory/InfoCategoryController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/infocategory/InfoCategoryController.java new file mode 100644 index 00000000..f0aae087 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/infocategory/InfoCategoryController.java @@ -0,0 +1,104 @@ +package com.xinelu.manage.controller.infocategory; + +import java.util.List; +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import com.xinelu.common.custominterface.Insert; +import com.xinelu.manage.dto.infocategory.InfoCategoryDTO; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +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.xinelu.common.annotation.Log; +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.enums.BusinessType; +import com.xinelu.manage.domain.infocategory.InfoCategory; +import com.xinelu.manage.service.infocategory.IInfoCategoryService; +import com.xinelu.common.utils.poi.ExcelUtil; +import com.xinelu.common.core.page.TableDataInfo; + +/** + * 资讯分类Controller + * + * @author xinelu + * @date 2024-04-11 + */ +@RestController +@RequestMapping("/manage/category") +public class InfoCategoryController extends BaseController { + @Resource + private IInfoCategoryService infoCategoryService; + + /** + * 查询资讯分类列表 + */ + @PreAuthorize("@ss.hasPermi('manage:category:list')") + @GetMapping("/list") + public TableDataInfo list(InfoCategory infoCategory) { + startPage(); + List list = infoCategoryService.selectInfoCategoryList(infoCategory); + return getDataTable(list); + } + + /** + * 导出资讯分类列表 + */ + @PreAuthorize("@ss.hasPermi('manage:category:export')") + @Log(title = "资讯分类", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, InfoCategory infoCategory) { + List list = infoCategoryService.selectInfoCategoryList(infoCategory); + ExcelUtil util = new ExcelUtil<>(InfoCategory.class); + util.exportExcel(response, list, "资讯分类数据"); + } + + /** + * 获取资讯分类详细信息 + */ + @PreAuthorize("@ss.hasPermi('manage:category:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(infoCategoryService.selectInfoCategoryById(id)); + } + + /** + * 新增资讯分类 + */ + @PreAuthorize("@ss.hasPermi('manage:category:add')") + @Log(title = "资讯分类", businessType = BusinessType.INSERT) + @PostMapping("/add") + public AjaxResult add(@RequestBody @Validated(Insert.class) InfoCategoryDTO infoCategoryDTO) { + + return infoCategoryService.insertInfoCategory(infoCategoryDTO); + } + + + /** + * 修改资讯分类 + */ + @PreAuthorize("@ss.hasPermi('manage:category:edit')") + @Log(title = "资讯分类", businessType = BusinessType.UPDATE) + @PutMapping("/edit") + public AjaxResult edit(@RequestBody InfoCategory infoCategory) { + return infoCategoryService.updateInfoCategory(infoCategory); + } + + /** + * 删除资讯分类 + */ + @PreAuthorize("@ss.hasPermi('manage:category:remove')") + @Log(title = "资讯分类", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(infoCategoryService.deleteInfoCategoryByIds(ids)); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/info/Info.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/info/Info.java new file mode 100644 index 00000000..a1eeede6 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/info/Info.java @@ -0,0 +1,152 @@ +package com.xinelu.manage.domain.info; + +import java.time.LocalDateTime; +import java.util.Date; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.AllArgsConstructor; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.xinelu.common.annotation.Excel; +import com.xinelu.common.core.domain.BaseEntity; + +/** + * 资讯信息对象 info + * + * @author xinelu + * @date 2024-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "资讯信息对象", description = "info") +public class Info extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private Long id; + + /** + * 资讯所属分类id + */ + @ApiModelProperty(value = "资讯所属分类id") + @Excel(name = "资讯所属分类id") + private Long infoCategoryId; + + + /** + * 资讯所属分类id + */ + @ApiModelProperty(value = "资讯列别名称") + @Excel(name = "资讯类别名称") + private String infoCategoryName; + + /** + * 资讯标题 + */ + @ApiModelProperty(value = "资讯标题") + @Excel(name = "资讯标题") + private String infoTitle; + + /** + * 资讯编码 + */ + @ApiModelProperty(value = "资讯编码") + @Excel(name = "资讯编码") + private String infoCode; + + /** + * 资讯图文内容,富文本 + */ + @ApiModelProperty(value = "资讯图文内容,富文本") + @Excel(name = "资讯图文内容,富文本") + private String infoContent; + + /** + * 咨询点击次数 + */ + @ApiModelProperty(value = "资讯点击次数") + @Excel(name = "咨询点击次数") + private Long infoClickCount; + + /** + * 资讯跳转路径 + */ + @ApiModelProperty(value = "资讯跳转路径") + @Excel(name = "资讯跳转路径") + private String infoJumpLink; + + + /** + * 资讯大图地址 + */ + @ApiModelProperty(value = "资讯大图地址") + @Excel(name = "资讯大图地址") + private String infoLargePictureUrl; + + /** + * 资讯排序 + */ + @ApiModelProperty(value = "资讯排序") + @Excel(name = "资讯排序") + private Long infoSort; + + /** + * 资讯创建人 + */ + @ApiModelProperty(value = "资讯创建人") + @Excel(name = "资讯创建人") + private String infoCreator; + + /** + * 资讯创建时间 + */ + @ApiModelProperty(value = "资讯创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "资讯创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime infoCreateTime; + + /** + * 资讯修改人 + */ + @ApiModelProperty(value = "资讯修改人") + @Excel(name = "资讯修改人") + private String infoReviser; + + /** + * 资讯修改时间 + */ + @ApiModelProperty(value = "资讯修改时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "资讯修改时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime infoModifyTime; + + + @Override + public String toString() { + return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("infoCategoryId", getInfoCategoryId()) + .append("infoCategoryName", getInfoCategoryName()) + .append("infoTitle", getInfoTitle()) + .append("infoCode", getInfoCode()) + .append("infoContent", getInfoContent()) + .append("infoClickCount", getInfoClickCount()) + .append("infoJumpLink", getInfoJumpLink()) + .append("infoLargePictureUrl", getInfoLargePictureUrl()) + .append("infoSort", getInfoSort()) + .append("infoCreator", getInfoCreator()) + .append("infoCreateTime", getInfoCreateTime()) + .append("infoReviser", getInfoReviser()) + .append("infoModifyTime", getInfoModifyTime()) + .toString(); + } +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/domain/infocategory/InfoCategory.java b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/infocategory/InfoCategory.java new file mode 100644 index 00000000..1e1b0bfa --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/domain/infocategory/InfoCategory.java @@ -0,0 +1,81 @@ +package com.xinelu.manage.domain.infocategory; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xinelu.common.annotation.Excel; +import com.xinelu.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.NoArgsConstructor; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.time.LocalDateTime; +import java.util.Date; + +/** + * 资讯分类对象 info_category + * + * @author xinelu + * @date 2024-04-11 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "资讯分类对象", description = "info_category") +public class InfoCategory extends BaseEntity + { +private static final long serialVersionUID=1L; + + /** 主键id */ + private Long id; + + /** 资讯分类编码 */ + @ApiModelProperty(value = "资讯分类编码") + @Excel(name = "资讯分类编码") + private String infoCategoryCode; + + /** 资讯分类名称 */ + @ApiModelProperty(value = "资讯分类名称") + @Excel(name = "资讯分类名称") + private String infoCategoryName; + + /** 资讯分类类型 */ + @ApiModelProperty(value = "资讯分类类型") + @Excel(name = "资讯分类类型") + private String infoCategoryType; + + /** 资讯分类排序 */ + @ApiModelProperty(value = "资讯分类排序") + @Excel(name = "资讯分类排序") + private Long infoCategorySort; + + /** 资讯创建人 */ + @ApiModelProperty(value = "资讯创建人") + @Excel(name = "资讯创建人") + private String infoCategoryCreator; + + /** 资讯创建时间 */ + @ApiModelProperty(value = "资讯创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "资讯创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + private LocalDateTime infoCategoryCreateTime; + + + +@Override +public String toString(){ + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id",getId()) + .append("infoCategoryCode",getInfoCategoryCode()) + .append("infoCategoryName",getInfoCategoryName()) + .append("infoCategoryType",getInfoCategoryType()) + .append("infoCategorySort",getInfoCategorySort()) + .append("infoCategoryCreator",getInfoCategoryCreator()) + .append("infoCategoryCreateTime",getInfoCategoryCreateTime()) + .toString(); + } + } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/infocategory/InfoCategoryDTO.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/infocategory/InfoCategoryDTO.java new file mode 100644 index 00000000..7a70443b --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/infocategory/InfoCategoryDTO.java @@ -0,0 +1,17 @@ +package com.xinelu.manage.dto.infocategory; + +import com.xinelu.manage.domain.infocategory.InfoCategory; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class InfoCategoryDTO implements Serializable { + + + /** + * 资讯分类对象传入集合 + */ + private List infoCategoryList; +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/info/InfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/info/InfoMapper.java new file mode 100644 index 00000000..300f80de --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/info/InfoMapper.java @@ -0,0 +1,72 @@ +package com.xinelu.manage.mapper.info; + +import java.util.List; + +import com.xinelu.manage.domain.info.Info; + +/** + * 资讯信息Mapper接口 + * + * @author xinelu + * @date 2024-04-11 + */ +public interface InfoMapper { + /** + * 查询资讯信息 + * + * @param id 资讯信息主键 + * @return 资讯信息 + */ + Info selectInfoById(Long id); + + /** + * 查询资讯信息列表 + * + * @param info 资讯信息 + * @return 资讯信息集合 + */ + List selectInfoList(Info info); + + /** + * 新增资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + int insertInfo(Info info); + + /** + * 修改资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + int updateInfo(Info info); + + /** + * 删除资讯信息 + * + * @param id 资讯信息主键 + * @return 结果 + */ + int deleteInfoById(Long id); + + /** + * 批量删除资讯信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteInfoByIds(Long[] ids); + + + /** + * 根据id数组查询资讯信息 + * + * @param ids 数组 + * @return List + */ + + List selectInfoByIds(Long[] ids); + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/infocategory/InfoCategoryMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/infocategory/InfoCategoryMapper.java new file mode 100644 index 00000000..d70e3fb8 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/infocategory/InfoCategoryMapper.java @@ -0,0 +1,94 @@ +package com.xinelu.manage.mapper.infocategory; + +import java.util.List; + +import com.xinelu.manage.domain.infocategory.InfoCategory; + +/** + * 资讯分类Mapper接口 + * + * @author xinelu + * @date 2024-04-11 + */ +public interface InfoCategoryMapper { + /** + * 查询资讯分类 + * + * @param id 资讯分类主键 + * @return 资讯分类 + */ + InfoCategory selectInfoCategoryById(Long id); + + /** + * 根据名称查询是否存在类型 + * @param name + * @return + */ + InfoCategory selectInfoCategoryByName(String name); + + /** + * 查询资讯分类列表 + * + * @param infoCategory 资讯分类 + * @return 资讯分类集合 + */ + List selectInfoCategoryList(InfoCategory infoCategory); + + /** + * 新增资讯分类 + * + * @param infoCategory 资讯分类 + * @return 结果 + */ + int insertInfoCategory(InfoCategory infoCategory); + + /** + * 修改资讯分类 + * + * @param infoCategory 资讯分类 + * @return 结果 + */ + int updateInfoCategory(InfoCategory infoCategory); + + /** + * 删除资讯分类 + * + * @param id 资讯分类主键 + * @return 结果 + */ + int deleteInfoCategoryById(Long id); + + /** + * 批量删除资讯分类 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteInfoCategoryByIds(Long[] ids); + + + /** + * 根据分类名称查询重复分类名称 + * + * @param categoryNameList 资讯分类名称集合 + * @return List + */ + List selectInfoCategoryName(List categoryNameList); + + + /** + * 批量新增资讯分类 + * + * @param infoCategoryList 资讯分类集合 + * @return 数量 + */ + int insertInfoCategoryList(List infoCategoryList); + + /** + * 根据分类名称查询重复分类名称 + * + * @param infoCategoryName 资讯分类名称 + * @return int + **/ + int selectInfoCategoryCount(String infoCategoryName); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/IInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/IInfoService.java new file mode 100644 index 00000000..d3e80085 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/IInfoService.java @@ -0,0 +1,70 @@ +package com.xinelu.manage.service.info; + +import java.util.List; + +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.manage.domain.info.Info; +import org.springframework.web.multipart.MultipartFile; + +/** + * 资讯信息Service接口 + * + * @author xinelu + * @date 2024-04-11 + */ +public interface IInfoService { + /** + * 查询资讯信息 + * + * @param id 资讯信息主键 + * @return 资讯信息 + */ + Info selectInfoById(Long id); + + /** + * 查询资讯信息列表 + * + * @param info 资讯信息 + * @return 资讯信息集合 + */ + List selectInfoList(Info info); + + /** + * 新增资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + int insertInfo(Info info); + + /** + * 修改资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + AjaxResult updateInfo(Info info); + + /** + * 批量删除资讯信息 + * + * @param ids 需要删除的资讯信息主键集合 + * @return 结果 + */ + AjaxResult deleteInfoByIds(Long[] ids); + + /** + * 删除资讯信息信息 + * + * @param id 资讯信息主键 + * @return 结果 + */ + int deleteInfoById(Long id); + + /** + * 图片文件上传 + * @param file + * @return + */ + AjaxResult picUpload(MultipartFile file); +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/impl/InfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/impl/InfoServiceImpl.java new file mode 100644 index 00000000..6704c2f1 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/info/impl/InfoServiceImpl.java @@ -0,0 +1,225 @@ +package com.xinelu.manage.service.info.impl; + +import java.io.File; +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.xinelu.common.config.SystemBusinessConfig; +import com.xinelu.common.constant.Constants; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.exception.ServiceException; +import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; +import com.xinelu.common.utils.file.FileUploadUtils; +import com.xinelu.common.utils.file.FileUtils; +import io.netty.util.internal.ObjectUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.xinelu.manage.mapper.info.InfoMapper; +import com.xinelu.manage.domain.info.Info; +import com.xinelu.manage.service.info.IInfoService; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; + +/** + * 资讯信息Service业务层处理 + * + * @author xinelu + * @date 2024-04-11 + */ +@Service +public class InfoServiceImpl implements IInfoService { + @Resource + private InfoMapper infoMapper; + @Resource + private GenerateSystemCodeUtil generateSystemCodeUtil; + @Resource + private SystemBusinessConfig systemBusinessConfig; + + /** + * 查询资讯信息 + * + * @param id 资讯信息主键 + * @return 资讯信息 + */ + @Override + public Info selectInfoById(Long id) { + return infoMapper.selectInfoById(id); + } + + /** + * 查询资讯信息列表 + * + * @param info 资讯信息 + * @return 资讯信息 + */ + @Override + public List selectInfoList(Info info) { + return infoMapper.selectInfoList(info); + } + + /** + * 新增资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + @Override + public int insertInfo(Info info) { + info.setInfoCreateTime(LocalDateTime.now()); + info.setInfoCreator(SecurityUtils.getUsername()); + info.setInfoCode(Constants.INFO_CODE + generateSystemCodeUtil.generateSystemCode(Constants.INFO_CODE)); + return infoMapper.insertInfo(info); + } + + /** + * 修改资讯信息 + * + * @param info 资讯信息 + * @return 结果 + */ + @Override + public AjaxResult updateInfo(Info info) { + //根据id查询之前的数据 + Info infoByID = infoMapper.selectInfoById(info.getId()); + if (Objects.isNull(infoByID)) { + return AjaxResult.error("当前资讯信息不存在,无法修改,请联系管理员!"); + } + + //添加修改人 修改时间 + info.setInfoReviser(SecurityUtils.getUsername()); + info.setInfoModifyTime(LocalDateTime.now()); + int count = infoMapper.updateInfo(info); + if (count <= 0) { + throw new ServiceException("修改资讯信息失败,请联系管理员!"); + } + + //如果两个图片不相等,删除之前的图片 + if (!info.getInfoLargePictureUrl().equals(infoByID.getInfoLargePictureUrl())) { + deletePictureUrl(infoByID.getInfoLargePictureUrl()); + } + + //遍历修改前后内容相不相等,如果不为空且不相等,寻找遍历前后图片的差集,然后删除. + if (StringUtils.isNotBlank(info.getInfoContent()) && StringUtils.isNotBlank(infoByID.getInfoContent()) + && !info.getInfoContent().equals(infoByID.getInfoContent())) { + //获取图片地址 + List infoImgSrc = FileUtils.getImgSrc(info.getInfoContent()); + List infoByIDImgSrc = FileUtils.getImgSrc(infoByID.getInfoContent()); + + //遍历删除图片 + List subList = new ArrayList<>(CollectionUtils.subtract(infoImgSrc, infoByIDImgSrc)); + for (String picUrl : subList) { + + if (StringUtils.isBlank(picUrl)) { //删除富文本图片 + continue; + } + //修改路径 + String substring = picUrl.substring(picUrl.indexOf("/profile")); + //删除富文本图片 + deletePictureUrl(substring); + } + + } + return AjaxResult.success(); + } + + /** + * 批量删除资讯信息 + * + * @param ids 需要删除的资讯信息主键 + * @return 结果 + */ + @Override + public AjaxResult deleteInfoByIds(Long[] ids) { + //查询删除之前数据 + List infoList = infoMapper.selectInfoByIds(ids); + //删除表信息 + int count = infoMapper.deleteInfoByIds(ids); + if (count <= 0) { + return AjaxResult.error("删除资讯信息失败!"); + } + + //筛选资讯主缩略图 + List largePicUrlList = infoList.stream().filter(Objects::nonNull).map(Info::getInfoLargePictureUrl).filter(StringUtils::isNotBlank).collect(Collectors.toList()); + //删除主图 + for (String picUrl : largePicUrlList) { + String substring = picUrl.substring(picUrl.indexOf("/profile")); + //删除富文本图片 + deletePictureUrl(substring); + } + + //筛选资讯内容 + List infoContentList = infoList.stream().filter(Objects::nonNull).map(Info::getInfoLargePictureUrl).filter(StringUtils::isNotBlank).collect(Collectors.toList()); + //遍历获取富文本内容图片地址 + for (String infoContent : infoContentList) { + List picUrlList = FileUtils.getImgSrc(infoContent); + for (String picUrl : picUrlList) { + if (StringUtils.isBlank(picUrl)) { + continue; + } + //修改路径 + String substring = picUrl.substring(picUrl.indexOf("/profile")); + //删除富文本图片 + deletePictureUrl(substring); + } + } + + return AjaxResult.success(); + } + + /** + * 删除资讯信息信息 + * + * @param id 资讯信息主键 + * @return 结果 + */ + @Override + public int deleteInfoById(Long id) { + return infoMapper.deleteInfoById(id); + } + + /** + * 图片文件上传 + * + * @param file + * @return + */ + public AjaxResult picUpload(MultipartFile file) { + try { + return AjaxResult.success(FileUploadUtils.upload( + systemBusinessConfig.getProfile() + systemBusinessConfig.getInfoRichTextPictureUrl(), file)); + } catch (IOException e) { + e.printStackTrace(); + return AjaxResult.error(); + } + } + + /** + * 删除资讯站图片地址 + * + * @param pictureUrl 资讯站图片地址 + * @return void 资讯站图片地址 + **/ + private void deletePictureUrl(String pictureUrl) { + if (StringUtils.isBlank(pictureUrl)) { + return; + } + String picture = SystemBusinessConfig.getProfile() + systemBusinessConfig.getInfoRichTextPictureUrl() + pictureUrl.replaceAll("/profile", ""); + File checkReportNameFile = new File(picture); + if (checkReportNameFile.exists()) { + boolean delete = checkReportNameFile.delete(); + if (BooleanUtils.isFalse(delete)) { + throw new ServiceException("图片地址删除失败!"); + } + } + } + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/IInfoCategoryService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/IInfoCategoryService.java new file mode 100644 index 00000000..64572f24 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/IInfoCategoryService.java @@ -0,0 +1,65 @@ +package com.xinelu.manage.service.infocategory; + +import java.util.List; + +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.manage.domain.infocategory.InfoCategory; +import com.xinelu.manage.dto.infocategory.InfoCategoryDTO; +import org.springframework.web.multipart.MultipartFile; + +/** + * 资讯分类Service接口 + * + * @author xinelu + * @date 2024-04-11 + */ +public interface IInfoCategoryService { + /** + * 查询资讯分类 + * + * @param id 资讯分类主键 + * @return 资讯分类 + */ + InfoCategory selectInfoCategoryById(Long id); + + /** + * 查询资讯分类列表 + * + * @param infoCategory 资讯分类 + * @return 资讯分类集合 + */ + List selectInfoCategoryList(InfoCategory infoCategory); + + /** + * 新增资讯分类 + * + * @param infoCategoryDTO 资讯分类 + * @return 结果 + */ + AjaxResult insertInfoCategory(InfoCategoryDTO infoCategoryDTO); + + /** + * 修改资讯分类 + * + * @param infoCategory 资讯分类 + * @return 结果 + */ + AjaxResult updateInfoCategory(InfoCategory infoCategory); + + /** + * 批量删除资讯分类 + * + * @param ids 需要删除的资讯分类主键集合 + * @return 结果 + */ + int deleteInfoCategoryByIds(Long[] ids); + + /** + * 删除资讯分类信息 + * + * @param id 资讯分类主键 + * @return 结果 + */ + int deleteInfoCategoryById(Long id); + +} diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/impl/InfoCategoryServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/impl/InfoCategoryServiceImpl.java new file mode 100644 index 00000000..27fad338 --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/infocategory/impl/InfoCategoryServiceImpl.java @@ -0,0 +1,157 @@ +package com.xinelu.manage.service.infocategory.impl; + +import java.io.IOException; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import com.xinelu.common.constant.Constants; +import com.xinelu.common.core.domain.AjaxResult; +import com.xinelu.common.utils.SecurityUtils; +import com.xinelu.common.utils.codes.GenerateSystemCodeUtil; +import com.xinelu.common.utils.file.FileUploadUtils; +import com.xinelu.manage.dto.infocategory.InfoCategoryDTO; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import com.xinelu.manage.mapper.infocategory.InfoCategoryMapper; +import com.xinelu.manage.domain.infocategory.InfoCategory; +import com.xinelu.manage.service.infocategory.IInfoCategoryService; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; + +/** + * 资讯分类Service业务层处理 + * + * @author xinelu + * @date 2024-04-11 + */ +@Service +public class InfoCategoryServiceImpl implements IInfoCategoryService { + @Resource + private InfoCategoryMapper infoCategoryMapper; + + @Resource + private GenerateSystemCodeUtil generateSystemCodeUtil; + + /** + * 查询资讯分类 + * + * @param id 资讯分类主键 + * @return 资讯分类 + */ + @Override + public InfoCategory selectInfoCategoryById(Long id) { + return infoCategoryMapper.selectInfoCategoryById(id); + } + + /** + * 查询资讯分类列表 + * + * @param infoCategory 资讯分类 + * @return 资讯分类 + */ + @Override + public List selectInfoCategoryList(InfoCategory infoCategory) { + return infoCategoryMapper.selectInfoCategoryList(infoCategory); + } + + /** + * 新增资讯分类 + * + * @param infoCategoryDTO 资讯分类 + * @return 结果 + */ + @Override + public AjaxResult insertInfoCategory(InfoCategoryDTO infoCategoryDTO) { + //筛选不为空资讯分类名称 + List categoryNameList = infoCategoryDTO.getInfoCategoryList().stream().filter(Objects::nonNull).map(InfoCategory::getInfoCategoryName).collect(Collectors.toList()); + //资讯分类名称去重 + List distinctNameList = infoCategoryDTO.getInfoCategoryList().stream().filter(Objects::nonNull).map(InfoCategory::getInfoCategoryName).distinct().collect(Collectors.toList()); + + //集合取差集 + List subtractNameList = new ArrayList<>(CollectionUtils.subtract(categoryNameList, distinctNameList)); + if (subtractNameList.size() > 0) { + return AjaxResult.error("'" + subtractNameList.get(0) + "'重复,请修改后重新录入!"); + } + //数据库查询资讯分类名称 + List existCategoryName = infoCategoryMapper.selectInfoCategoryName(categoryNameList); + + List existRetainAllNameList = new ArrayList<>(CollectionUtils.intersection(distinctNameList, existCategoryName)); + if (existRetainAllNameList.size() > 0) { + return AjaxResult.error("'" + existRetainAllNameList.get(0) + "'已存在,请修改后重新录入!"); + } + for (InfoCategory infocategory : infoCategoryDTO.getInfoCategoryList()) { + + infocategory.setCreateTime(LocalDateTime.now());//设置添加时间 + infocategory.setInfoCategoryCreator(SecurityUtils.getUsername());//设置当前的用户 + infocategory.setInfoCategoryType(infocategory.getInfoCategoryName());//类型 无用 直接赋值和名称相同 + infocategory.setInfoCategoryCode(Constants.INFO_CATEGORY_CODE + generateSystemCodeUtil.generateSystemCode(Constants.DEPARTMENT_CODE)); + } + int insertCount = infoCategoryMapper.insertInfoCategoryList(infoCategoryDTO.getInfoCategoryList()); + if (insertCount < 0) { + throw new RuntimeException("新增资讯分类信息失败,请联系管理员!"); + } + return AjaxResult.success(); + } + + /** + * 修改资讯分类 + * + * @param infoCategory 资讯分类 + * @return 结果 + */ + @Override + public AjaxResult updateInfoCategory(InfoCategory infoCategory) { + //根据咨询分类id查询数据库 + // InfoCategory infoCategoryByName = infoCategoryMapper.selectInfoCategoryByName(infoCategory.getInfoCategoryName()); + InfoCategory infoCategoryByName = infoCategoryMapper.selectInfoCategoryById(infoCategory.getId()); + if (Objects.isNull(infoCategoryByName)) { + return AjaxResult.error("当前资讯分类信息不存在,无法修改,请联系管理员!"); + } + //两名称都不为空,且不相等 + if (StringUtils.isNotBlank(infoCategory.getInfoCategoryName()) && StringUtils.isNotBlank(infoCategoryByName.getInfoCategoryName()) && !infoCategory.getInfoCategoryName().equals(infoCategoryByName.getInfoCategoryName())) { + int infoCategoryCount = infoCategoryMapper.selectInfoCategoryCount(infoCategory.getInfoCategoryName());//查找要修改的名称是否已经存在了 + if (infoCategoryCount > 0) { + return AjaxResult.error("已有该资讯分类信息名称:" + infoCategory.getInfoCategoryName()); + } + } + infoCategoryByName.setUpdateTime(LocalDateTime.now());//设置时间 + infoCategoryByName.setInfoCategoryName(infoCategory.getInfoCategoryName());//设置名称为修改的名称 + infoCategoryByName.setInfoCategorySort(infoCategory.getInfoCategorySort());//设置排序 + infoCategoryByName.setUpdateBy(SecurityUtils.getUsername());//设置当前用户 + infoCategoryByName.setInfoCategoryType(infoCategory.getInfoCategoryName());//类型 + int updateInfoCategory = infoCategoryMapper.updateInfoCategory(infoCategoryByName);//更新到数据库 + if (updateInfoCategory < 0) { + return AjaxResult.error("修改资讯分类信息失败,请联系管理员!"); + } + return AjaxResult.success(); + } + + /** + * 批量删除资讯分类 + * + * @param ids 需要删除的资讯分类主键 + * @return 结果 + */ + @Override + public int deleteInfoCategoryByIds(Long[] ids) { + return infoCategoryMapper.deleteInfoCategoryByIds(ids); + } + + /** + * * 删除资讯分类信息 + * + * @param id 资讯分类主键 + * @return 结果 + */ + @Override + public int deleteInfoCategoryById(Long id) { + return infoCategoryMapper.deleteInfoCategoryById(id); + } + + +} diff --git a/postdischarge-manage/src/main/resources/mapper/manage/info/InfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/info/InfoMapper.xml new file mode 100644 index 00000000..02a0a808 --- /dev/null +++ b/postdischarge-manage/src/main/resources/mapper/manage/info/InfoMapper.xml @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + select id, + info_category_id, + info_category_name, + info_title, + info_code, + info_content, + info_click_count, + info_jump_link, + info_large_picture_url, + info_sort, + info_creator, + info_create_time, + info_reviser, + info_modify_time + from info + + + + + + + + insert into info + + info_category_id, + + info_category_name, + + info_title, + + info_code, + + info_content, + + info_click_count, + + info_jump_link, + + info_large_picture_url, + + info_sort, + + info_creator, + + info_create_time, + + info_reviser, + + info_modify_time, + + + + #{infoCategoryId}, + + #{infoCategoryName}, + + #{infoTitle}, + + #{infoCode}, + + #{infoContent}, + + #{infoClickCount}, + + #{infoJumpLink}, + + #{infoLargePictureUrl}, + + #{infoSort}, + + #{infoCreator}, + + #{infoCreateTime}, + + #{infoReviser}, + + #{infoModifyTime}, + + + + + + update info + + info_category_id = + #{infoCategoryId}, + + info_category_name = + #{infoCategoryName}, + + info_title = + #{infoTitle}, + + info_code = + #{infoCode}, + + info_content = + #{infoContent}, + + info_click_count = + #{infoClickCount}, + + info_jump_link = + #{infoJumpLink}, + + info_large_picture_url = + #{infoLargePictureUrl}, + + info_sort = + #{infoSort}, + + info_creator = + #{infoCreator}, + + info_create_time = + #{infoCreateTime}, + + info_reviser = + #{infoReviser}, + + info_modify_time = + #{infoModifyTime}, + + + where id = #{id} + + + + delete + from info + where id = #{id} + + + + delete from info where id in + + #{id} + + + + + + \ No newline at end of file diff --git a/postdischarge-manage/src/main/resources/mapper/manage/infocategory/InfoCategoryMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/infocategory/InfoCategoryMapper.xml new file mode 100644 index 00000000..47380baf --- /dev/null +++ b/postdischarge-manage/src/main/resources/mapper/manage/infocategory/InfoCategoryMapper.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + select id, info_category_code, info_category_name, info_category_type, info_category_sort, info_category_creator, info_category_create_time from info_category + + + + + + + + + + insert into info_category + + info_category_code, + + info_category_name, + + info_category_type, + + info_category_sort, + + info_category_creator, + + info_category_create_time, + + + + #{infoCategoryCode}, + + #{infoCategoryName}, + + #{infoCategoryType}, + + #{infoCategorySort}, + + #{infoCategoryCreator}, + + #{infoCategoryCreateTime}, + + + + + + update info_category + + info_category_code = + #{infoCategoryCode}, + + info_category_name = + #{infoCategoryName}, + + info_category_type = + #{infoCategoryType}, + + info_category_sort = + #{infoCategorySort}, + + info_category_creator = + #{infoCategoryCreator}, + + info_category_create_time = + #{infoCategoryCreateTime}, + + + where id = #{id} + + + + delete from info_category where id = #{id} + + + + delete from info_category where id in + + #{id} + + + + + + + + + insert into info_category( + info_category_code, + info_category_name, + info_category_type, + info_category_sort, + info_category_creator, + info_category_create_time + )values + + ( + #{infoCategoryList.infoCategoryCode}, + #{infoCategoryList.infoCategoryName}, + #{infoCategoryList.infoCategoryType}, + #{infoCategoryList.infoCategorySort}, + #{infoCategoryList.infoCategoryCreator}, + #{infoCategoryList.infoCategoryCreateTime} + ) + + + + + \ No newline at end of file diff --git a/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/info/MobileInfoController.java b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/info/MobileInfoController.java new file mode 100644 index 00000000..c0b309a8 --- /dev/null +++ b/postdischarge-mobile/src/main/java/com/xinelu/mobile/controller/info/MobileInfoController.java @@ -0,0 +1,39 @@ +package com.xinelu.mobile.controller.info; + +import com.xinelu.common.core.controller.BaseController; +import com.xinelu.common.core.page.TableDataInfo; +import com.xinelu.manage.domain.info.Info; +import com.xinelu.manage.service.info.IInfoService; +import lombok.extern.slf4j.Slf4j; +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.RestController; +import javax.annotation.Resource; +import java.util.List; + +import static com.xinelu.common.utils.PageUtils.startPage; + +/** + * 微信端获取资讯信息 + * 资讯信息Controller + */ +@Slf4j +@RestController +@RequestMapping("/mobile/info") +public class MobileInfoController extends BaseController { + + + @Resource + private IInfoService infoService; + + + //@PreAuthorize("@ss.hasPermi('mobile:info:list')") + @GetMapping("/list") + public TableDataInfo list(Info info) { + startPage(); + List list = infoService.selectInfoList(info); + return getDataTable(list); + } + +}