h5 动态表单,支持多租户

This commit is contained in:
lizhengwei 2026-02-27 21:00:55 +08:00
parent 28efb62743
commit 78fb873d71
2 changed files with 33 additions and 18 deletions

View File

@ -1,34 +1,23 @@
package com.luban.api.controller;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dromara.md.form.api.constant.BaseConstant;
import com.dromara.md.form.utils.TenantHelper;
import com.luban.api.convert.WorkConvert;
import com.luban.api.dto.WorkCreateDTO;
import com.luban.api.dto.WorkQueryDTO;
import com.luban.api.dto.WorkUpdateDTO;
import com.luban.api.dto.H5ProjectContentDTO;
import com.luban.api.dto.query.H5ProjectQueryDTO;
import com.luban.api.entity.H5Project;
import com.luban.api.entity.Work;
import com.luban.api.service.H5ProjectService;
import com.luban.api.service.WorkService;
import com.luban.api.vo.WorkVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
import java.util.Collections;
/**
* <p>
@ -61,5 +50,34 @@ public class WorkController {
}
}
/**
* 创建H5项目
*
* @param request 包含H5项目信息和内容的请求
* @return 项目ID
*/
@Operation(summary = "创建作品:草稿状态")
@PostMapping("create")
public Long create(@RequestBody H5ProjectController.CreateH5ProjectRequest request) {
H5Project h5Project = new H5Project();
h5Project.setType(request.getType());
h5Project.setTitle(request.getTitle());
h5Project.setDescription(request.getDescription());
h5Project.setPreviewWidth(request.getPreviewWidth());
h5Project.setPreviewHeight(request.getPreviewHeight());
h5Project.setContent("{}");
h5Project.setStatus(1);
h5Project.setCreatedBy(LoginHelper.getUserId());
H5ProjectContentDTO contentDTO = new H5ProjectContentDTO();
contentDTO.setVersion("1");
boolean success = h5ProjectService.saveH5ProjectWithContent(h5Project, contentDTO, Collections.singletonList(5L));
if (success) {
return h5Project.getId();
} else {
throw new RuntimeException("创建项目失败");
}
}
}

View File

@ -57,10 +57,7 @@ tenant:
enable: true
# 排除表
excludes:
- sys_menu
- sys_tenant
- sys_tenant_package
- sys_saas_user_role
- h5_group
# MyBatisPlus配置
# https://baomidou.com/config/