Merge remote-tracking branch 'origin/feature/resource' into preview

feature/comment
ChenYan 2025-01-11 14:53:56 +08:00
commit 75cdc9ea16
19 changed files with 499 additions and 217 deletions

View File

@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.common.domain.IdsParam;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.service.MallProductService;
import com.mcwl.resource.service.ModelService;
import com.mcwl.web.controller.common.OssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -26,16 +27,13 @@ import java.util.List;
*/
@RestController
@RequestMapping("/MallProduct")
@RequestMapping("/model")
public class MallProductController extends BaseController {
private final MallProductService mallProductRuleInfoService;
public MallProductController(MallProductService mallProductService) {
this.mallProductRuleInfoService = mallProductService;
}
@Autowired
private ModelService modelService;
/***
@ -90,50 +88,46 @@ public class MallProductController extends BaseController {
public TableDataInfo list(@RequestBody ModelProduct mallProduct)
{
startPage();
List<ModelProduct> list = mallProductRuleInfoService.selectMallProductList(mallProduct);
List<ModelProduct> list = modelService.selectMallProductList(mallProduct);
return getDataTable(list);
}
/**
*
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long Id)
@PostMapping("finbyid")
public AjaxResult finbyid(@RequestBody ModelProduct modelVersion)
{
return success(mallProductRuleInfoService.getById(Id));
ModelProduct modelVersion1 = modelService.getById(modelVersion.getId());
return AjaxResult.success(modelVersion1);
}
/**
*
*/
@PostMapping("/add")
public AjaxResult add(@RequestBody ModelProduct mallProduct)
@PostMapping("insert")
public AjaxResult insert(@RequestBody ModelProduct modelVersion)
{
return toAjax(mallProductRuleInfoService.insertMallProduct(mallProduct));
Long userId = SecurityUtils.getUserId();
modelVersion.setUserId(userId);
modelVersion.setCreateBy(getUsername());
modelService.save(modelVersion);
return AjaxResult.success();
}
/**
*
*/
@PutMapping("/upda")
public AjaxResult edit(@RequestBody ModelProduct mallProduct)
@PostMapping("update")
public AjaxResult update(@RequestBody ModelProduct modelVersion)
{
mallProduct.setUpdateBy(getUsername());
return toAjax(mallProductRuleInfoService.updateMallProduct(mallProduct));
Long userId = SecurityUtils.getUserId();
modelVersion.setUserId(userId);
modelVersion.setUpdateBy(getUsername());
modelService.updateById(modelVersion);
return AjaxResult.success();
}
/**
*
*/
@PostMapping
public AjaxResult remove(@RequestBody IdsParam ids)
@PostMapping("delete")
public AjaxResult delete(@RequestBody ModelProduct modelVersion)
{
mallProductRuleInfoService.deleteMallProductByIds(ids);
return success();
modelService.removeById(modelVersion.getId());
return AjaxResult.success();
}
/**
@ -143,7 +137,7 @@ public class MallProductController extends BaseController {
@PostMapping("/selectByUserId")
public AjaxResult selectByUserId(@RequestBody MallProductVo mallProductVo){
Page<ModelProduct> mallProductList = mallProductRuleInfoService.selectByUserId(mallProductVo);
Page<ModelProduct> mallProductList = modelService.selectByUserId(mallProductVo);
return AjaxResult.success(mallProductList);
}

View File

@ -0,0 +1,118 @@
package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.service.ModelVersionService;
import com.mcwl.web.controller.common.OssUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.web.controller.resource
* @FilenameModelVersionController
* @Description TODO
* @Date2025/1/9 16:47
*/
@RestController
@RequestMapping("ModelVersion")
public class ModelVersionController extends BaseController {
@Autowired
private ModelVersionService modelVersionService;
/***
*
*
* @param file
* @return
*/
@PostMapping("/file")
public AjaxResult Malifile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@PostMapping("/zipUrlFile")
public AjaxResult zipUrlFile(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
/***
*
* zip
* @param file
* @return
*/
@PostMapping("/zipUrl")
public AjaxResult zipUrl(@RequestParam MultipartFile file){
String s = OssUtil.uploadMultipartFile(file);
return AjaxResult.success(s);
}
@PostMapping("list")
public TableDataInfo list(@RequestBody ModelVersion modelVersion)
{
startPage();
List<ModelVersion> list = modelVersionService.selectLogininforList(modelVersion);
return getDataTable(list);
}
@PostMapping("finbyid")
public AjaxResult finbyid(@RequestBody ModelVersion modelVersion)
{
ModelVersion modelVersion1 = modelVersionService.getById(modelVersion.getId());
return AjaxResult.success(modelVersion1);
}
@PostMapping("insert")
public AjaxResult insert(@RequestBody ModelVersion modelVersion)
{
modelVersionService.save(modelVersion);
return AjaxResult.success();
}
@PostMapping("update")
public AjaxResult update(@RequestBody ModelVersion modelVersion)
{
modelVersionService.updateById(modelVersion);
return AjaxResult.success();
}
@PostMapping("delete")
public AjaxResult delete(@RequestBody ModelVersion modelVersion)
{
modelVersionService.removeById(modelVersion.getId());
return AjaxResult.success();
}
}

View File

@ -0,0 +1,79 @@
package com.mcwl.web.controller.resource;
import com.mcwl.common.core.controller.BaseController;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.core.page.TableDataInfo;
import com.mcwl.resource.domain.ToActivity;
import com.mcwl.resource.service.ToActivityService;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.web.controller.resource
* @FilenameToActivityController
* @Description TODO
* @Date2025/1/9 17:59
*/
@RestController
@RequestMapping("ToActivity")
public class ToActivityController extends BaseController {
@Autowired
private ToActivityService toActivityService;
/**
*
*/
@PostMapping("/list")
public TableDataInfo list(@RequestBody ToActivity toActivity)
{
startPage();
List<ToActivity> list = toActivityService.selectToActivityList(toActivity);
return getDataTable(list);
}
@PostMapping("finById")
public AjaxResult finById(@RequestBody ToActivity toActivity)
{
return AjaxResult.success(toActivityService.getById(toActivity));
}
@PostMapping("add")
public AjaxResult add(@RequestBody ToActivity toActivity)
{
return AjaxResult.success(toActivityService.save(toActivity));
}
@PostMapping("update")
public AjaxResult update(@RequestBody ToActivity toActivity)
{
return AjaxResult.success(toActivityService.updateById(toActivity));
}
@PostMapping("delete")
public AjaxResult delete(@RequestBody ToActivity toActivity)
{
return AjaxResult.success(toActivityService.removeById(toActivity));
}
@PostMapping("deleteByIds")
public AjaxResult deleteByIds(@RequestBody List<ToActivity> toActivity)
{
return AjaxResult.success(toActivityService.removeByIds(toActivity));
}
}

View File

@ -1,57 +0,0 @@
<?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.comment.mapper.CommentMapper">
<insert id="insert">
insert into mall_product_comment(id, parent_id, product_id, user_id, content, rating, create_by, create_time,
update_by, update_time, del_flag, remark)
values (#{id}, #{parentId}, #{productId}, #{userId}, #{content}, #{rating}, #{createBy}, #{createTime},
#{updateBy}, #{updateTime}, #{remark}, #{delFlag})
</insert>
<update id="upda"></update>
<delete id="deleteByIds">
delete
from model
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="findById" resultType="com.mcwl.resource.domain.ModelProduct">
select
id,
parent_id,
product_id,
user_id,
content,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag
from model
where id = #{id}
</select>
<select id="findByIds" resultType="com.mcwl.comment.domain.ProductCommentEntity">
select
id,
parent_id,
product_id,
user_id,
content,
create_by,
create_time,
update_by,
update_time,
remark,
del_flag
from mall_product_comment
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>

View File

@ -1,52 +0,0 @@
package com.mcwl.common.utils.bean;
import com.mcwl.common.utils.BetweenTimeUtil;
import com.mcwl.common.domain.RequestConditionEntity;
import com.mcwl.common.utils.ResponsePageEntity;
import com.mcwl.common.web.BaseMapper;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
/**
* service
*/
@Slf4j
public abstract class BaseService<K, V> {
/**
* BaseMapper
*
* @return BaseMapper
*/
protected abstract BaseMapper getBaseMapper();
/**
*
*
* @param v
* @return
*/
public boolean customizeExport(V v) {
return false;
}
/**
*
*
* @return
* @param s
* @param <T>
*/
public <S extends RequestConditionEntity, T> ResponsePageEntity<T> searchByPage(S s) {
BetweenTimeUtil.parseTime(s);
int count = getBaseMapper().searchCount(s);
if (count == 0) {
return ResponsePageEntity.buildEmpty(s);
}
List<T> dataList = getBaseMapper().searchByCondition(s);
return ResponsePageEntity.build(s, count, dataList);
}
}

View File

@ -1,31 +1,31 @@
package com.mcwl.common.web;
import org.springframework.dao.DataAccessException;
import java.util.List;
/**
* mapper
*/
public interface BaseMapper<K, V> {
/**
*
*
* @param v
* @return
*/
int searchCount(V v);
/**
*
*
* @param v
* @return List<K>
* @throws DataAccessException 访
*/
List<K> searchByCondition(V v) throws DataAccessException;
}
//package com.mcwl.common.web;
//
//
//import org.springframework.dao.DataAccessException;
//
//import java.util.List;
//
///**
// * 公共mapper
//
// */
//public interface BaseMapper<K, V> {
//
// /**
// * 根据条件查询数据的数量
// *
// * @param v 实体类
// * @return 数量
// */
// int searchCount(V v);
//
// /**
// * 根据条件查询数据
// *
// * @param v 实体类
// * @return List<K> 实体类的集合
// * @throws DataAccessException 数据访问异常
// */
// List<K> searchByCondition(V v) throws DataAccessException;
//
//}

View File

@ -7,8 +7,6 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
*
* @AuthorChenYan
@ -29,10 +27,18 @@ public class ModelProduct extends BaseEntity {
*/
@TableId
private Long id;
/**
* ID
*/
private Long versionId;
/**
*
*/
private String modelName;
/**
*
*/
private String versionDescription;
/***
* id
*/
@ -56,7 +62,7 @@ public class ModelProduct extends BaseEntity {
/**
*
*/
private String activityParticipation;
private String activityId;
/**
*
*/
@ -68,11 +74,23 @@ public class ModelProduct extends BaseEntity {
/**
*
*/
private Integer real;
private Integer reals;
/**
*
*/
private Integer number;
private Integer numbers;
/**
*
*/
private Integer auditSatus;
/**
*
*/
private String auditText;
/**
*
*/
private Integer isRecommend;
/**
* 0 2
*/

View File

@ -2,11 +2,9 @@ package com.mcwl.resource.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mcwl.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.locationtech.jts.noding.SegmentString;
/**
*
@ -21,7 +19,7 @@ import org.locationtech.jts.noding.SegmentString;
@NoArgsConstructor
@Data
@TableName("model_version")
public class ModelVersion extends BaseEntity {
public class ModelVersion {
/**
* ID
@ -35,7 +33,7 @@ public class ModelVersion extends BaseEntity {
/**
* ID
*/
private Long modelTypeId;
private Long modelType;
/**
*
*/
@ -48,6 +46,22 @@ public class ModelVersion extends BaseEntity {
*
*/
private String triggerWords;
/**
*
*/
private String sampling;
/**
*
*/
private String high;
/**
* vae
*/
private Integer vae;
/**
* cfg
*/
private Integer cfg;
/**
*
*/
@ -89,9 +103,13 @@ public class ModelVersion extends BaseEntity {
*/
private Integer hideImageGenInfo;
/**
*
*
*/
private String status;
private Integer auditSatus;
/**
*
*/
private String auditText;
/**
* 0 2
*/

View File

@ -1,8 +1,11 @@
package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ModelVersion;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

View File

@ -0,0 +1,17 @@
package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.ModelVersion;
import org.apache.ibatis.annotations.Mapper;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.mapper
* @FilenameModelVersionMapper
* @Description TODO
* @Date2025/1/9 16:55
*/
@Mapper
public interface ModelVersionMapper extends BaseMapper<ModelVersion> {
}

View File

@ -0,0 +1,17 @@
package com.mcwl.resource.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.resource.domain.ToActivity;
import org.apache.ibatis.annotations.Mapper;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.mapper
* @FilenameToActivityMapper
* @Description TODO
* @Date2025/1/9 18:01
*/
@Mapper
public interface ToActivityMapper extends BaseMapper<ToActivity> {
}

View File

@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.domain.IdsParam;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.domain.vo.MallProductVo;
import java.util.List;
@ -16,13 +17,10 @@ import java.util.List;
* @Description TODO
* @Date2024/12/30 18:20
*/
public interface MallProductService extends IService<ModelProduct> {
public interface ModelService extends IService<ModelProduct> {
List<ModelProduct> selectMallProductList(ModelProduct sysJob);
int insertMallProduct(ModelProduct mallProduct);
int updateMallProduct(ModelProduct mallProduct);
@ -34,5 +32,4 @@ public interface MallProductService extends IService<ModelProduct> {
Page<ModelProduct> pageLike(MallProductVo mallProductVo, List<Long> list);
}

View File

@ -0,0 +1,21 @@
package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.resource.domain.ModelVersion;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.service
* @FilenameModelVersionService
* @Description TODO
* @Date2025/1/9 16:52
*/
public interface ModelVersionService extends IService<ModelVersion> {
List<ModelVersion> selectLogininforList(ModelVersion modelVersion);
}

View File

@ -0,0 +1,20 @@
package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ToActivity;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.service
* @FilenameToActivityService
* @Description TODO
* @Date2025/1/9 18:00
*/
public interface ToActivityService extends IService<ToActivity> {
List<ToActivity> selectToActivityList(ToActivity toActivity);
}

View File

@ -7,9 +7,8 @@ import com.mcwl.resource.domain.MallProductLike;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.mapper.MallProductLikeMapper;
import com.mcwl.resource.mapper.MallProductMapper;
import com.mcwl.resource.service.MallProductLikeService;
import com.mcwl.resource.service.MallProductService;
import com.mcwl.resource.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,7 +28,7 @@ public class MallProductLikeServiceImpl implements MallProductLikeService {
private MallProductLikeMapper mallProductLikeMapper;
@Autowired
private MallProductService mallProductService;
private ModelService mallProductService;
@Override
public Page<ModelProduct> selectByUserLike(MallProductVo mallProductVo) {
@ -83,4 +82,6 @@ public class MallProductLikeServiceImpl implements MallProductLikeService {
return true;
}
}

View File

@ -8,9 +8,10 @@ import com.mcwl.common.core.redis.RedisCache;
import com.mcwl.common.domain.IdsParam;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.mapper.MallProductMapper;
import com.mcwl.resource.service.MallProductService;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.mapper.MallProductMapper;
import com.mcwl.resource.service.ModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -26,7 +27,7 @@ import java.util.List;
* @Date2024/12/30 18:22
*/
@Service
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements MallProductService {
public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelProduct> implements ModelService {
@Autowired
private RedisCache redisCache;
@ -90,24 +91,8 @@ public class MallProductServiceImpl extends ServiceImpl<MallProductMapper,ModelP
@Override
public Page<ModelProduct> pageLike(MallProductVo mallProductVo, List<Long> list) {
// 创建分页对象
Page<ModelProduct> mallProductPage = new Page<>(mallProductVo.getPageNumber(), mallProductVo.getPageSize());
LambdaQueryWrapper<ModelProduct> mallProductLambdaQueryWrapper = new LambdaQueryWrapper<>();
mallProductLambdaQueryWrapper.in(ModelProduct::getModelTypeId,list);
if (mallProductVo.getOrder() == 1){
mallProductLambdaQueryWrapper.orderByDesc(ModelProduct::getModelTypeId);
}else {
mallProductLambdaQueryWrapper.orderByDesc(ModelProduct::getNumber);
return null;
}
return postMapper.selectPage(mallProductPage,mallProductLambdaQueryWrapper);
}
}

View File

@ -0,0 +1,63 @@
package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.utils.StringUtils;
import com.mcwl.resource.domain.ModelVersion;
import com.mcwl.resource.mapper.ModelVersionMapper;
import com.mcwl.resource.service.ModelVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.service.impl
* @FilenameModelVersionServiceImpl
* @Description TODO
* @Date2025/1/9 16:53
*/
@Service
public class ModelVersionServiceImpl extends ServiceImpl< ModelVersionMapper,ModelVersion> implements ModelVersionService {
@Autowired
private ModelVersionService modelVersionService;
@Autowired
private ModelVersionMapper modelVersionMapper;
@Override
public List<ModelVersion> selectLogininforList(ModelVersion modelVersion) {
// 创建一个 LambdaQueryWrapper 实例
LambdaQueryWrapper<ModelVersion> queryWrapper = new LambdaQueryWrapper<>();
// 使用非空检查来添加查询条件
if (StringUtils.isNotNull(modelVersion.getIsExclusiveModel())) {
queryWrapper.eq(ModelVersion::getIsExclusiveModel, modelVersion.getIsExclusiveModel());
}
if (StringUtils.isNotNull(modelVersion.getVersionName())) {
queryWrapper.eq(ModelVersion::getVersionName, modelVersion.getVersionName());
}
return modelVersionMapper.selectList(queryWrapper);
}
}

View File

@ -0,0 +1,39 @@
package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.ToActivity;
import com.mcwl.resource.mapper.ToActivityMapper;
import com.mcwl.resource.service.ToActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @AuthorChenYan
* @ProjectMcWl
* @Packagecom.mcwl.resource.service
* @FilenameToActivityServiceImpl
* @Description TODO
* @Date2025/1/9 18:01
*/
@Service
public class ToActivityServiceImpl extends ServiceImpl<ToActivityMapper, ToActivity> implements ToActivityService {
@Autowired
private ToActivityService toActivityService;
@Autowired
private ToActivityMapper toActivityMapper;
@Override
public List<ToActivity> selectToActivityList(ToActivity toActivity) {
LambdaQueryWrapper<ToActivity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ToActivity::getActivityName, toActivity.getActivityName());
return toActivityMapper.selectList(queryWrapper);
}
}

View File

@ -9,4 +9,5 @@
<select id="sumNumber" resultType="java.lang.Long">
SELECT sum(number)sum FROM model where user_id = #{userId} ORDER BY(user_id);
</select>
</mapper>