修复模型点赞bug

master
yang 2025-01-22 16:17:46 +08:00 committed by Diyu0904
parent c6a92b1e62
commit 789cf9f3d9
5 changed files with 15 additions and 12 deletions

View File

@ -43,8 +43,8 @@ public class ModelCommentController {
@ApiOperation(value = "模型点赞/取消") @ApiOperation(value = "模型点赞/取消")
@RepeatSubmit @RepeatSubmit
@GetMapping("/modelLike/{modelId}") @GetMapping("/modelLike/{modelId}")
public AjaxResult like(@PathVariable Long imageId) { public AjaxResult like(@PathVariable Long modelId) {
modelLikeService.like(imageId); modelLikeService.like(modelId);
return AjaxResult.success(); return AjaxResult.success();
} }

View File

@ -22,4 +22,8 @@ public interface QuestionCommentMapper extends BaseMapper<QuestionComment> {
Long communityId, Long communityId,
@Param("questionId") @Param("questionId")
Long questionId); Long questionId);
@InterceptorIgnore(tenantLine = "true")
QuestionComment selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(Long commentId, Long tenantId, Long communityId, Long questionId);
} }

View File

@ -92,8 +92,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
Long questionId = questionCommentAdoptRes.getQuestionId(); Long questionId = questionCommentAdoptRes.getQuestionId();
Long commentId = questionCommentAdoptRes.getCommentId(); Long commentId = questionCommentAdoptRes.getCommentId();
// QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(commentId, tenantId, communityId, questionId); QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(commentId, tenantId, communityId, questionId);
QuestionComment questionComment = null;
if (Objects.isNull(questionComment)) { if (Objects.isNull(questionComment)) {
return AjaxResult.error("评论不存在"); return AjaxResult.error("评论不存在");
} }
@ -116,9 +115,7 @@ public class QuestionCommentServiceImpl extends ServiceImpl<QuestionCommentMappe
if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) { if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) {
questionCommentPageRes.setOrderByColumn("create_time"); questionCommentPageRes.setOrderByColumn("create_time");
} }
OrderItem orderItem = OrderItem.desc(questionCommentPageRes.getOrderByColumn());
boolean isAsc = Objects.equals(questionCommentPageRes.getIsAsc(), "asc");
OrderItem orderItem = new OrderItem(questionCommentPageRes.getOrderByColumn(), isAsc);
page.addOrder(orderItem); page.addOrder(orderItem);

View File

@ -136,15 +136,16 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper,ModelProduct> impl
imagePageRes.setOrderByColumn("create_time"); imagePageRes.setOrderByColumn("create_time");
} }
// 设置排序 // 设置排序
OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn()); List<OrderItem> orderItemList = new ArrayList<>();
page.addOrder(orderItem); orderItemList.add(OrderItem.desc("is_top"));
orderItemList.add(OrderItem.desc(imagePageRes.getOrderByColumn()));
page.addOrder(orderItemList);
LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>(); LambdaQueryWrapper<ModelProduct> lqw = new LambdaQueryWrapper<>();
lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditStatus, imagePageRes.getStatus()) lqw.eq(imagePageRes.getStatus() != null && imagePageRes.getStatus() != 0, ModelProduct::getAuditStatus, imagePageRes.getStatus())
.eq( ModelProduct::getUserId, SecurityUtils.getUserId()) .eq( ModelProduct::getUserId, SecurityUtils.getUserId())
.ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime()) .ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime())
.le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime()); .le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime());
postMapper.selectPage(page, lqw); postMapper.selectPage(page, lqw);
// 获取分页数据 // 获取分页数据
List<ModelProduct> modelImageList = page.getRecords(); List<ModelProduct> modelImageList = page.getRecords();

View File

@ -14,6 +14,7 @@
update_by, update_by,
update_time, update_time,
del_flag, del_flag,
remark where user_id = #{userId} and model_id = #{modelId} remark
from model_like where user_id = #{userId} and model_id = #{modelId}
</select> </select>
</mapper> </mapper>