From 05f8858b6c65bbab93092019ffc5320f88698b38 Mon Sep 17 00:00:00 2001 From: Diyu0904 <1819728964@qq.com> Date: Sat, 15 Feb 2025 14:56:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9E=8B=E5=B9=BF?= =?UTF-8?q?=E5=9C=BA=EF=BC=8C=E5=B7=A5=E4=BD=9C=E6=B5=81=EF=BC=8C=E4=BD=9C?= =?UTF-8?q?=E5=93=81=E7=81=B5=E6=84=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resource/MallProductController.java | 13 +++ .../resource/ModelImageController.java | 17 +++- .../resource/WorkFlowController.java | 20 ++++- .../mcwl/common/constant/DictConstants.java | 5 ++ .../domain/response/ResponseModelImage.java | 68 +++++++++++++++ .../domain/response/ResponseModelProduct.java | 83 +++++++++++++++++++ .../domain/response/ResponseWorkFlow.java | 83 +++++++++++++++++++ .../resource/mapper/ModelImageMapper.java | 4 + .../com/mcwl/resource/mapper/ModelMapper.java | 3 + .../mcwl/resource/mapper/WorkFlowMapper.java | 5 +- .../service/ModelImageLikeService.java | 8 +- .../mcwl/resource/service/ModelService.java | 8 +- .../resource/service/WorkFlowService.java | 5 +- .../service/impl/FileServiceImpl.java | 2 +- .../impl/ModelImageLikeServiceImpl.java | 30 +++++++ .../service/impl/ModelServiceImpl.java | 24 +++++- .../service/impl/WorkFlowServiceImpl.java | 16 ++++ .../mapper/resource/ModelImageMapper.xml | 27 +++++- .../resources/mapper/resource/ModelMapper.xml | 13 +++ .../mapper/resource/WorkFlowMapper.xml | 22 ++++- 20 files changed, 435 insertions(+), 21 deletions(-) create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelImage.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelProduct.java create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseWorkFlow.java 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 d796ba9..c13dfee 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 @@ -1,6 +1,7 @@ package com.mcwl.web.controller.resource; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.github.pagehelper.PageInfo; import com.mcwl.common.core.controller.BaseController; import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; @@ -10,7 +11,9 @@ import com.mcwl.common.utils.SecurityUtils; import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.response.ResponseModelProduct; import com.mcwl.resource.domain.request.RequestModel; +import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.ModelVersionMapper; import com.mcwl.resource.service.*; import io.swagger.annotations.Api; @@ -221,5 +224,15 @@ public class MallProductController extends BaseController { return modelImageLikeService.listByPage(pageDomain); } + /** + * 模型广场 + */ + @ApiOperation(value = "模型广场列表") + @PostMapping("/modelSquare") + public R modelSquare(@RequestBody PageVo pageVo) { + PageInfo modelProductPage = modelService.modelSquare(pageVo); + return R.ok(modelProductPage); + } + } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java index 5b933d5..feed5ca 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ModelImageController.java @@ -1,22 +1,23 @@ package com.mcwl.web.controller.resource; import cn.hutool.core.bean.BeanUtil; +import com.github.pagehelper.PageInfo; import com.mcwl.common.annotation.RepeatSubmit; -import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; 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.dto.ModelImagePageRes; import com.mcwl.resource.domain.dto.ModelImageRes; +import com.mcwl.resource.domain.response.ResponseModelImage; import com.mcwl.resource.domain.vo.ModelImageVo; +import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.service.ModelImageLikeService; import com.mcwl.resource.service.ModelImageService; import com.mcwl.system.service.ISysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; @@ -132,4 +133,16 @@ public class ModelImageController { return R.ok(models); } + /** + * 作品灵感 + * + * @return + */ + @ApiOperation(value = "作品灵感") + @GetMapping("/imageList") + public R> imageList(PageVo pageVo) { + PageInfo models = modelImageLikeService.imageList(pageVo); + return R.ok(models); + } + } diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java index 21c728c..4b9fdf6 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/WorkFlowController.java @@ -1,19 +1,18 @@ package com.mcwl.web.controller.resource; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.pagehelper.PageInfo; import com.mcwl.common.core.controller.BaseController; -import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; +import com.mcwl.resource.domain.response.ResponseWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.service.WorkFlowService; -import com.mcwl.resource.service.impl.WorkFlowServiceImpl; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -168,4 +167,19 @@ public class WorkFlowController extends BaseController { return workFlowService.selectWorkFlowVersionById(id); } + /** + * 工作流列表 + * + * @return + */ + @ApiOperation(value = "工作流列表") + @PostMapping("/workFlowList") + public R> workFlowList(@RequestBody PageVo pageVo) { + + PageInfo responseWorkFlowPageInfo = workFlowService.workFlowList(pageVo); + return R.ok(responseWorkFlowPageInfo); + } + + + } diff --git a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java index 711afd7..a10291b 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java +++ b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java @@ -61,4 +61,9 @@ public class DictConstants { */ public static final String WORK_FLOW_TYPE_CHILD = "work_flow_type_child"; + /** + * 模型类型 + */ + public static final String MODEL_TYPE = "model_type"; + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelImage.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelImage.java new file mode 100644 index 0000000..1498c69 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelImage.java @@ -0,0 +1,68 @@ +package com.mcwl.resource.domain.response; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 作品灵感出参 + * + * @author DaiZibo + * @date 2025/2/15 + * @apiNote + */ + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResponseModelImage { + /** + * 主键ID + */ + @ApiModelProperty(value = "主键ID") + @TableId + private Long id; + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + private Long userId; + /** + * 图片地址(最多8张,切割) + */ + @ApiModelProperty(value = "图片地址(最多8张,切割)") + private String imagePaths; + + /** + * 封面图 + */ + @ApiModelProperty(value = "封面图") + private String path; + + /** + * 点赞数 + */ + @ApiModelProperty(value = "点赞数") + private Integer likeNum; + + /** + * 作品发布人 + */ + @ApiModelProperty(value = "作品发布人") + private String nickName; + + /** + * 发布人头像 + */ + @ApiModelProperty(value = "发布人头像") + private String avatar; + + + /** + * 作品是否点赞 0未点赞 1点赞 + */ + @ApiModelProperty(value = "作品是否点赞 0未点赞 1点赞") + private Integer isLike; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelProduct.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelProduct.java new file mode 100644 index 0000000..5d1e35b --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseModelProduct.java @@ -0,0 +1,83 @@ +package com.mcwl.resource.domain.response; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 模型广场出参 + * + * @author DaiZibo + * @date 2025/2/15 + * @apiNote + */ + +@NoArgsConstructor +@AllArgsConstructor +@Data +public class ResponseModelProduct { + /** + * 主键ID + */ + @ApiModelProperty(value = "主键ID") + @TableId + private Long id; + /** + * 名称 + */ + @ApiModelProperty(value = "名称") + private String modelName; + /*** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private Long userId; + /** + * 模型类型 + */ + @ApiModelProperty(value = "模型类型") + private Long modelType; + + /** + * 生图次数 + */ + @ApiModelProperty(value = "生成图次数") + private Integer reals; + /** + * 封面图 + */ + @ApiModelProperty(value = "封面图") + private String surfaceUrl; + /** + * 下载次数 + */ + @ApiModelProperty(value = "下载次数") + private Integer numbers; + /** + * 点赞数 + */ + @ApiModelProperty(value = "点赞数") + private Integer likeNum; + + + /** + * 翻译后类型 + */ + @ApiModelProperty(value = "翻译后类型") + private String type; + + /** + * 作品发布人 + */ + @ApiModelProperty(value = "作品发布人") + private String nickName; + + /** + * 发布人头像 + */ + @ApiModelProperty(value = "发布人头像") + private String avatar; + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseWorkFlow.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseWorkFlow.java new file mode 100644 index 0000000..164db5e --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/response/ResponseWorkFlow.java @@ -0,0 +1,83 @@ +package com.mcwl.resource.domain.response; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 工作流广场出参 + * + * @author DaiZibo + * @date 2025/2/15 + * @apiNote + */ + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ResponseWorkFlow { + + /** + * 主键ID + */ + @ApiModelProperty(value = "主键ID") + @TableId + private Long id; + /** + * 用户id + */ + @ApiModelProperty(value = "用户id") + private Long userId; + /** + * 名称(最多30字) + */ + @ApiModelProperty(value = "名称(最多30字)") + private String workflowName; + + /** + * 功能 + */ + @ApiModelProperty(value = "类别") + private String type; + + + /** + * 使用数量 + */ + @ApiModelProperty(value = "使用数量") + private Long useNumber = 0L; + + /** + * 下载数量 + */ + @ApiModelProperty(value = "下载数量") + private Long downloadNumber = 0L; + + + /** + * 封面图地址 + */ + @ApiModelProperty(value = "封面图地址") + private String coverPath; + + + /** + * 作品点赞数量 + */ + @ApiModelProperty(value = "作品点赞数量") + private Integer likeCount = 0; + + /** + * 作品发布人 + */ + @ApiModelProperty(value = "作品发布人") + private String nickName; + + /** + * 发布人头像 + */ + @ApiModelProperty(value = "发布人头像") + private String avatar; +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelImageMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelImageMapper.java index ffa8c52..50772da 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelImageMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelImageMapper.java @@ -2,6 +2,8 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.ModelImage; +import com.mcwl.resource.domain.response.ResponseModelImage; +import com.mcwl.resource.domain.vo.PageVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -16,4 +18,6 @@ public interface ModelImageMapper extends BaseMapper { void setModelImageTop(@Param("id") Long id, @Param("isTop") int i); + List imageList(PageVo pageVo); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelMapper.java index 89658da..21b67f7 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelMapper.java @@ -3,6 +3,8 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.ModelProduct; +import com.mcwl.resource.domain.response.ResponseModelProduct; +import com.mcwl.resource.domain.vo.PageVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -35,5 +37,6 @@ public interface ModelMapper extends BaseMapper { List selectAllModelsSortedByTopStatus(); + List modelSquare(PageVo pageVo); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java index 73441bc..e71603c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/WorkFlowMapper.java @@ -2,6 +2,8 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.WorkFlow; +import com.mcwl.resource.domain.response.ResponseWorkFlow; +import com.mcwl.resource.domain.vo.PageVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -21,7 +23,8 @@ public interface WorkFlowMapper extends BaseMapper { List fetchWorkFlowSortedByTopStatus(); - void setworkFlowTop(@Param("id") Long id, @Param("i") int i); + List workFlowList(PageVo pageVo); + } 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 7d99fa0..33b5ffe 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,11 +1,13 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.github.pagehelper.PageInfo; 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 com.mcwl.resource.domain.response.ResponseModelImage; +import com.mcwl.resource.domain.vo.PageVo; import java.util.List; @@ -25,4 +27,8 @@ public interface ModelImageLikeService extends IService { * @return 分页数据 */ TableDataInfo listByPage(PageDomain pageDomain); + + + PageInfo imageList(PageVo pageVo); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java index 3529122..1fa207c 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ModelService.java @@ -2,15 +2,15 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import com.mcwl.common.core.domain.AjaxResult; +import com.github.pagehelper.PageInfo; import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; -import com.mcwl.common.domain.IdsParam; import com.mcwl.resource.domain.ModelProduct; -import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.response.ResponseModelProduct; import com.mcwl.resource.domain.request.RequestModel; import com.mcwl.resource.domain.vo.MallProductVo; +import com.mcwl.resource.domain.vo.PageVo; import java.util.List; @@ -42,5 +42,5 @@ public interface ModelService extends IService { List fetchModelsSortedByTopStatus(); - + PageInfo modelSquare(PageVo pageVo); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java index 362dab5..8df67ca 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/WorkFlowService.java @@ -2,12 +2,13 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import com.mcwl.common.core.domain.AjaxResult; +import com.github.pagehelper.PageInfo; import com.mcwl.common.core.domain.R; import com.mcwl.common.core.page.TableDataInfo; import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.response.ResponseWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.PageVo; @@ -42,4 +43,6 @@ public interface WorkFlowService extends IService { Long selectWorkFlowByName(String name); R selectWorkFlowVersionById(Long id); + + PageInfo workFlowList(PageVo pageVo); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java index 865ec1a..e5089da 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/FileServiceImpl.java @@ -36,7 +36,7 @@ public class FileServiceImpl implements FileService { } return AjaxResult.success(modelVersion); - }else if (type.equals("work")){ + }else if (type.equals("workFlow")){ WorkFlowVersion workFlowVersion = workFlowVersionMapper.selectByFileName(name); if (workFlowVersion == null) { 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 d939e69..615ef7f 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 @@ -4,6 +4,8 @@ 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.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.PageDomain; @@ -13,7 +15,9 @@ 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.response.ResponseModelImage; import com.mcwl.resource.domain.vo.ModelImageLikeVo; +import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.ModelImageLikeMapper; import com.mcwl.resource.mapper.ModelImageMapper; import com.mcwl.resource.service.ModelImageLikeService; @@ -150,4 +154,30 @@ public class ModelImageLikeServiceImpl extends ServiceImpl imageList(PageVo pageVo) { + + PageHelper pageHelper = new PageHelper(); + pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize()); + + List responseModelImageList = modelImageMapper.imageList(pageVo); + for (ResponseModelImage responseModelImage : responseModelImageList) { + + String[] split = responseModelImage.getImagePaths().split(","); + responseModelImage.setPath(split[0]); + + //查询模型是否点赞 + ModelImageLike likeImage = baseMapper.getLikeImage(SecurityUtils.getUserId(), responseModelImage.getId()); + if (likeImage == null){ + responseModelImage.setIsLike(0); + }else { + responseModelImage.setIsLike(1); + } + } + + return new PageInfo<>(responseModelImageList); + + } + } 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 aa6eb78..a5f312c 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 @@ -8,12 +8,12 @@ import com.baomidou.mybatisplus.core.metadata.OrderItem; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageInfo; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.R; import com.mcwl.common.core.domain.entity.SysUser; import com.mcwl.common.core.page.TableDataInfo; -import com.mcwl.common.core.redis.RedisCache; import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.StringUtils; import com.mcwl.common.utils.baidu.BaiduCensor; @@ -22,9 +22,11 @@ import com.mcwl.resource.domain.ModelVersion; import com.mcwl.resource.domain.SysUserAttention; import com.mcwl.resource.domain.WorkFlowLike; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.response.ResponseModelProduct; import com.mcwl.resource.domain.request.RequestModel; import com.mcwl.resource.domain.vo.MallProductVo; import com.mcwl.resource.domain.vo.ModelVo; +import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.mapper.ModelLikeMapper; import com.mcwl.resource.mapper.ModelMapper; import com.mcwl.resource.mapper.ModelVersionMapper; @@ -55,8 +57,6 @@ import java.util.Objects; @Log4j2 @Service public class ModelServiceImpl extends ServiceImpl implements ModelService { - @Autowired - private RedisCache redisCache; @Autowired private ToActivityService toActivityService; @@ -97,6 +97,24 @@ public class ModelServiceImpl extends ServiceImpl impl public List fetchModelsSortedByTopStatus() { return postMapper.selectAllModelsSortedByTopStatus(); } + + @Override + public PageInfo modelSquare(PageVo pageVo) { + PageInfo page = new PageInfo<>(); + page.setPageNum(pageVo.getPageNumber()); + page.setPages(pageVo.getPageSize()); + + List responseModelProductList = postMapper.modelSquare(pageVo); + for (ResponseModelProduct responseModelProduct : responseModelProductList) { + if (responseModelProduct.getModelType() != null){ + + responseModelProduct.setType(DictInit.getDictValue(DictConstants.MODEL_TYPE,responseModelProduct.getModelType()+"")); + } + } + + return new PageInfo(responseModelProductList); + } + @Override public Page selectByUserId(MallProductVo mallProductVo) { 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 af621c6..56f342a 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 @@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import com.mcwl.common.constant.DictConstants; import com.mcwl.common.constant.HttpStatus; import com.mcwl.common.core.domain.R; @@ -23,6 +25,7 @@ import com.mcwl.resource.domain.WorkFlowLike; import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.domain.dto.AddRequestWorkFlow; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.response.ResponseWorkFlow; import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.PageVo; import com.mcwl.resource.domain.vo.WorkFlowVo; @@ -499,5 +502,18 @@ public class WorkFlowServiceImpl extends ServiceImpl i return R.ok(requestWorkFlow); } + @Override + public PageInfo workFlowList(PageVo pageVo) { + + PageHelper pageHelper = new PageHelper(); + pageHelper.startPage(pageVo.getPageNumber(),pageVo.getPageSize()); + + List responseWorkFlowList = baseMapper.workFlowList(pageVo); + + + return new PageInfo(responseWorkFlowList); + + } + } diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelImageMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelImageMapper.xml index 911fc07..1af011e 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelImageMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelImageMapper.xml @@ -4,14 +4,35 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - UPDATE model_image SET is_top = #{isTop} WHERE id = #{id} + UPDATE model_image + SET is_top = #{isTop} + WHERE id = #{id} - SELECT is_top FROM model_image ORDER BY is_top DESC; + SELECT is_top + FROM model_image + ORDER BY is_top DESC; + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml index 63dd924..3c23772 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/ModelMapper.xml @@ -88,4 +88,17 @@ SELECT is_top FROM model ORDER BY is_top DESC; + + diff --git a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml index ed6fd35..24370ed 100644 --- a/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml +++ b/mcwl-resource/src/main/resources/mapper/resource/WorkFlowMapper.xml @@ -32,10 +32,28 @@ WHERE id = #{id} - UPDATE work_flow SET is_top = #{i} WHERE id = #{id} + UPDATE work_flow + SET is_top = #{i} + WHERE id = #{id} + +