!9 sync 同步ruoyi-vue-plus更新

* update 更新 swagger 注解用法
* update 调整oss预览开关 使用前端直接调用更改配置参数
* fix 修复 insertOrUpdateBatch 获取错误 class 类
* update 更新文档说明
This commit is contained in:
KonBAI
2022-02-10 02:26:51 +00:00
parent a423f02fad
commit 64db44e542
9 changed files with 39 additions and 18 deletions

View File

@@ -101,6 +101,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));
}
/**
* 删除参数配置
*/

View File

@@ -109,7 +109,7 @@ public class SysProfileController extends BaseController {
*/
@ApiOperation("头像上传")
@ApiImplicitParams({
@ApiImplicitParam(name = "avatarfile", value = "用户头像", dataTypeClass = File.class, required = true),
@ApiImplicitParam(name = "avatarfile", value = "用户头像", paramType = "query", dataTypeClass = File.class, required = true)
})
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")

View File

@@ -106,7 +106,7 @@ public interface BaseMapperPlus<M, T, V> extends BaseMapper<T> {
Assert.notNull(tableInfo, "error: can not execute. because can not find cache of TableInfo for entity!");
String keyProperty = tableInfo.getKeyProperty();
Assert.notEmpty(keyProperty, "error: can not execute. because can not find column for id from entity!");
return SqlHelper.saveOrUpdateBatch(this.currentModelClass(), getClass(), log, entityList, batchSize, (sqlSession, entity) -> {
return SqlHelper.saveOrUpdateBatch(this.currentModelClass(), this.currentMapperClass(), log, entityList, batchSize, (sqlSession, entity) -> {
Object idVal = tableInfo.getPropertyValue(entity, keyProperty);
String sqlStatement = SqlHelper.getSqlStatement(this.currentMapperClass(), SqlMethod.INSERT_ONE);
return StringUtils.checkValNull(idVal)

View File

@@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
/**
* swagger3 用法示例
*
@@ -24,11 +26,10 @@ public class Swagger3DemoController {
/**
* 上传请求
* 必须使用 @RequestPart 注解标注为文件
* dataType 必须为 "java.io.File"
*/
@ApiOperation(value = "通用上传请求")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
@ApiImplicitParam(name = "file", value = "文件", paramType = "query", dataTypeClass = File.class, required = true)
})
@PostMapping(value = "/upload")
public R<String> upload(@RequestPart("file") MultipartFile file) {

View File

@@ -136,7 +136,13 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
*/
@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());
}

View File

@@ -43,6 +43,18 @@ export function updateConfig(data) {
})
}
// 修改参数配置
export function updateConfigByKey(key, value) {
return request({
url: '/system/config/updateByKey',
method: 'put',
data: {
configKey: key,
configValue: value
}
})
}
// 删除参数配置
export function delConfig(configId) {
return request({

View File

@@ -17,13 +17,3 @@ export function delOss(ossId) {
})
}
export function changePreviewListResource(previewListResource) {
const data = {
previewListResource
}
return request({
url: '/system/oss/changePreviewListResource',
method: 'put',
data: data
})
}

View File

@@ -17,7 +17,7 @@ import { download } from '@/utils/request'
import './assets/icons' // icon
import './permission' // permission control
import { getDicts } from "@/api/system/dict/data";
import { getConfigKey } from "@/api/system/config";
import { getConfigKey, updateConfigByKey } from "@/api/system/config";
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
// 分页组件
import Pagination from "@/components/Pagination";
@@ -41,6 +41,7 @@ import DictData from '@/components/DictData'
// 全局方法挂载
Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.updateConfigByKey = updateConfigByKey
Vue.prototype.parseTime = parseTime
Vue.prototype.resetForm = resetForm
Vue.prototype.addDateRange = addDateRange

View File

@@ -187,7 +187,7 @@
</template>
<script>
import { listOss, delOss, changePreviewListResource } from "@/api/system/oss";
import { listOss, delOss } from "@/api/system/oss";
export default {
name: "Oss",
@@ -344,7 +344,7 @@ export default {
handlePreviewListResource(previewListResource) {
let text = previewListResource ? "启用" : "停用";
this.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?').then(() => {
return changePreviewListResource(previewListResource);
return this.updateConfigByKey("sys.oss.previewListResource", previewListResource);
}).then(() => {
this.getList()
this.$modal.msgSuccess(text + "成功");