feat:
parent
9ef5a22665
commit
c8bc835644
|
@ -7,6 +7,8 @@ import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
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.MallProductVo;
|
||||||
import com.mcwl.resource.service.ModelService;
|
import com.mcwl.resource.service.ModelService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
import com.mcwl.system.service.ISysUserService;
|
||||||
|
@ -123,6 +125,24 @@ public class MallProductController extends BaseController {
|
||||||
return AjaxResult.success();
|
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")
|
@PostMapping("delete")
|
||||||
public AjaxResult delete(@RequestBody ModelProduct modelVersion)
|
public AjaxResult delete(@RequestBody ModelProduct modelVersion)
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,4 +79,7 @@ public class WorkFlowController extends BaseController {
|
||||||
|
|
||||||
return AjaxResult.success("修改成功");
|
return AjaxResult.success("修改成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<ModelVersion> modelVersionList;
|
||||||
|
|
||||||
|
}
|
|
@ -27,5 +27,6 @@ public interface MallProductMapper extends BaseMapper<ModelProduct> {
|
||||||
Long sumNumber(@Param("userId") Long userId);
|
Long sumNumber(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
|
||||||
|
void updateModel(ModelProduct modelProduct);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package com.mcwl.resource.mapper;
|
package com.mcwl.resource.mapper;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.ModelVersion;
|
import com.mcwl.resource.domain.ModelVersion;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author:ChenYan
|
* @Author:ChenYan
|
||||||
|
@ -14,4 +18,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
|
||||||
|
void addModelVersion(@Param("modelProduct") ModelProduct modelProduct, @Param("modelVersionList") List<ModelVersion> modelVersionList);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,13 @@ package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
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.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.domain.IdsParam;
|
import com.mcwl.common.domain.IdsParam;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.ModelVersion;
|
import com.mcwl.resource.domain.ModelVersion;
|
||||||
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
import com.mcwl.resource.domain.dto.ModelImagePageRes;
|
||||||
|
import com.mcwl.resource.domain.request.RequestModel;
|
||||||
import com.mcwl.resource.domain.vo.MallProductVo;
|
import com.mcwl.resource.domain.vo.MallProductVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -27,4 +29,9 @@ public interface ModelService extends IService<ModelProduct> {
|
||||||
|
|
||||||
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
|
TableDataInfo listByPage(ModelImagePageRes imagePageRes);
|
||||||
|
|
||||||
|
AjaxResult addModel(RequestModel requestModel);
|
||||||
|
|
||||||
|
|
||||||
|
void updaModel(RequestModel requestModel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.OrderItem;
|
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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mcwl.common.constant.HttpStatus;
|
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.domain.entity.SysUser;
|
||||||
import com.mcwl.common.core.page.TableDataInfo;
|
import com.mcwl.common.core.page.TableDataInfo;
|
||||||
import com.mcwl.common.core.redis.RedisCache;
|
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.common.utils.StringUtils;
|
||||||
import com.mcwl.resource.domain.ModelImage;
|
import com.mcwl.resource.domain.ModelImage;
|
||||||
import com.mcwl.resource.domain.ModelProduct;
|
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.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.MallProductVo;
|
||||||
import com.mcwl.resource.domain.vo.ModelImageVo;
|
import com.mcwl.resource.domain.vo.ModelImageVo;
|
||||||
import com.mcwl.resource.mapper.MallProductMapper;
|
import com.mcwl.resource.mapper.MallProductMapper;
|
||||||
|
|
||||||
|
import com.mcwl.resource.mapper.ModelVersionMapper;
|
||||||
import com.mcwl.resource.service.ModelService;
|
import com.mcwl.resource.service.ModelService;
|
||||||
import com.mcwl.system.service.ISysUserService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -38,11 +47,14 @@ import java.util.Objects;
|
||||||
* @Description TODO
|
* @Description TODO
|
||||||
* @Date:2024/12/30 18:22
|
* @Date:2024/12/30 18:22
|
||||||
*/
|
*/
|
||||||
|
@Log4j2
|
||||||
@Service
|
@Service
|
||||||
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements ModelService {
|
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements ModelService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisCache redisCache;
|
private RedisCache redisCache;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ModelVersionMapper modelVersionMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MallProductMapper postMapper;
|
private MallProductMapper postMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -137,6 +149,41 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelP
|
||||||
return rspData;
|
return rspData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult addModel(RequestModel requestModel) {
|
||||||
|
//添加模型表数据
|
||||||
|
postMapper.insert(requestModel.getModelProduct());
|
||||||
|
|
||||||
|
log.info("获取到的入参:{}",requestModel.getModelProduct());
|
||||||
|
|
||||||
|
//批量添加版本
|
||||||
|
modelVersionMapper.addModelVersion(requestModel.getModelProduct(),requestModel.getModelVersionList());
|
||||||
|
|
||||||
|
return AjaxResult.success("添加成功,等待审核");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updaModel(RequestModel requestModel) {
|
||||||
|
//修改模版的信息
|
||||||
|
ModelProduct modelProduct = requestModel.getModelProduct();
|
||||||
|
if (ObjectUtils.isEmpty(modelProduct)){
|
||||||
|
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotNull(modelProduct.getId())){
|
||||||
|
modelProduct.setAuditSatus(3);
|
||||||
|
postMapper.updateModel(requestModel.getModelProduct());
|
||||||
|
}
|
||||||
|
|
||||||
|
//修改工作流版本的信息
|
||||||
|
if (requestModel.getModelVersionList().size() != 0){
|
||||||
|
|
||||||
|
//批量修改
|
||||||
|
for (ModelVersion modelVersion : requestModel.getModelVersionList()) {
|
||||||
|
modelVersion.setAuditSatus(3);
|
||||||
|
modelVersionMapper.updateById(modelVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,72 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.mcwl.resource.mapper.MallProductMapper">
|
<mapper namespace="com.mcwl.resource.mapper.MallProductMapper">
|
||||||
|
<update id="updateModel">
|
||||||
|
update model
|
||||||
|
<set>
|
||||||
|
<if test="modelName != null and modelName != ''">
|
||||||
|
model_name = #{modelName},
|
||||||
|
</if>
|
||||||
|
<if test="versionDescription != null and versionDescription != ''">
|
||||||
|
version_description = #{versionDescription},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy != null and updateBy != ''">
|
||||||
|
update_by = #{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime},
|
||||||
|
</if>
|
||||||
|
<if test="modelTypeId != null">
|
||||||
|
model_type_id = #{modelTypeId},
|
||||||
|
</if>
|
||||||
|
<if test="category != null and category != ''">
|
||||||
|
category = #{category},
|
||||||
|
</if>
|
||||||
|
<if test="functions != null and functions != ''">
|
||||||
|
functions = #{functions},
|
||||||
|
</if>
|
||||||
|
<if test="tags != null and tags != ''">
|
||||||
|
tags = #{tags},
|
||||||
|
</if>
|
||||||
|
<if test="activityId != null and activityId != ''">
|
||||||
|
activity_id = #{activityId},
|
||||||
|
</if>
|
||||||
|
<if test="isOriginal != null">
|
||||||
|
is_original = #{isOriginal},
|
||||||
|
</if>
|
||||||
|
<if test="originalAuthorName != null and originalAuthorName != ''">
|
||||||
|
original_author_name = #{originalAuthorName},
|
||||||
|
</if>
|
||||||
|
<if test="reals != null">
|
||||||
|
reals = #{reals},
|
||||||
|
</if>
|
||||||
|
<if test="numbers != null">
|
||||||
|
numbers = #{numbers},
|
||||||
|
</if>
|
||||||
|
<if test="auditSatus != null">
|
||||||
|
audit_satus = #{auditSatus},
|
||||||
|
</if>
|
||||||
|
<if test="isRecommend != null">
|
||||||
|
is_recommend = #{isRecommend},
|
||||||
|
</if>
|
||||||
|
<if test="delFlag != null and delFlag != ''">
|
||||||
|
del_flag = #{delFlag},
|
||||||
|
</if>
|
||||||
|
<if test="remark != null and remark != ''">
|
||||||
|
remark = #{remark},
|
||||||
|
</if>
|
||||||
|
<if test="auditText != null and auditText != ''">
|
||||||
|
audit_text = #{auditText},
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
user_id = #{userId},
|
||||||
|
</if>
|
||||||
|
<if test="versionId != null">
|
||||||
|
version_id = #{versionId},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="sumNumber" resultType="java.lang.Long">
|
<select id="sumNumber" resultType="java.lang.Long">
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.mcwl.resource.mapper.ModelVersionMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="addModelVersion">
|
||||||
|
INSERT INTO model_version (
|
||||||
|
version_name, model_type, file_path, trigger_words, sampling, high, vae, cfg,
|
||||||
|
is_free, is_public, is_encrypt, is_online_use, allow_download_image,
|
||||||
|
allow_software_use, allow_fusion, allow_commercial_use, allow_usage,
|
||||||
|
is_exclusive_model, sample_image_paths, hide_image_gen_info, audit_status,
|
||||||
|
audit_text, del_flag
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.versionName}, #{item.modelType}, #{item.filePath}, #{item.triggerWords},
|
||||||
|
#{item.sampling}, #{item.high}, #{item.vae}, #{item.cfg},
|
||||||
|
#{item.isFree}, #{item.isPublic}, #{item.isEncrypt}, #{item.isOnlineUse},
|
||||||
|
#{item.allowDownloadImage}, #{item.allowSoftwareUse}, #{item.allowFusion},
|
||||||
|
#{item.allowCommercialUse}, #{item.allowUsage}, #{item.isExclusiveModel},
|
||||||
|
#{item.sampleImagePaths}, #{item.hideImageGenInfo}, #{item.auditStatus},
|
||||||
|
#{item.auditText}, #{item.delFlag}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue