...
|
...
|
@@ -13,6 +13,7 @@ import com.yohobuy.platform.dal.grass.model.GrassLabel; |
|
|
import com.yohobuy.platform.dal.grass.model.GrassTopic;
|
|
|
import com.yohobuy.platform.grass.service.ITopicService;
|
|
|
import com.yohobuy.platform.grass.service.IlabelService;
|
|
|
import com.yohobuy.platform.model.common.ApiResponse;
|
|
|
import com.yohobuy.platform.model.common.PageResponseVO;
|
|
|
import com.yohobuy.platform.model.grass.request.GrassLabelReq;
|
|
|
import com.yohobuy.platform.model.grass.request.GrassTopicReq;
|
...
|
...
|
@@ -54,14 +55,15 @@ public class TopicServiceImpl implements ITopicService { |
|
|
|
|
|
Integer status = req.getStatus() == null || req.getStatus() == 8 ? null : req.getStatus();
|
|
|
Integer isOfficial = req.getIsOfficial() == null || req.getIsOfficial() == 8 ? null : req.getIsOfficial();
|
|
|
Integer isHot = req.getIsHot() == null || req.getIsHot() == 8 ? null : req.getIsHot();
|
|
|
String topicName = req.getTopicName();
|
|
|
String groupName = req.getGroupName();
|
|
|
Integer startTime = req.getStartTime();
|
|
|
Integer endTime = req.getEndTime();
|
|
|
int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,startTime,endTime);
|
|
|
int total = grassTopicDAO.countByCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime);
|
|
|
List<TopicRespBo> pageData = new ArrayList<>();
|
|
|
if(total > 0){
|
|
|
List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,startTime,endTime,req.getStart(),req.getSize());
|
|
|
List<GrassTopic> list = grassTopicDAO.selectByPageCondition(status,isOfficial,topicName,groupName,isHot,startTime,endTime,req.getStart(),req.getSize());
|
|
|
pageData = convertTopicRespBo(list);
|
|
|
}
|
|
|
PageResponseVO responseVO = new PageResponseVO();
|
...
|
...
|
@@ -117,6 +119,32 @@ public class TopicServiceImpl implements ITopicService { |
|
|
grassTopicDAO.changeStatus(id,status);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置是否是热门
|
|
|
* 最多只能同时存在5个热门话题
|
|
|
* @param req
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
public ApiResponse changeTopicHotStatus(GrassTopicReq req) {
|
|
|
logger.info("enter changeTopicHotStatus req={} ", req);
|
|
|
Integer id = req.getId();
|
|
|
Integer isHot = req.getIsHot();
|
|
|
if(isHot == 1){//设置为热门 要控制下个数
|
|
|
int total = grassTopicDAO.countHotTopics();
|
|
|
if(total == 5){
|
|
|
return new ApiResponse.ApiResponseBuilder().code(201).message("设置失败!最多只能设置5个热门话题").build();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
GrassTopic record = new GrassTopic();
|
|
|
record.setId(id);
|
|
|
record.setIsHot(isHot);
|
|
|
grassTopicDAO.updateByPrimaryKeySelective(record);
|
|
|
logger.info("changeTopicHotStatus success! req={}",req);
|
|
|
return new ApiResponse.ApiResponseBuilder().code(200).build();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<TopicRespBo> grassTopicByGroupId(GrassTopicReq req) {
|
|
|
Integer groupId = req.getGroupId();
|
...
|
...
|
|