mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-07 12:59:01 +00:00
add 增加ruoyi-resource资源模块 移除ruoyi-file模块 调整项目结构
This commit is contained in:
@@ -47,12 +47,6 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common DataSource -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RuoYi Common Log -->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
@@ -103,7 +97,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-api-file</artifactId>
|
||||
<artifactId>ruoyi-api-resource</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@@ -99,6 +99,17 @@ public class SysConfigController extends BaseController {
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名修改参数配置
|
||||
*/
|
||||
@ApiOperation("根据参数键名修改参数配置")
|
||||
@SaCheckPermission("system:config:edit")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updateByKey")
|
||||
public R<Void> updateByKey(@RequestBody SysConfig config) {
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
|
@@ -9,10 +9,11 @@ import com.ruoyi.common.log.annotation.Log;
|
||||
import com.ruoyi.common.log.enums.BusinessType;
|
||||
import com.ruoyi.common.satoken.utils.LoginHelper;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.file.api.RemoteFileService;
|
||||
import com.ruoyi.file.api.domain.SysFile;
|
||||
import com.ruoyi.resource.api.RemoteFileService;
|
||||
import com.ruoyi.resource.api.domain.SysFile;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import io.seata.spring.annotation.GlobalTransactional;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -111,17 +112,14 @@ public class SysProfileController extends BaseController {
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
// @GlobalTransactional(rollbackFor = Exception.class)
|
||||
@GlobalTransactional(rollbackFor = Exception.class)
|
||||
@ApiOperation("头像上传")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "avatarfile", value = "用户头像", dataTypeClass = File.class, required = true),
|
||||
})
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public R<Map<String, Object>> avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException {
|
||||
// todo 临时用于测试 seata
|
||||
// userService.insertUser(new SysUser().setUserName("test").setNickName("test"));
|
||||
|
||||
public R<Map<String, Object>> avatar(@RequestPart("avatarfile") MultipartFile file) throws IOException {
|
||||
if (!file.isEmpty()) {
|
||||
SysFile sysFile = remoteFileService.upload(file.getName(), file.getOriginalFilename(), file.getContentType(), file.getBytes());
|
||||
if (ObjectUtil.isNull(sysFile)) {
|
||||
|
@@ -0,0 +1,32 @@
|
||||
package com.ruoyi.system.runner;
|
||||
|
||||
import com.ruoyi.system.service.ISysConfigService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 初始化 system 模块对应业务数据
|
||||
*
|
||||
* @author Lion Li
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class SystemApplicationRunner implements ApplicationRunner {
|
||||
|
||||
private final ISysConfigService configService;
|
||||
private final ISysDictTypeService dictTypeService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
configService.loadingConfigCache();
|
||||
log.info("加载参数缓存数据成功");
|
||||
dictTypeService.loadingDictCache();
|
||||
log.info("加载字典缓存数据成功");
|
||||
}
|
||||
|
||||
}
|
@@ -34,14 +34,6 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
||||
|
||||
private final SysConfigMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化参数到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
loadingConfigCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysConfig> selectPageConfigList(SysConfig config, PageQuery pageQuery) {
|
||||
Map<String, Object> params = config.getParams();
|
||||
@@ -128,7 +120,13 @@ public class SysConfigServiceImpl implements ISysConfigService {
|
||||
*/
|
||||
@Override
|
||||
public int updateConfig(SysConfig config) {
|
||||
int row = baseMapper.updateById(config);
|
||||
int row = 0;
|
||||
if (config.getConfigId() != null) {
|
||||
row = baseMapper.updateById(config);
|
||||
} else {
|
||||
row = baseMapper.update(config, new LambdaQueryWrapper<SysConfig>()
|
||||
.eq(SysConfig::getConfigKey, config.getConfigKey()));
|
||||
}
|
||||
if (row > 0) {
|
||||
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||
}
|
||||
|
@@ -39,14 +39,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService {
|
||||
private final SysDictTypeMapper baseMapper;
|
||||
private final SysDictDataMapper dictDataMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化字典到缓存
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
loadingDictCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<SysDictType> selectPageDictTypeList(SysDictType dictType, PageQuery pageQuery) {
|
||||
Map<String, Object> params = dictType.getParams();
|
||||
|
Reference in New Issue
Block a user