From 1594bc4a748c08a62466213fcbe16c503b6ef2cc Mon Sep 17 00:00:00 2001 From: yang <2119157836@qq.com> Date: Wed, 22 Jan 2025 15:52:30 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../QuestionCommentController.java | 63 +++++++++ .../resource/MallProductController.java | 52 ++++--- .../com/mcwl/common/core/page/PageDomain.java | 2 +- .../domain/QuestionComment.java | 12 +- .../domain/dto/QuestionCommentAdoptRes.java | 46 +++++++ .../domain/dto/QuestionCommentPageRes.java | 28 ++++ .../domain/dto/QuestionCommentRes.java | 47 +++++++ .../domain/vo/QuestionCommentVo.java | 46 +++++++ .../mapper/QuestionCommentMapper.java | 25 ++++ .../service/QuestionCommentService.java | 20 +++ .../impl/QuestionCommentServiceImpl.java | 129 ++++++++++++++++++ .../communityCenter/QuestionCommentMapper.xml | 18 +++ .../com/mcwl/resource/domain/WorkFlow.java | 2 +- .../domain/dto/ModelImagePageRes.java | 5 - .../resource/domain/vo/ModelImageLikeVo.java | 50 +++++++ .../mcwl/resource/domain/vo/ModelLikeVo.java | 47 +++++++ .../resource/domain/vo/WorkFlowLikeVo.java | 48 +++++++ .../service/ModelImageLikeService.java | 10 +- .../resource/service/ModelLikeService.java | 8 ++ .../resource/service/WorkFlowLikeService.java | 3 + .../impl/ModelImageLikeServiceImpl.java | 71 ++++++++++ .../service/impl/ModelImageServiceImpl.java | 5 +- .../service/impl/ModelLikeServiceImpl.java | 65 +++++++++ .../service/impl/ModelServiceImpl.java | 6 +- .../service/impl/WorkFlowLikeServiceImpl.java | 67 +++++++++ .../service/impl/WorkFlowServiceImpl.java | 5 +- 26 files changed, 830 insertions(+), 50 deletions(-) create mode 100644 mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentAdoptRes.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentPageRes.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentRes.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionCommentVo.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java create mode 100644 mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java create mode 100644 mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelImageLikeVo.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelLikeVo.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowLikeVo.java diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java new file mode 100644 index 0000000..ff91ce9 --- /dev/null +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/communityCenter/QuestionCommentController.java @@ -0,0 +1,63 @@ +package com.mcwl.web.controller.communityCenter; + + +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.page.TableDataInfo; +import com.mcwl.communityCenter.domain.dto.*; +import com.mcwl.communityCenter.service.QuestionCommentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.validation.Valid; + +/** + * 提问评论 + */ +@Api(tags = "提问评论") +@RestController +@RequestMapping("questionComment") +@RequiredArgsConstructor +public class QuestionCommentController { + + private final QuestionCommentService questionCommentService; + + + /** + * 提问评论 + */ + @PostMapping("comment") + @ApiOperation(value = "新增提问评论") + public AjaxResult comment(@Valid @RequestBody QuestionCommentRes questionCommentRes) { + return questionCommentService.comment(questionCommentRes); + } + + /** + * 获取提问评论列表 + * @param questionCommentPageRes 请求参数 + * @return 评论列表 + */ + @PostMapping("list") + @ApiOperation(value = "获取提问评论列表") + public TableDataInfo list(@RequestBody @Valid QuestionCommentPageRes questionCommentPageRes) { + return questionCommentService.listByPage(questionCommentPageRes); + } + + /** + * 采纳评论 + */ + @PostMapping("adopt") + @ApiOperation(value = "采纳评论") + public AjaxResult adopt(@Valid @RequestBody QuestionCommentAdoptRes questionCommentAdoptRes) { + return questionCommentService.adopt(questionCommentAdoptRes); + } + + + + + +} diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java index fb12bd5..3631b1a 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/MallProductController.java @@ -10,9 +10,7 @@ import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.dto.ModelImagePageRes; import com.mcwl.resource.domain.request.RequestModel; -import com.mcwl.resource.service.ModelImageService; -import com.mcwl.resource.service.ModelService; -import com.mcwl.resource.service.WorkFlowService; +import com.mcwl.resource.service.*; import com.mcwl.web.controller.common.OssUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; @@ -43,12 +41,21 @@ public class MallProductController extends BaseController { @Autowired private ModelService modelService; + @Autowired + private ModelLikeService modelLikeService; + @Autowired private ModelImageService modelImageService; @Autowired private WorkFlowService workFlowService; + @Autowired + private WorkFlowLikeService workFlowLikeService; + + @Autowired + private ModelImageLikeService modelImageLikeService; + /*** * @@ -192,9 +199,9 @@ public class MallProductController extends BaseController { /** - * 我的发布-模型 + * 我的发布-模型列表 */ - @ApiOperation(value = "我的发布-模型") + @ApiOperation(value = "我的发布-模型列表") @PostMapping("/selectByUserIdModel") public TableDataInfo selectByUserIdModel(@RequestBody ModelImagePageRes imagePageRes) { @@ -202,9 +209,9 @@ public class MallProductController extends BaseController { } /** - * 我的发布-工作流 + * 我的发布-工作流列表 */ - @ApiOperation(value = "我的发布-工作流") + @ApiOperation(value = "我的发布-工作流列表") @PostMapping("/selectByUserIdWorkFlow") public TableDataInfo selectByUserIdWorkFlow(@RequestBody ModelImagePageRes imagePageRes) { @@ -212,9 +219,9 @@ public class MallProductController extends BaseController { } /** - * 我的发布-图片 + * 我的发布-图片列表 */ - @ApiOperation(value = "我的发布-图片") + @ApiOperation(value = "我的发布-图片列表") @PostMapping("/selectByUserIdImage") public TableDataInfo selectByUserIdImage(@RequestBody ModelImagePageRes imagePageRes) { @@ -222,39 +229,30 @@ public class MallProductController extends BaseController { } /** - * 点赞-模型 + * 我的点赞-模型列表 */ - @ApiOperation(value = "点赞-模型") + @ApiOperation(value = "我的点赞-模型列表") @PostMapping("/likeModel") public TableDataInfo likeModel(@RequestBody PageDomain pageDomain) { - ModelImagePageRes imagePageRes = new ModelImagePageRes(); - BeanUtil.copyProperties(pageDomain, imagePageRes); - imagePageRes.setUserId(SecurityUtils.getUserId()); - return modelService.listByPage(imagePageRes); + return modelLikeService.listByPage(pageDomain); } /** - * 点赞-工作流 + * 我的点赞-工作流列表 */ - @ApiOperation(value = "点赞-工作流") + @ApiOperation(value = "我的点赞-工作流列表") @PostMapping("/likeWorkFlow") public TableDataInfo likeWorkFlow(@RequestBody PageDomain pageDomain) { - ModelImagePageRes imagePageRes = new ModelImagePageRes(); - BeanUtil.copyProperties(pageDomain, imagePageRes); - imagePageRes.setUserId(SecurityUtils.getUserId()); - return workFlowService.listByPage(imagePageRes); + return workFlowLikeService.listByPage(pageDomain); } /** - * 点赞-图片 + * 我的点赞-图片列表 */ - @ApiOperation(value = "点赞-图片") + @ApiOperation(value = "我的点赞-图片列表") @PostMapping("/likeImage") public TableDataInfo likeImage(@RequestBody PageDomain pageDomain) { - ModelImagePageRes imagePageRes = new ModelImagePageRes(); - BeanUtil.copyProperties(pageDomain, imagePageRes); - imagePageRes.setUserId(SecurityUtils.getUserId()); - return modelImageService.listByPage(imagePageRes); + return modelImageLikeService.listByPage(pageDomain); } diff --git a/mcwl-common/src/main/java/com/mcwl/common/core/page/PageDomain.java b/mcwl-common/src/main/java/com/mcwl/common/core/page/PageDomain.java index 1119774..42462e3 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/core/page/PageDomain.java +++ b/mcwl-common/src/main/java/com/mcwl/common/core/page/PageDomain.java @@ -29,7 +29,7 @@ public class PageDomain private String orderByColumn; /** 排序的方向desc或者asc */ - @ApiModelProperty(value = "排序的方向desc或者asc", example = "asc") + @ApiModelProperty(hidden = true) private String isAsc = "asc"; /** 分页参数合理化 */ diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java index 60f0d7b..9b7279d 100644 --- a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/QuestionComment.java @@ -19,23 +19,23 @@ import lombok.EqualsAndHashCode; public class QuestionComment extends BaseEntity { @TableId - private String id; + private Long id; /** * 租户id */ - private String tenantId; + private Long tenantId; /** * 社区id */ - private String communityId; + private Long communityId; /** * 提问id */ - private String questionId; + private Long questionId; /** * 用户id */ - private String userId; + private Long userId; /** * 内容 */ @@ -43,7 +43,7 @@ public class QuestionComment extends BaseEntity { /** * 是否接受 */ - private String isAccept; + private Long isAccept; diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentAdoptRes.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentAdoptRes.java new file mode 100644 index 0000000..de98760 --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentAdoptRes.java @@ -0,0 +1,46 @@ +package com.mcwl.communityCenter.domain.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +@Data +@ApiModel(value = "采纳请求参数") +public class QuestionCommentAdoptRes { + + /** + * 租户id + */ + @NotNull(message = "租户不能为空") + @ApiModelProperty(value = "租户ID", required = true) + private Long tenantId; + + /** + * 社区id + */ + @NotNull(message = "社区不能为空") + @ApiModelProperty(value = "社区ID", required = true) + private Long communityId; + + /** + * 提问id + */ + @NotNull(message = "提问不能为空") + @ApiModelProperty(value = "提问ID", required = true) + private Long questionId; + + /** + * 评论id + */ + @NotNull(message = "评论不能为空") + @ApiModelProperty(value = "评论ID", required = true) + private Long commentId; + + + +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentPageRes.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentPageRes.java new file mode 100644 index 0000000..3484136 --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentPageRes.java @@ -0,0 +1,28 @@ +package com.mcwl.communityCenter.domain.dto; + +import com.mcwl.common.core.page.PageDomain; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotNull; + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "提问分页请求参数") +public class QuestionCommentPageRes extends PageDomain { + + @NotNull(message = "租户不能为空") + @ApiModelProperty(value = "租户id", required = true) + private Long tenantId; + + @NotNull(message = "社区不能为空") + @ApiModelProperty(value = "社区id", required = true) + private Long communityId; + + @NotNull(message = "提问不能为空") + @ApiModelProperty(value = "提问ID", required = true) + private Long questionId; + +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentRes.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentRes.java new file mode 100644 index 0000000..b37ed34 --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/dto/QuestionCommentRes.java @@ -0,0 +1,47 @@ +package com.mcwl.communityCenter.domain.dto; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * 提问评论请求参数 + */ +@Data +@ApiModel("提问评论请求参数") +public class QuestionCommentRes { + /** + * 租户id + */ + @NotNull(message = "租户不能为空") + @ApiModelProperty(value = "租户ID", required = true) + private Long tenantId; + + /** + * 社区id + */ + @NotNull(message = "社区不能为空") + @ApiModelProperty(value = "社区ID", required = true) + private Long communityId; + + /** + * 提问id + */ + @NotNull(message = "提问不能为空") + @ApiModelProperty(value = "提问ID", required = true) + private Long questionId; + + /** + * 评论内容 + */ + @NotBlank(message = "评论内容不能为空") + @ApiModelProperty(value = "评论内容", required = true) + private String content; + + + +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionCommentVo.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionCommentVo.java new file mode 100644 index 0000000..2ff1d5a --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/domain/vo/QuestionCommentVo.java @@ -0,0 +1,46 @@ +package com.mcwl.communityCenter.domain.vo; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(description = "提问评论") +public class QuestionCommentVo { + + @ApiModelProperty(value = "id") + private Long id; + /** + * 租户id + */ + @ApiModelProperty(value = "租户id") + private Long tenantId; + /** + * 社区id + */ + @ApiModelProperty(value = "社区id") + private Long communityId; + /** + * 提问id + */ + @ApiModelProperty(value = "提问id") + private Long questionId; + /** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private Long userId; + /** + * 内容 + */ + @ApiModelProperty(value = "内容") + private String content; + /** + * 是否接受 + */ + @ApiModelProperty(value = "是否接受") + private Long isAccept; + + +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java new file mode 100644 index 0000000..a09803d --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/mapper/QuestionCommentMapper.java @@ -0,0 +1,25 @@ +package com.mcwl.communityCenter.mapper; + +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.mcwl.communityCenter.domain.Publish; +import com.mcwl.communityCenter.domain.Question; +import com.mcwl.communityCenter.domain.QuestionComment; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import javax.validation.constraints.NotNull; + +@Mapper +public interface QuestionCommentMapper extends BaseMapper { + + @InterceptorIgnore(tenantLine = "true") + Page selectByTenantIdAndCommunityIdAndQuestionIdPage(Page page, + @Param("tenantId") + Long tenantId, + @Param("communityId") + Long communityId, + @Param("questionId") + Long questionId); +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java new file mode 100644 index 0000000..b278404 --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/QuestionCommentService.java @@ -0,0 +1,20 @@ +package com.mcwl.communityCenter.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.page.TableDataInfo; +import com.mcwl.communityCenter.domain.Question; +import com.mcwl.communityCenter.domain.QuestionComment; +import com.mcwl.communityCenter.domain.dto.*; +import com.mcwl.communityCenter.domain.vo.QuestionVo; + +import javax.validation.Valid; + +public interface QuestionCommentService extends IService { + + AjaxResult comment(@Valid QuestionCommentRes questionCommentRes); + + TableDataInfo listByPage(@Valid QuestionCommentPageRes questionCommentPageRes); + + AjaxResult adopt(@Valid QuestionCommentAdoptRes questionCommentAdoptRes); +} diff --git a/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java new file mode 100644 index 0000000..0800345 --- /dev/null +++ b/mcwl-communityCenter/src/main/java/com/mcwl/communityCenter/service/impl/QuestionCommentServiceImpl.java @@ -0,0 +1,129 @@ +package com.mcwl.communityCenter.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.HttpStatus; +import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.entity.SysUser; +import com.mcwl.common.core.page.TableDataInfo; +import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; +import com.mcwl.communityCenter.domain.Community; +import com.mcwl.communityCenter.domain.Question; +import com.mcwl.communityCenter.domain.QuestionComment; +import com.mcwl.communityCenter.domain.dto.*; +import com.mcwl.communityCenter.domain.vo.QuestionCommentVo; +import com.mcwl.communityCenter.domain.vo.QuestionVo; +import com.mcwl.communityCenter.mapper.*; +import com.mcwl.communityCenter.service.QuestionCommentService; +import com.mcwl.communityCenter.service.QuestionService; +import com.mcwl.system.service.ISysUserService; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@Service +@RequiredArgsConstructor +public class QuestionCommentServiceImpl extends ServiceImpl implements QuestionCommentService { + + private final QuestionMapper questionMapper; + + @Override + public AjaxResult comment(QuestionCommentRes questionCommentRes) { + + Long tenantId = questionCommentRes.getTenantId(); + Long communityId = questionCommentRes.getCommunityId(); + Long questionId = questionCommentRes.getQuestionId(); + + Question question = questionMapper.selectByIdAndTenantIdAndCommunityId(questionId, tenantId, communityId); + + if (Objects.isNull(question)) { + return AjaxResult.error("提问不存在"); + } + + QuestionComment questionComment = new QuestionComment(); + BeanUtil.copyProperties(questionCommentRes, questionComment); + questionComment.setUserId(SecurityUtils.getUserId()); + + baseMapper.insert(questionComment); + + + return AjaxResult.success("评论成功"); + } + + + + @Override + public TableDataInfo listByPage(QuestionCommentPageRes questionCommentPageRes) { + + Page page = initPage(questionCommentPageRes); + + baseMapper.selectByTenantIdAndCommunityIdAndQuestionIdPage(page, questionCommentPageRes.getTenantId(), questionCommentPageRes.getCommunityId(), questionCommentPageRes.getQuestionId()); + + + List questionCommentList = page.getRecords(); + List questionCommentVoList = new ArrayList<>(); + for (QuestionComment questionComment : questionCommentList) { + QuestionCommentVo questionCommentVo = new QuestionCommentVo(); + BeanUtil.copyProperties(questionComment, questionCommentVo); + questionCommentVoList.add(questionCommentVo); + } + + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setCode(HttpStatus.SUCCESS); + tableDataInfo.setMsg("查询成功"); + tableDataInfo.setRows(questionCommentVoList); + tableDataInfo.setTotal(page.getTotal()); + + return tableDataInfo; + } + + @Override + public AjaxResult adopt(QuestionCommentAdoptRes questionCommentAdoptRes) { + + Long tenantId = questionCommentAdoptRes.getTenantId(); + Long communityId = questionCommentAdoptRes.getCommunityId(); + Long questionId = questionCommentAdoptRes.getQuestionId(); + Long commentId = questionCommentAdoptRes.getCommentId(); + +// QuestionComment questionComment = baseMapper.selectByIdAndTenantIdAndCommunityIdAndQuestionIdAndCommentId(commentId, tenantId, communityId, questionId); + QuestionComment questionComment = null; + if (Objects.isNull(questionComment)) { + return AjaxResult.error("评论不存在"); + } + + if (questionComment.getIsAccept() == 1) { + return AjaxResult.error("该评论已被采纳"); + } + + + + + return AjaxResult.success(); + } + + + private Page initPage(QuestionCommentPageRes questionCommentPageRes) { + + Page page = new Page<>(questionCommentPageRes.getPageNum(), questionCommentPageRes.getPageSize()); + + if (StringUtils.isBlank(questionCommentPageRes.getOrderByColumn())) { + questionCommentPageRes.setOrderByColumn("create_time"); + } + + boolean isAsc = Objects.equals(questionCommentPageRes.getIsAsc(), "asc"); + OrderItem orderItem = new OrderItem(questionCommentPageRes.getOrderByColumn(), isAsc); + page.addOrder(orderItem); + + + return page; + } + + +} diff --git a/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml new file mode 100644 index 0000000..f2d5454 --- /dev/null +++ b/mcwl-communityCenter/src/main/resources/mapper/communityCenter/QuestionCommentMapper.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java index d45312d..2c0acfc 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/WorkFlow.java @@ -173,7 +173,7 @@ public class WorkFlow { * 作品点赞数量 */ @ApiModelProperty(value = "作品点赞数量") - private Long likeCount = 0L; + private Integer likeCount = 0; /** * 翻译后主体 diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImagePageRes.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImagePageRes.java index fdfee6e..df04fce 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImagePageRes.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/dto/ModelImagePageRes.java @@ -16,11 +16,6 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = true) public class ModelImagePageRes extends PageDomain { - /** - * 用户id - */ - @ApiModelProperty(value = "用户id") - private Long userId; /** * 状态 diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelImageLikeVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelImageLikeVo.java new file mode 100644 index 0000000..64e1c84 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelImageLikeVo.java @@ -0,0 +1,50 @@ +package com.mcwl.resource.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +@ApiModel(description = "图片返回对象") +public class ModelImageLikeVo { + /** + * id + */ + @ApiModelProperty(value = "id", required = true) + private Long id; + /** + * 用户ID + */ + @ApiModelProperty(value = "用户id", required = true) + private Long userId; + /** + * 用户名称 + */ + @ApiModelProperty(value = "用户名称", required = true) + private String userName; + /** + * 用户头像 + */ + @ApiModelProperty(value = "用户头像", required = true) + private String userAvatar; + /** + * 图片id + */ + @ApiModelProperty(value = "图片id", required = true) + private Long modelImageId; + /** + * 图片地址(最多8张,切割) + */ + @ApiModelProperty(value = "图片地址(最多8张,切割)") + private String imagePaths; + /** + * 点赞数 + */ + @ApiModelProperty(value = "点赞数") + private Integer likeNum; + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelLikeVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelLikeVo.java new file mode 100644 index 0000000..b388b81 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/ModelLikeVo.java @@ -0,0 +1,47 @@ +package com.mcwl.resource.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(description = "模型返回对象") +public class ModelLikeVo { + /** + * id + */ + @ApiModelProperty(value = "id", required = true) + private Long id; + /** + * 用户ID + */ + @ApiModelProperty(value = "用户id", required = true) + private Long userId; + /** + * 用户名称 + */ + @ApiModelProperty(value = "用户名称", required = true) + private String userName; + /** + * 用户头像 + */ + @ApiModelProperty(value = "用户头像", required = true) + private String userAvatar; + /** + * 模型id + */ + @ApiModelProperty(value = "模型id", required = true) + private Long modelId; + /** + * 封面图 + */ + @ApiModelProperty(value = "封面图") + private String surfaceUrl; + /** + * 点赞数 + */ + @ApiModelProperty(value = "点赞数") + private Integer likeNum; + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowLikeVo.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowLikeVo.java new file mode 100644 index 0000000..2bcca43 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/vo/WorkFlowLikeVo.java @@ -0,0 +1,48 @@ +package com.mcwl.resource.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel(description = "工作流请求对象") +public class WorkFlowLikeVo { + /** + * id + */ + @ApiModelProperty(value = "id", required = true) + private Long id; + /** + * 用户ID + */ + @ApiModelProperty(value = "用户id", required = true) + private Long userId; + /** + * 用户名称 + */ + @ApiModelProperty(value = "用户名称", required = true) + private String userName; + /** + * 用户头像 + */ + @ApiModelProperty(value = "用户头像", required = true) + private String userAvatar; + /** + * 工作流id + */ + @ApiModelProperty(value = "工作流id", required = true) + private Long workFlowId; + /** + * 封面图 + */ + @ApiModelProperty(value = "封面图") + private String converPath; + /** + * 点赞数 + */ + @ApiModelProperty(value = "点赞数") + private Integer likeNum; + + + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelImageLikeService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelImageLikeService.java index ffadacd..7d99fa0 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelImageLikeService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelImageLikeService.java @@ -1,8 +1,11 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.ModelImage; import com.mcwl.resource.domain.ModelImageLike; +import com.mcwl.resource.domain.dto.ModelImagePageRes; import java.util.List; @@ -16,5 +19,10 @@ public interface ModelImageLikeService extends IService { List fetchModelImageSortedByTopStatus(); - + /** + * 分页查询 + * @param pageDomain 分页参数 + * @return 分页数据 + */ + TableDataInfo listByPage(PageDomain pageDomain); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelLikeService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelLikeService.java index 47e64cc..b2046bc 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelLikeService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelLikeService.java @@ -1,6 +1,8 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.ModelLike; /** @@ -16,4 +18,10 @@ public interface ModelLikeService extends IService { void like(Long imageId); + /** + * 分页查询 + * @param pageDomain 分页参数 + * @return 分页结果 + */ + TableDataInfo listByPage(PageDomain pageDomain); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowLikeService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowLikeService.java index e1ac8e7..04c5fe5 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowLikeService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowLikeService.java @@ -1,6 +1,8 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.WorkFlowLike; /** @@ -17,4 +19,5 @@ public interface WorkFlowLikeService extends IService { void like(Long imageId); + TableDataInfo listByPage(PageDomain pageDomain); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageLikeServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageLikeServiceImpl.java index 6ba9f32..82d5d37 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageLikeServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageLikeServiceImpl.java @@ -1,19 +1,33 @@ package com.mcwl.resource.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.core.domain.entity.SysUser; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.exception.ServiceException; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelImage; import com.mcwl.resource.domain.ModelImageLike; +import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.vo.ModelImageLikeVo; +import com.mcwl.resource.domain.vo.ModelImageVo; import com.mcwl.resource.mapper.ModelImageLikeMapper; import com.mcwl.resource.mapper.ModelImageMapper; import com.mcwl.resource.service.ModelImageLikeService; import com.mcwl.resource.service.ModelImageService; +import com.mcwl.system.service.ISysUserService; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Objects; @@ -27,6 +41,8 @@ public class ModelImageLikeServiceImpl extends ServiceImpl fetchModelImageSortedByTopStatus() { return modelImageMapper.fetchModelImageSortedByTopStatus(); } + + + + /** + * 分页查询 + * + * @param pageDomain 分页参数 + * @return 分页数据 + */ + @Override + public TableDataInfo listByPage(PageDomain pageDomain) { + + Page page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); + if (StringUtils.isEmpty(pageDomain.getOrderByColumn())) { + pageDomain.setOrderByColumn("create_time"); + } + // 设置排序 + boolean isAsc = Objects.equals(pageDomain.getIsAsc(), "desc"); + OrderItem orderItem = new OrderItem(pageDomain.getOrderByColumn(), isAsc); + page.addOrder(orderItem); + + baseMapper.selectPage(page, null); + // 获取分页数据 + List modelImageList = page.getRecords(); + + // ModelImage数据转为ModelImagePageVo + List modelImageLikeVoList = new ArrayList<>(); + for (ModelImageLike modelImageLike : modelImageList) { + ModelImageLikeVo modelImageLikeVo = new ModelImageLikeVo(); + BeanUtil.copyProperties(modelImageLike, modelImageLikeVo); + + // 获取用户信息 + SysUser sysUser = sysUserService.selectUserById(modelImageLike.getUserId()); + modelImageLikeVo.setUserName(sysUser.getUserName()); + modelImageLikeVo.setUserAvatar(sysUser.getAvatar()); + + // 获取图片信息 + ModelImage modelImage = modelImageMapper.selectById(modelImageLike.getModelImageId()); + modelImageLikeVo.setImagePaths(modelImage.getImagePaths()); + modelImageLikeVo.setLikeNum(modelImage.getLikeNum()); + + + modelImageLikeVoList.add(modelImageLikeVo); + + } + + // 封装分页数据 + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setMsg("查询成功"); + rspData.setRows(modelImageLikeVoList); + rspData.setTotal(page.getTotal()); + + return rspData; + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java index 47a7fb7..763a618 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelImageServiceImpl.java @@ -180,13 +180,12 @@ public class ModelImageServiceImpl extends ServiceImpl lqw = new LambdaQueryWrapper<>(); lqw.eq(imagePageRes.getStatus() != null, ModelImage::getStatus, imagePageRes.getStatus()) - .eq(imagePageRes.getUserId() != null, ModelImage::getUserId, imagePageRes.getUserId()) + .eq(ModelImage::getUserId, SecurityUtils.getUserId()) .ge(imagePageRes.getStartTime() != null, ModelImage::getCreateTime, imagePageRes.getStartTime()) .le(imagePageRes.getEndTime() != null, ModelImage::getCreateTime, imagePageRes.getEndTime()); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelLikeServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelLikeServiceImpl.java index 2f854f2..cce23ca 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelLikeServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelLikeServiceImpl.java @@ -1,17 +1,29 @@ package com.mcwl.resource.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.HttpStatus; +import com.mcwl.common.core.domain.entity.SysUser; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.exception.ServiceException; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.*; +import com.mcwl.resource.domain.vo.ModelLikeVo; import com.mcwl.resource.mapper.ModelMapper; import com.mcwl.resource.mapper.ModelLikeMapper; import com.mcwl.resource.service.ModelLikeService; +import com.mcwl.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.Objects; /** @@ -24,6 +36,10 @@ public class ModelLikeServiceImpl extends ServiceImpl page = initPage(pageDomain); + + + baseMapper.selectPage(page, null); + + List modelLikeList = page.getRecords(); + List modelLikeVoList = new ArrayList<>(); + for (ModelLike modelLike : modelLikeList) { + ModelLikeVo modelLikeVo = new ModelLikeVo(); + BeanUtil.copyProperties(modelLike, modelLikeVo); + + // 获取用户信息 + SysUser sysUser = sysUserService.selectUserById(modelLike.getUserId()); + modelLikeVo.setUserName(sysUser.getUserName()); + modelLikeVo.setUserAvatar(sysUser.getAvatar()); + + // 获取模型信息 + ModelProduct modelProduct = modelMapper.selectById(modelLike.getModelId()); + modelLikeVo.setSurfaceUrl(modelProduct.getSurfaceUrl()); + modelLikeVo.setLikeNum(modelProduct.getLikeNum()); + + modelLikeVoList.add(modelLikeVo); + } + + + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setRows(modelLikeVoList); + tableDataInfo.setTotal(page.getTotal()); + tableDataInfo.setCode(HttpStatus.SUCCESS); + tableDataInfo.setMsg("查询成功"); + + return tableDataInfo; + + + } + + private Page initPage(PageDomain pageDomain) { + Page page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); + if (StringUtils.isBlank(pageDomain.getOrderByColumn())) { + pageDomain.setOrderByColumn("create_time"); + } + OrderItem orderItem = OrderItem.desc(pageDomain.getOrderByColumn()); + page.addOrder(orderItem); + + return page; + } } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java index d3d1b37..1c50bd6 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ModelServiceImpl.java @@ -31,6 +31,7 @@ import com.mcwl.system.init.DictInit; import com.mcwl.system.service.ISysUserService; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Sort; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; @@ -135,13 +136,12 @@ public class ModelServiceImpl extends ServiceImpl impl imagePageRes.setOrderByColumn("create_time"); } // 设置排序 - boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc"); - OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc); + OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn()); page.addOrder(orderItem); LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.eq(imagePageRes.getStatus() != null, ModelProduct::getAuditStatus, imagePageRes.getStatus()) - .eq(imagePageRes.getUserId() != null, ModelProduct::getUserId, imagePageRes.getUserId()) + .eq( ModelProduct::getUserId, SecurityUtils.getUserId()) .ge(imagePageRes.getStartTime() != null, ModelProduct::getCreateTime, imagePageRes.getStartTime()) .le(imagePageRes.getEndTime() != null, ModelProduct::getCreateTime, imagePageRes.getEndTime()); diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowLikeServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowLikeServiceImpl.java index 04a2f35..e8d7a85 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowLikeServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowLikeServiceImpl.java @@ -1,18 +1,33 @@ package com.mcwl.resource.service.impl; +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.metadata.OrderItem; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.mcwl.common.constant.HttpStatus; +import com.mcwl.common.core.domain.entity.SysUser; +import com.mcwl.common.core.page.PageDomain; +import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.common.exception.ServiceException; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.common.utils.StringUtils; +import com.mcwl.resource.domain.ModelLike; +import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.WorkFlowLike; +import com.mcwl.resource.domain.vo.ModelLikeVo; +import com.mcwl.resource.domain.vo.WorkFlowLikeVo; import com.mcwl.resource.mapper.WorkFlowLikeMapper; import com.mcwl.resource.mapper.WorkFlowMapper; import com.mcwl.resource.service.WorkFlowLikeService; +import com.mcwl.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.Objects; /** @@ -31,6 +46,9 @@ public class WorkFlowLikeServiceImpl extends ServiceImpl page = initPage(pageDomain); + + + baseMapper.selectPage(page, null); + + List workFlowLikeList = page.getRecords(); + List modelLikeVoList = new ArrayList<>(); + for (WorkFlowLike workFlowLike : workFlowLikeList) { + WorkFlowLikeVo workFlowLikeVo = new WorkFlowLikeVo(); + BeanUtil.copyProperties(workFlowLike, workFlowLikeVo); + + // 获取用户信息 + SysUser sysUser = sysUserService.selectUserById(workFlowLike.getUserId()); + workFlowLikeVo.setUserName(sysUser.getUserName()); + workFlowLikeVo.setUserAvatar(sysUser.getAvatar()); + + // 获取工作流信息 + WorkFlow workFlow = workFlowMapper.selectById(workFlowLike.getWorkFlowId()); + workFlowLikeVo.setConverPath(workFlow.getCoverPath()); + workFlowLikeVo.setLikeNum(workFlow.getLikeCount()); + + modelLikeVoList.add(workFlowLikeVo); + } + + + TableDataInfo tableDataInfo = new TableDataInfo(); + tableDataInfo.setRows(modelLikeVoList); + tableDataInfo.setTotal(page.getTotal()); + tableDataInfo.setCode(HttpStatus.SUCCESS); + tableDataInfo.setMsg("查询成功"); + + return tableDataInfo; + } + + + private Page initPage(PageDomain pageDomain) { + Page page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize()); + if (StringUtils.isBlank(pageDomain.getOrderByColumn())) { + pageDomain.setOrderByColumn("create_time"); + } + OrderItem orderItem = OrderItem.desc(pageDomain.getOrderByColumn()); + page.addOrder(orderItem); + + return page; + } + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java index 0b0e301..9e4dfe7 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/WorkFlowServiceImpl.java @@ -349,13 +349,12 @@ public class WorkFlowServiceImpl extends ServiceImpl i imagePageRes.setOrderByColumn("create_time"); } // 设置排序 - boolean isAsc = Objects.equals(imagePageRes.getIsAsc(), "asc"); - OrderItem orderItem = new OrderItem(imagePageRes.getOrderByColumn(), isAsc); + OrderItem orderItem = OrderItem.desc(imagePageRes.getOrderByColumn()); page.addOrder(orderItem); LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); lqw.eq(imagePageRes.getStatus() != null, WorkFlow::getAuditStatus, imagePageRes.getStatus()) - .eq(imagePageRes.getUserId() != null, WorkFlow::getUserId, imagePageRes.getUserId()) + .eq(WorkFlow::getUserId, SecurityUtils.getUserId()) .ge(imagePageRes.getStartTime() != null, WorkFlow::getCreateTime, imagePageRes.getStartTime()) .le(imagePageRes.getEndTime() != null, WorkFlow::getCreateTime, imagePageRes.getEndTime());