update 调整oss预览开关 使用前端直接调用更改配置参数
This commit is contained in:
parent
844e8b2f77
commit
d99dd4b875
@ -101,6 +101,17 @@ public class SysConfigController extends BaseController {
|
|||||||
return toAjax(configService.updateConfig(config));
|
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,8 +9,8 @@ import cn.hutool.http.HttpUtil;
|
|||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.R;
|
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.core.validate.QueryGroup;
|
import com.ruoyi.common.core.validate.QueryGroup;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
@ -123,20 +123,4 @@ public class SysOssController extends BaseController {
|
|||||||
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
return toAjax(iSysOssService.deleteWithValidByIds(Arrays.asList(ossIds), true) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 变更图片列表预览状态
|
|
||||||
*/
|
|
||||||
@ApiOperation("变更图片列表预览状态")
|
|
||||||
@SaCheckPermission("system:oss:edit")
|
|
||||||
@Log(title = "OSS对象存储", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping("/changePreviewListResource")
|
|
||||||
public R<Void> changePreviewListResource(@RequestBody String body) {
|
|
||||||
Map<String, Boolean> map = JsonUtils.parseMap(body);
|
|
||||||
SysConfig sysConfig = new SysConfig();
|
|
||||||
sysConfig.setConfigKey(OssConstant.PEREVIEW_LIST_RESOURCE_KEY);
|
|
||||||
SysConfig config = iSysConfigService.getOne(sysConfig);
|
|
||||||
config.setConfigValue(map.get("previewListResource").toString());
|
|
||||||
return toAjax(iSysConfigService.updateConfig(config));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,13 @@ public class SysConfigServiceImpl implements ISysConfigService, ConfigService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateConfig(SysConfig config) {
|
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) {
|
if (row > 0) {
|
||||||
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
RedisUtils.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue());
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
export function delConfig(configId) {
|
||||||
return request({
|
return request({
|
||||||
|
@ -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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
@ -17,7 +17,7 @@ import { download } from '@/utils/request'
|
|||||||
import './assets/icons' // icon
|
import './assets/icons' // icon
|
||||||
import './permission' // permission control
|
import './permission' // permission control
|
||||||
import { getDicts } from "@/api/system/dict/data";
|
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 { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
|
||||||
// 分页组件
|
// 分页组件
|
||||||
import Pagination from "@/components/Pagination";
|
import Pagination from "@/components/Pagination";
|
||||||
@ -41,6 +41,7 @@ import DictData from '@/components/DictData'
|
|||||||
// 全局方法挂载
|
// 全局方法挂载
|
||||||
Vue.prototype.getDicts = getDicts
|
Vue.prototype.getDicts = getDicts
|
||||||
Vue.prototype.getConfigKey = getConfigKey
|
Vue.prototype.getConfigKey = getConfigKey
|
||||||
|
Vue.prototype.updateConfigByKey = updateConfigByKey
|
||||||
Vue.prototype.parseTime = parseTime
|
Vue.prototype.parseTime = parseTime
|
||||||
Vue.prototype.resetForm = resetForm
|
Vue.prototype.resetForm = resetForm
|
||||||
Vue.prototype.addDateRange = addDateRange
|
Vue.prototype.addDateRange = addDateRange
|
||||||
|
@ -187,7 +187,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listOss, delOss, changePreviewListResource } from "@/api/system/oss";
|
import { listOss, delOss } from "@/api/system/oss";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Oss",
|
name: "Oss",
|
||||||
@ -344,7 +344,7 @@ export default {
|
|||||||
handlePreviewListResource(previewListResource) {
|
handlePreviewListResource(previewListResource) {
|
||||||
let text = previewListResource ? "启用" : "停用";
|
let text = previewListResource ? "启用" : "停用";
|
||||||
this.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?').then(() => {
|
this.$modal.confirm('确认要"' + text + '""预览列表图片"配置吗?').then(() => {
|
||||||
return changePreviewListResource(previewListResource);
|
return this.updateConfigByKey("sys.oss.previewListResource", previewListResource);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.getList()
|
this.getList()
|
||||||
this.$modal.msgSuccess(text + "成功");
|
this.$modal.msgSuccess(text + "成功");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user