加点赞数,收藏数

This commit is contained in:
86182
2022-10-28 12:01:53 +08:00
parent 7963491ef2
commit c30c85b86e
4 changed files with 46 additions and 7 deletions

View File

@@ -229,7 +229,7 @@ public class Cases extends BaseEntity {
public Cases() { public Cases() {
} }
public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend){ public Cases(String id,String title,String summary,String coverUrl,String authorId,String authorName,LocalDateTime sysCreateTime,Integer breCommend,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites){
this.title=title; this.title=title;
super.setId(id); super.setId(id);
this.authorId=authorId; this.authorId=authorId;
@@ -238,6 +238,11 @@ public class Cases extends BaseEntity {
this.summary=summary; this.summary=summary;
this.coverUrl=coverUrl; this.coverUrl=coverUrl;
this.breCommend=breCommend; this.breCommend=breCommend;
this.views=views;
this.comments=comments;
this.praises=praises;
this.shares=shares;
this.favorites=favorites;
} }
public Cases(String id,String title){ public Cases(String id,String title){

View File

@@ -324,7 +324,7 @@ public class Course extends BaseEntity {
@Transient @Transient
private Integer auditForward; private Integer auditForward;
public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime){ public Course(String id,String name,String summary,String coverImg,String sysCreateAid,String sysCreateBy,Integer type,LocalDateTime publishTime,Integer views,Integer comments,Integer praises,Integer shares,Integer favorites){
super.setId(id); super.setId(id);
this.name=name; this.name=name;
this.summary=summary; this.summary=summary;
@@ -333,6 +333,11 @@ public class Course extends BaseEntity {
super.setSysCreateBy(sysCreateBy); super.setSysCreateBy(sysCreateBy);
this.type=type; this.type=type;
this.publishTime=publishTime; this.publishTime=publishTime;
this.views=views;
this.comments=comments;
this.praises=praises;
this.shares=shares;
this.favorites=favorites;
} }
} }

View File

@@ -177,7 +177,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
if(!courseList.isEmpty()) { if(!courseList.isEmpty()) {
QueryBuilder from = QueryBuilder.from(Course.class); QueryBuilder from = QueryBuilder.from(Course.class);
from.addFilter(FieldFilters.in("id",courseList)); from.addFilter(FieldFilters.in("id",courseList));
from.addFields("new Course(id,name,summary,coverImg,sysCreateAid,sysCreateBy,type,publishTime)"); from.addFields("new Course(id,name,summary,coverImg,sysCreateAid,sysCreateBy,type,publishTime,views,comments,praises,shares,favorites)");
List<Course> courses = courseDao.findList(from.builder()); List<Course> courses = courseDao.findList(from.builder());
if(!courses.isEmpty()){ if(!courses.isEmpty()){
for (Course c : courses) { for (Course c : courses) {
@@ -191,6 +191,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
favoriteTotalDto.setAuthorName(c.getSysCreateBy()); favoriteTotalDto.setAuthorName(c.getSysCreateBy());
favoriteTotalDto.setContentType(c.getType()); favoriteTotalDto.setContentType(c.getType());
favoriteTotalDto.setPublishTime(c.getPublishTime()); favoriteTotalDto.setPublishTime(c.getPublishTime());
favoriteTotalDto.setViews(c.getViews());
favoriteTotalDto.setComments(c.getComments());
favoriteTotalDto.setPraises(c.getPraises());
favoriteTotalDto.setShares(c.getShares());
favoriteTotalDto.setFavorites(c.getFavorites());
} }
} }
} }
@@ -212,6 +217,12 @@ public class FavoritesServiceImpl implements IFavoritesService{
favoriteTotalDto.setAuthorId(a.getSysCreateAid()); favoriteTotalDto.setAuthorId(a.getSysCreateAid());
favoriteTotalDto.setAuthorName(a.getSysCreateBy()); favoriteTotalDto.setAuthorName(a.getSysCreateBy());
favoriteTotalDto.setPublishTime(a.getSysCreateTime()); favoriteTotalDto.setPublishTime(a.getSysCreateTime());
favoriteTotalDto.setViews(a.getViews());
favoriteTotalDto.setComments(a.getComments());
favoriteTotalDto.setPraises(a.getPraises());
favoriteTotalDto.setShares(a.getShares());
favoriteTotalDto.setFavorites(a.getFavorites());
} }
} }
} }
@@ -220,7 +231,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
if(!qaList.isEmpty()) { if(!qaList.isEmpty()) {
QueryBuilder from = QueryBuilder.from(Question.class); QueryBuilder from = QueryBuilder.from(Question.class);
from.addFilter(FieldFilters.in("id",qaList)); from.addFilter(FieldFilters.in("id",qaList));
from.addFields("new Question(id,title,content,images,sysCreateAid,sysCreateBy,sysCreateTime,bestId,bestAnswer,isResolve)"); from.addFields("new Question(id,title,content,images,sysCreateAid,sysCreateBy,sysCreateTime,bestId,bestAnswer,isResolve,views,answers,praises,shares,favorites)");
List<Question> questions = questionDao.findList(from.builder()); List<Question> questions = questionDao.findList(from.builder());
if(!questions.isEmpty()) { if(!questions.isEmpty()) {
for (Question q : questions) { for (Question q : questions) {
@@ -235,6 +246,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
favoriteTotalDto.setBestId(q.getBestId()); favoriteTotalDto.setBestId(q.getBestId());
favoriteTotalDto.setBestAnswer(q.getBestAnswer()); favoriteTotalDto.setBestAnswer(q.getBestAnswer());
favoriteTotalDto.setIsResolve(q.getIsResolve()); favoriteTotalDto.setIsResolve(q.getIsResolve());
favoriteTotalDto.setViews(q.getViews());
favoriteTotalDto.setComments(q.getAnswers());
favoriteTotalDto.setPraises(q.getPraises());
favoriteTotalDto.setShares(q.getShares());
favoriteTotalDto.setFavorites(q.getFavorites());
} }
} }
} }
@@ -243,7 +259,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
if(!caseList.isEmpty()) { if(!caseList.isEmpty()) {
QueryBuilder from = QueryBuilder.from(Cases.class); QueryBuilder from = QueryBuilder.from(Cases.class);
from.addFilter(FieldFilters.in("id", caseList)); from.addFilter(FieldFilters.in("id", caseList));
from.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend)"); from.addFields("new Cases(id,title,summary,coverUrl,authorId,authorName,sysCreateTime,breCommend,views,comments,praises,shares,favorites)");
List<Cases> cases = courseDao.findList(from.builder()); List<Cases> cases = courseDao.findList(from.builder());
if(!cases.isEmpty()) { if(!cases.isEmpty()) {
for (Cases c : cases) { for (Cases c : cases) {
@@ -256,6 +272,11 @@ public class FavoritesServiceImpl implements IFavoritesService{
favoriteTotalDto.setAuthorName(c.getAuthorName()); favoriteTotalDto.setAuthorName(c.getAuthorName());
favoriteTotalDto.setPublishTime(c.getSysCreateTime()); favoriteTotalDto.setPublishTime(c.getSysCreateTime());
favoriteTotalDto.setBreCommend(c.getBreCommend()); favoriteTotalDto.setBreCommend(c.getBreCommend());
favoriteTotalDto.setViews(c.getViews());
favoriteTotalDto.setComments(c.getComments());
favoriteTotalDto.setPraises(c.getPraises());
favoriteTotalDto.setShares(c.getShares());
favoriteTotalDto.setFavorites(c.getFavorites());
} }
} }
} }
@@ -271,7 +292,7 @@ public class FavoritesServiceImpl implements IFavoritesService{
ids.append(","); ids.append(",");
} }
ids.deleteCharAt(ids.length()-1); ids.deleteCharAt(ids.length()-1);
String sql="select id,course_name,content,sys_create_aid,sys_create_by,sys_create_time from boe_note_info where id in("+ids+")"; String sql="select id,course_name,content,sys_create_aid,sys_create_by,sys_create_time,praises,favorites,comments from boe_note_info where id in("+ids+")";
List<Object[]> list1 = dao.sqlFindList(sql); List<Object[]> list1 = dao.sqlFindList(sql);
for (Object[] o:list1){ for (Object[] o:list1){
for (FavoriteTotalDto favoriteTotalDto : list.getList()) { for (FavoriteTotalDto favoriteTotalDto : list.getList()) {
@@ -280,6 +301,9 @@ public class FavoritesServiceImpl implements IFavoritesService{
favoriteTotalDto.setContent((String) o[2]); favoriteTotalDto.setContent((String) o[2]);
favoriteTotalDto.setAuthorId((String) o[3]); favoriteTotalDto.setAuthorId((String) o[3]);
favoriteTotalDto.setAuthorName((String) o[4]); favoriteTotalDto.setAuthorName((String) o[4]);
favoriteTotalDto.setPraises((Integer) o[5]);
favoriteTotalDto.setFavorites((Integer) o[6]);
favoriteTotalDto.setComments((Integer) o[6]);
Timestamp time = (Timestamp)o[5]; Timestamp time = (Timestamp)o[5];
favoriteTotalDto.setPublishTime(time.toLocalDateTime()); favoriteTotalDto.setPublishTime(time.toLocalDateTime());

View File

@@ -128,7 +128,7 @@ public class Question extends BaseEntity {
this.answers=answers; this.answers=answers;
} }
public Question(String id,String title, String content, String images,String sysCreateAid,String sysCreateBy,LocalDateTime sysCreateTime, String bestId, String bestAnswer,Boolean isResolve) { public Question(String id,String title, String content, String images,String sysCreateAid,String sysCreateBy,LocalDateTime sysCreateTime, String bestId, String bestAnswer,Boolean isResolve,Integer views,Integer answers,Integer praises,Integer shares,Integer favorites) {
this.title = title; this.title = title;
this.content = content; this.content = content;
this.images = images; this.images = images;
@@ -139,6 +139,11 @@ public class Question extends BaseEntity {
super.setSysCreateAid(sysCreateAid); super.setSysCreateAid(sysCreateAid);
super.setSysCreateBy(sysCreateBy); super.setSysCreateBy(sysCreateBy);
super.setSysCreateTime(sysCreateTime); super.setSysCreateTime(sysCreateTime);
this.views=views;
this.answers=answers;
this.praises=praises;
this.shares=shares;
this.favorites=favorites;
} }
public Question(String id,String title){ public Question(String id,String title){