feat: Add news information management module with API and database support
- Introduced new API endpoints for querying and managing news information in the CMS. - Implemented data model for NewsInfo and NewsInfoQuery with validation. - Created NewsInfoMapper for database interactions and corresponding XML mappings. - Developed INewsInfoService interface and its implementation for business logic. - Added RichTextSanitizer utility for cleaning HTML content to prevent XSS attacks. - Created unit tests for RichTextSanitizer to ensure proper functionality. - Updated database schema with news_info table and necessary fields, including status and module. - Added migration scripts for setting up the news information module in the database. - Integrated jsoup library for HTML sanitization.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.ruoyi.cms.domain.news;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.xss.Xss;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 新闻资讯对象。
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("新闻资讯")
|
||||
public class NewsInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("新闻资讯ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "资讯模块,对应业务字典 news_module 的 dict_value", required = true)
|
||||
@NotBlank(message = "资讯模块不能为空")
|
||||
@Size(max = 100, message = "资讯模块长度不能超过100个字符")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty("资讯模块名称(业务字典标签,只读)")
|
||||
private String moduleName;
|
||||
|
||||
@ApiModelProperty(value = "标题", required = true)
|
||||
@NotBlank(message = "标题不能为空")
|
||||
@Size(max = 200, message = "标题长度不能超过200个字符")
|
||||
@Xss(message = "标题不能包含脚本字符")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "富文本正文HTML", required = true)
|
||||
@NotBlank(message = "正文不能为空")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty("上下架状态(0上架 1下架),新增时默认下架")
|
||||
@Pattern(regexp = "^[01]$", message = "状态只能是0(上架)或1(下架)")
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ruoyi.cms.domain.news;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 新闻资讯查询参数。
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("新闻资讯查询参数")
|
||||
public class NewsInfoQuery {
|
||||
|
||||
@ApiModelProperty("页码")
|
||||
private Integer pageNum = 1;
|
||||
|
||||
@ApiModelProperty("每页条数")
|
||||
private Integer pageSize = 10;
|
||||
|
||||
@ApiModelProperty("标题关键词")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty("资讯模块字典值")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty("上下架状态(0上架 1下架)")
|
||||
private String status;
|
||||
}
|
||||
Reference in New Issue
Block a user