mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
在线h5开发
This commit is contained in:
parent
ecc03127bc
commit
5e619f7924
@ -7,7 +7,7 @@ import org.springframework.context.annotation.Bean;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConditionalOnProperty(prefix = "tenant", value = "enabled", havingValue = "true")
|
@ConditionalOnProperty(prefix = "tenant", value = "enable", havingValue = "true")
|
||||||
public class MybatisPlusAutoConfigTenant {
|
public class MybatisPlusAutoConfigTenant {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|||||||
@ -139,9 +139,30 @@ public class H5ProjectController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
h5Project.setStatus(status);
|
h5Project.setStatus(status);
|
||||||
return h5ProjectService.updateById(h5Project);
|
return h5ProjectService.updateStatus(id, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新H5项目状态
|
||||||
|
*
|
||||||
|
* @param id H5项目ID
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
@Operation(summary = "更新H5项目状态")
|
||||||
|
@PostMapping("/updateContent")
|
||||||
|
public Boolean updateContent(@RequestParam Long id, @RequestBody H5ProjectContentDTO contentDTO) {
|
||||||
|
H5Project h5Project = h5ProjectService.getById(id);
|
||||||
|
if (h5Project == null) {
|
||||||
|
throw new ServiceException("项目不存在");
|
||||||
|
}
|
||||||
|
Long currentUserId = LoginHelper.getUserId();
|
||||||
|
if (!currentUserId.equals(h5Project.getCreatedBy())) {
|
||||||
|
throw new ServiceException("无权限操作此项目");
|
||||||
|
}
|
||||||
|
return h5ProjectService.updateContent(id, contentDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除H5项目
|
* 删除H5项目
|
||||||
*
|
*
|
||||||
|
|||||||
@ -69,6 +69,10 @@ public interface H5ProjectService extends IService<H5Project> {
|
|||||||
*/
|
*/
|
||||||
List<Long> getProjectGroupIds(Long projectId);
|
List<Long> getProjectGroupIds(Long projectId);
|
||||||
|
|
||||||
|
boolean updateContent(Long projectId, H5ProjectContentDTO content);
|
||||||
|
|
||||||
|
boolean updateStatus(Long projectId, Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取项目内容
|
* 获取项目内容
|
||||||
*
|
*
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package com.luban.api.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
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;
|
||||||
@ -12,6 +13,7 @@ import com.luban.api.entity.H5ProjectGroup;
|
|||||||
import com.luban.api.dto.H5ProjectContentDTO;
|
import com.luban.api.dto.H5ProjectContentDTO;
|
||||||
import com.luban.api.dto.query.H5ProjectQueryDTO;
|
import com.luban.api.dto.query.H5ProjectQueryDTO;
|
||||||
import com.luban.api.service.H5ProjectService;
|
import com.luban.api.service.H5ProjectService;
|
||||||
|
import com.luban.api.util.JSON;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -32,6 +34,9 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
@Autowired
|
@Autowired
|
||||||
private H5ProjectGroupDao h5ProjectGroupDao;
|
private H5ProjectGroupDao h5ProjectGroupDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JSON json;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContentDTO content, List<Long> groupIds) {
|
public boolean saveH5ProjectWithContent(H5Project h5Project, H5ProjectContentDTO content, List<Long> groupIds) {
|
||||||
@ -82,6 +87,26 @@ public class H5ProjectServiceImpl extends ServiceImpl<H5ProjectDao, H5Project> i
|
|||||||
return this.getById(id);
|
return this.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateContent(Long projectId, H5ProjectContentDTO content) {
|
||||||
|
if (projectId == null || content == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.update(new LambdaUpdateWrapper<H5Project>()
|
||||||
|
.eq(H5Project::getId, projectId)
|
||||||
|
.set(H5Project::getContent, json.toJSON(content)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateStatus(Long projectId, Integer status) {
|
||||||
|
if (projectId == null || status == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.update(new LambdaUpdateWrapper<H5Project>()
|
||||||
|
.eq(H5Project::getId, projectId)
|
||||||
|
.set(H5Project::getStatus, status));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProjectContent(Long projectId) {
|
public String getProjectContent(Long projectId) {
|
||||||
if (projectId != null) {
|
if (projectId != null) {
|
||||||
|
|||||||
@ -90,7 +90,7 @@ mybatis-plus:
|
|||||||
# 主键类型
|
# 主键类型
|
||||||
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
# AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
|
||||||
# 如需改为自增 需要将数据库表全部设置为自增
|
# 如需改为自增 需要将数据库表全部设置为自增
|
||||||
idType: ASSIGN_ID
|
idType: AUTO
|
||||||
minioplus:
|
minioplus:
|
||||||
# rustfs 部署地址
|
# rustfs 部署地址
|
||||||
backend: http://localhost:9000
|
backend: http://localhost:9000
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user