From c8bc8356448efdee5dd9c9e819a7aecac06b436c Mon Sep 17 00:00:00 2001 From: ChenYan <3139166962@qq.com> Date: Mon, 13 Jan 2025 15:12:50 +0800 Subject: [PATCH] feat: --- .../resource/MallProductController.java | 20 ++++++ .../resource/WorkFlowController.java | 3 + .../resource/domain/request/RequestModel.java | 31 +++++++++ .../resource/mapper/MallProductMapper.java | 1 + .../resource/mapper/ModelVersionMapper.java | 8 +++ .../mcwl/resource/service/ModelService.java | 7 ++ .../service/impl/MallProductServiceImpl.java | 47 +++++++++++++ .../mapper/resource/MallProductMapper.xml | 67 ++++++++++++++++++- .../mapper/resource/ModelVersionMapper.xml | 30 +++++++++ 9 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java create mode 100644 mcwl-resource/src/main/resources/mapper/resource/ModelVersionMapper.xml 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 25621ee..3c863b2 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 @@ -7,6 +7,8 @@ import com.mcwl.common.core.page.TableDataInfo; 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.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.MallProductVo; import com.mcwl.resource.service.ModelService; import com.mcwl.system.service.ISysUserService; @@ -123,6 +125,24 @@ public class MallProductController extends BaseController { return AjaxResult.success(); } + + + + @PostMapping("/insert") + public AjaxResult addupdateModel(@RequestBody RequestModel requestModel){ + + return modelService.addModel(requestModel); + } + + @PostMapping("/update") + public AjaxResult updateModel(@RequestBody RequestModel requestModel){ + + modelService.updaModel(requestModel); + + return AjaxResult.success("修改成功"); + } + + @PostMapping("delete") public AjaxResult delete(@RequestBody ModelProduct modelVersion) { 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 b2bfc54..516e7d8 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 @@ -79,4 +79,7 @@ public class WorkFlowController extends BaseController { return AjaxResult.success("修改成功"); } + + + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java new file mode 100644 index 0000000..288f3e8 --- /dev/null +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/request/RequestModel.java @@ -0,0 +1,31 @@ +package com.mcwl.resource.domain.request; + +import com.mcwl.resource.domain.ModelProduct; +import com.mcwl.resource.domain.ModelVersion; +import com.mcwl.resource.domain.WorkFlow; +import com.mcwl.resource.domain.WorkFlowVersion; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * 模型入参 模型+版本 + * @author DaiZibo + * @date 2025/1/9 + * @apiNote + */ + +@Builder +@AllArgsConstructor +@NoArgsConstructor +@Data +public class RequestModel { + + private ModelProduct modelProduct; + + private List modelVersionList; + +} diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/MallProductMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/MallProductMapper.java index c0c28b1..394a47d 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/MallProductMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/MallProductMapper.java @@ -27,5 +27,6 @@ public interface MallProductMapper extends BaseMapper { Long sumNumber(@Param("userId") Long userId); + void updateModel(ModelProduct modelProduct); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java index f2e243f..e495c36 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ModelVersionMapper.java @@ -1,8 +1,12 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.ModelVersion; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @Author:ChenYan @@ -14,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ModelVersionMapper extends BaseMapper { + void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List modelVersionList); + + + } 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 6c7d52d..2b39c16 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,11 +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.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.request.RequestModel; import com.mcwl.resource.domain.vo.MallProductVo; import java.util.List; @@ -27,4 +29,9 @@ public interface ModelService extends IService { TableDataInfo listByPage(ModelImagePageRes imagePageRes); + AjaxResult addModel(RequestModel requestModel); + + + void updaModel(RequestModel requestModel); + } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/MallProductServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/MallProductServiceImpl.java index 17ba144..3579566 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/MallProductServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/MallProductServiceImpl.java @@ -4,9 +4,11 @@ import cn.hutool.core.bean.BeanUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.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.core.redis.RedisCache; @@ -15,13 +17,20 @@ import com.mcwl.common.utils.SecurityUtils; import com.mcwl.common.utils.StringUtils; import com.mcwl.resource.domain.ModelImage; import com.mcwl.resource.domain.ModelProduct; +import com.mcwl.resource.domain.ModelVersion; +import com.mcwl.resource.domain.WorkFlowVersion; import com.mcwl.resource.domain.dto.ModelImagePageRes; +import com.mcwl.resource.domain.request.RequestModel; +import com.mcwl.resource.domain.request.RequestWorkFlow; import com.mcwl.resource.domain.vo.MallProductVo; import com.mcwl.resource.domain.vo.ModelImageVo; import com.mcwl.resource.mapper.MallProductMapper; +import com.mcwl.resource.mapper.ModelVersionMapper; import com.mcwl.resource.service.ModelService; import com.mcwl.system.service.ISysUserService; +import lombok.extern.log4j.Log4j; +import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,11 +47,14 @@ import java.util.Objects; * @Description TODO * @Date:2024/12/30 18:22 */ +@Log4j2 @Service public class MallProductServiceImpl extends ServiceImpl implements ModelService { @Autowired private RedisCache redisCache; + @Autowired + private ModelVersionMapper modelVersionMapper; @Autowired private MallProductMapper postMapper; @Autowired @@ -137,6 +149,41 @@ public class MallProductServiceImpl extends ServiceImpl - + + update model + + + model_name = #{modelName}, + + + version_description = #{versionDescription}, + + + update_by = #{updateBy}, + + + update_time = #{updateTime}, + + + model_type_id = #{modelTypeId}, + + + category = #{category}, + + + functions = #{functions}, + + + tags = #{tags}, + + + activity_id = #{activityId}, + + + is_original = #{isOriginal}, + + + original_author_name = #{originalAuthorName}, + + + reals = #{reals}, + + + numbers = #{numbers}, + + + audit_satus = #{auditSatus}, + + + is_recommend = #{isRecommend}, + + + del_flag = #{delFlag}, + + + remark = #{remark}, + + + audit_text = #{auditText}, + + + user_id = #{userId}, + + + version_id = #{versionId}, + + + where id = #{id} +