update 调整oss预览开关 使用前端直接调用更改配置参数
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据参数键名修改参数配置 |
| | | */ |
| | | @ApiOperation("根据参数键名修改参数配置") |
| | | @SaCheckPermission("system:config:edit") |
| | | @Log(title = "参数管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/updateByKey") |
| | | public R<Void> updateByKey(@RequestBody SysConfig config) { |
| | | return toAjax(configService.updateConfig(config)); |
| | | } |
| | | |
| | | /** |
| | | * 删除参数配置 |
| | | */ |
| | | @ApiOperation("删除参数配置") |
| | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.annotation.RepeatSubmit; |
| | | 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.R; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.core.validate.QueryGroup; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | |
| | | @NotEmpty(message = "主键不能为空") |
| | | @PathVariable Long[] ossIds) { |
| | | 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)); |
| | | } |
| | | |
| | | } |
| | |
| | | */ |
| | | @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()); |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | // 修改参数配置 |
| | | export function updateConfigByKey(key, value) { |
| | | return request({ |
| | | url: '/system/config/updateByKey', |
| | | method: 'put', |
| | | data: { |
| | | configKey: key, |
| | | configValue: value |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 删除参数配置 |
| | | export function delConfig(configId) { |
| | | return request({ |
| | |
| | | }) |
| | | } |
| | | |
| | | export function changePreviewListResource(previewListResource) { |
| | | const data = { |
| | | previewListResource |
| | | } |
| | | return request({ |
| | | url: '/system/oss/changePreviewListResource', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | |
| | | 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"; |
| | |
| | | // 全局方法挂载 |
| | | Vue.prototype.getDicts = getDicts |
| | | Vue.prototype.getConfigKey = getConfigKey |
| | | Vue.prototype.updateConfigByKey = updateConfigByKey |
| | | Vue.prototype.parseTime = parseTime |
| | | Vue.prototype.resetForm = resetForm |
| | | Vue.prototype.addDateRange = addDateRange |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listOss, delOss, changePreviewListResource } from "@/api/system/oss"; |
| | | import { listOss, delOss } from "@/api/system/oss"; |
| | | |
| | | export default { |
| | | name: "Oss", |
| | |
| | | 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 + "成功"); |