1.天下事的type的保存

This commit is contained in:
34701892@qq.com 2024-12-14 18:05:54 +08:00
parent 856f874aed
commit d24d4fa725
5 changed files with 45 additions and 8 deletions

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, status)" + @Insert("insert into news(draft_id, title, summary, picture, type, content, create_time, update_time, status, publish_time)" +
"values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status})") "values (#{draftId}, #{title}, #{summary}, #{picture}, #{type}, #{content}, now(), now(), #{status}, #{publishTime})")
void saveNews(News news); void saveNews(News news);

View File

@ -11,6 +11,7 @@ public class SaveDraftColumn {
private SaveDraftColumnItem earlyKnow; private SaveDraftColumnItem earlyKnow;
private Boolean showEverything; private Boolean showEverything;
private SaveDraftColumnItem everything;
public SaveDraftColumn() {} public SaveDraftColumn() {}
@ -46,4 +47,12 @@ public class SaveDraftColumn {
public void setShowEverything(Boolean showEverything) { public void setShowEverything(Boolean showEverything) {
this.showEverything = showEverything; this.showEverything = showEverything;
} }
public SaveDraftColumnItem getEverything() {
return everything;
}
public void setEverything(SaveDraftColumnItem everything) {
this.everything = everything;
}
} }

View File

@ -80,6 +80,7 @@ public class News {
this.type = 1; this.type = 1;
this.status = saveNewsDTO.getStatus(); this.status = saveNewsDTO.getStatus();
this.content = saveNewsDTO.getContent(); this.content = saveNewsDTO.getContent();
this.publishTime = saveNewsDTO.getPublishTime();
// this.status = 0; // this.status = 0;
this.createTime = new Date(); this.createTime = new Date();
this.updateTime = new Date(); this.updateTime = new Date();

View File

@ -10,6 +10,7 @@ public class NewsDetailColumn {
private SaveDraftColumnItem earlyKnow; private SaveDraftColumnItem earlyKnow;
private boolean showEverything = false; private boolean showEverything = false;
private SaveDraftColumnItem everything;
public NewsDetailColumnVip getVip() { public NewsDetailColumnVip getVip() {
return vip; return vip;
@ -42,4 +43,12 @@ public class NewsDetailColumn {
public void setShowEverything(Boolean showEverything) { public void setShowEverything(Boolean showEverything) {
this.showEverything = showEverything; this.showEverything = showEverything;
} }
public SaveDraftColumnItem getEverything() {
return everything;
}
public void setEverything(SaveDraftColumnItem everything) {
this.everything = everything;
}
} }

View File

@ -123,6 +123,11 @@ public class NewsService {
item.setType(type); item.setType(type);
} else if (columnId == 14) { } else if (columnId == 14) {
newsDetailColumn.setShowEverything(true); newsDetailColumn.setShowEverything(true);
//zzp
SaveDraftColumnItem item = new SaveDraftColumnItem();
newsDetailColumn.setEverything(item);
item.setShow(true);
item.setType(type);
} else { } else {
NewsDetailColumnVip vip = new NewsDetailColumnVip(); NewsDetailColumnVip vip = new NewsDetailColumnVip();
vip.setId(columnId); vip.setId(columnId);
@ -210,6 +215,13 @@ public class NewsService {
item.setType(type); item.setType(type);
} else if (columnId == 14) { } else if (columnId == 14) {
newsDetailColumn.setShowEverything(true); newsDetailColumn.setShowEverything(true);
//zzp
SaveDraftColumnItem item = new SaveDraftColumnItem();
newsDetailColumn.setEarlyKnow(item);
item.setShow(true);
item.setType(type);
newsDetailColumn.setEverything(item);
} else { } else {
NewsDetailColumnVip vip = new NewsDetailColumnVip(); NewsDetailColumnVip vip = new NewsDetailColumnVip();
vip.setId(columnId); vip.setId(columnId);
@ -334,11 +346,13 @@ public class NewsService {
} }
} }
Boolean showEverything = column.getShowEverything(); Boolean showEverything = column.getShowEverything();
Integer type = null; // Integer type = null;
if (earlyKnow != null) { // if (earlyKnow != null) {
type = earlyKnow.getType();//时间紧暂时把早知道的type挪过来 // type = earlyKnow.getType();//时间紧暂时把早知道的type挪过来
} // }
SaveDraftColumnItem everything = column.getEverything();
if (showEverything != null && showEverything) { if (showEverything != null && showEverything) {
Integer type = everything.getType();
columnMapper.saveNewsColumnRel(newIdRl, 14L, type); columnMapper.saveNewsColumnRel(newIdRl, 14L, type);
} }
} }
@ -521,6 +535,7 @@ public class NewsService {
} }
} }
SaveDraftColumnItem earlyKnow = column.getEarlyKnow(); SaveDraftColumnItem earlyKnow = column.getEarlyKnow();
SaveDraftColumnItem everything = column.getEverything();
if (earlyKnow != null) { if (earlyKnow != null) {
Boolean show = earlyKnow.getShow(); Boolean show = earlyKnow.getShow();
if (show != null && show) { if (show != null && show) {
@ -530,7 +545,9 @@ public class NewsService {
} }
Boolean showEverything = column.getShowEverything(); Boolean showEverything = column.getShowEverything();
if (showEverything != null && showEverything) { if (showEverything != null && showEverything) {
columnMapper.saveDraftColumnRel(draftId, 14L, null); //zzp
Integer type = everything.getType();
columnMapper.saveDraftColumnRel(draftId, 14L, type);
} }
} }
} catch (Exception e) { } catch (Exception e) {
@ -544,7 +561,8 @@ public class NewsService {
Integer last, Integer current, String orderBy, String direction) { Integer last, Integer current, String orderBy, String direction) {
int offset = 0; int offset = 0;
if (current != null) { if (current != null) {
offset = (Math.max(0, page - current)) * size; // offset = (Math.max(0, page - current)) * size;
offset = (Math.max(0, current-1)) * size;
} }
if (StringUtils.hasText(columnParam)) { if (StringUtils.hasText(columnParam)) {