保存和发布文章时的status保存

This commit is contained in:
zzp 2024-12-11 14:44:35 +08:00
parent 2c0f9029a6
commit f10f514c0c
5 changed files with 12 additions and 4 deletions

View File

@ -182,6 +182,8 @@ public class NewsController {
return ResultObject.failed(500, "服务端错误,请联系系统管理员!"); return ResultObject.failed(500, "服务端错误,请联系系统管理员!");
} }
// 这个接口是保存那status应该是1未发布
saveNewsDTO.setStatus(1);
return newsService.saveDraft(saveNewsDTO); return newsService.saveDraft(saveNewsDTO);
} }

View File

@ -71,8 +71,8 @@ public interface NewsMapper {
"values (#{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())") "values (#{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())")
void saveDraft(NewsDraft newsDraft); void saveDraft(NewsDraft newsDraft);
@Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time)" + @Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status)" +
"values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now())") "values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status})")
void saveNews(News news); void saveNews(News news);
@Select("<script>" + @Select("<script>" +

View File

@ -78,8 +78,9 @@ public class News {
this.summary = saveNewsDTO.getSummary(); this.summary = saveNewsDTO.getSummary();
this.picture = saveNewsDTO.getPicture(); this.picture = saveNewsDTO.getPicture();
this.type = 1; this.type = 1;
this.status = saveNewsDTO.getStatus();
this.content = saveNewsDTO.getContent(); this.content = saveNewsDTO.getContent();
this.status = 0; // this.status = 0;
this.createTime = new Date(); this.createTime = new Date();
this.updateTime = new Date(); this.updateTime = new Date();
} }

View File

@ -34,6 +34,10 @@ public class NewsDraft {
* 新闻类型 0-普通 | 1-vip * 新闻类型 0-普通 | 1-vip
*/ */
private Integer type; private Integer type;
/**
* 状态 0草稿 1未发布 2已发布
*/
private Integer status;
/** /**
* H5富文本 * H5富文本
@ -58,6 +62,7 @@ public class NewsDraft {
this.summary = saveNewsDTO.getSummary(); this.summary = saveNewsDTO.getSummary();
this.picture = saveNewsDTO.getPicture(); this.picture = saveNewsDTO.getPicture();
this.type = 1; this.type = 1;
this.status = saveNewsDTO.getStatus();
this.content = saveNewsDTO.getContent(); this.content = saveNewsDTO.getContent();
this.createTime = new Date(); this.createTime = new Date();
this.updateTime = new Date(); this.updateTime = new Date();

View File

@ -176,7 +176,7 @@ public class NewsService {
if (!CollectionUtils.isEmpty(columnRelList)) { if (!CollectionUtils.isEmpty(columnRelList)) {
for (NewsColumnRel rel : columnRelList) { for (NewsColumnRel rel : columnRelList) {
Long columnId = rel.getColumnId(); Long columnId = rel.getColumnId();
int type = rel.getType(); Integer type = rel.getType();
if (columnId == 13) { if (columnId == 13) {
SaveDraftColumnItem item = new SaveDraftColumnItem(); SaveDraftColumnItem item = new SaveDraftColumnItem();
newsDetailColumn.setEarlyKnow(item); newsDetailColumn.setEarlyKnow(item);