mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 17:58:17 +08:00
增加对象存储配置
This commit is contained in:
parent
5645356fa9
commit
57b0726b4f
@ -0,0 +1,137 @@
|
|||||||
|
package com.ruoyi.web.controller.system;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.system.domain.SysOssConfig;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.system.domain.vo.SysOssConfigVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysOssConfigBo;
|
||||||
|
import com.ruoyi.system.service.ISysOssConfigService;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Api(value = "云存储配置控制器", tags = {"云存储配置管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/sysOssConfig")
|
||||||
|
public class SysOssConfigController extends BaseController {
|
||||||
|
|
||||||
|
private final ISysOssConfigService iSysOssConfigService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询云存储配置列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询云存储配置列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<SysOssConfigVo> list(@Validated SysOssConfigBo bo) {
|
||||||
|
return iSysOssConfigService.queryPageList(bo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出云存储配置列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出云存储配置列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:export')")
|
||||||
|
@Log(title = "云存储配置", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void export(@Validated SysOssConfigBo bo, HttpServletResponse response) {
|
||||||
|
List<SysOssConfigVo> list = iSysOssConfigService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "云存储配置", SysOssConfigVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取云存储配置详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取云存储配置详细信息")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:query')")
|
||||||
|
@GetMapping("/{ossConfigId}")
|
||||||
|
public AjaxResult<SysOssConfigVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable("ossConfigId") Integer ossConfigId) {
|
||||||
|
return AjaxResult.success(iSysOssConfigService.queryById(ossConfigId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增云存储配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增云存储配置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:add')")
|
||||||
|
@Log(title = "云存储配置", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
|
if (StringUtils.isNotEmpty(bo.getConfigKey())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(iSysOssConfigService.checkConfigKeyUnique(bo))) {
|
||||||
|
return AjaxResult.error("新增云配置'" + bo.getConfigKey() + "'失败,configKey已存在");
|
||||||
|
}
|
||||||
|
return toAjax(iSysOssConfigService.insertByBo(bo) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改云存储配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改云存储配置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:edit')")
|
||||||
|
@Log(title = "云存储配置", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody SysOssConfigBo bo) {
|
||||||
|
if (StringUtils.isNotEmpty(bo.getConfigKey())
|
||||||
|
&& UserConstants.NOT_UNIQUE.equals(iSysOssConfigService.checkConfigKeyUnique(bo))) {
|
||||||
|
return AjaxResult.error("修改云配置'" + bo.getConfigKey() + "'失败,configKey已存在");
|
||||||
|
}
|
||||||
|
return toAjax(iSysOssConfigService.updateByBo(bo) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除云存储配置
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除云存储配置")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:remove')")
|
||||||
|
@Log(title = "云存储配置", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ossConfigIds}")
|
||||||
|
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Integer[] ossConfigIds) {
|
||||||
|
return toAjax(iSysOssConfigService.deleteWithValidByIds(Arrays.asList(ossConfigIds), true) ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态修改
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:sysOssConfig:edit')")
|
||||||
|
@Log(title = "云存储状态修改", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody SysOssConfig sysOssConfig) {
|
||||||
|
sysOssConfig.setUpdateBy(getUsername());
|
||||||
|
return toAjax(iSysOssConfigService.updateOssConfigStatus(sysOssConfig));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,111 @@
|
|||||||
|
package com.ruoyi.system.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置对象 sys_oss_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("sys_oss_config")
|
||||||
|
public class SysOssConfig implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主建
|
||||||
|
*/
|
||||||
|
@TableId(value = "oss_config_id")
|
||||||
|
private Integer ossConfigId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置key
|
||||||
|
*/
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accessKey
|
||||||
|
*/
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秘钥
|
||||||
|
*/
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桶名称
|
||||||
|
*/
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前缀
|
||||||
|
*/
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问站点
|
||||||
|
*/
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否htpps(0否 1是)
|
||||||
|
*/
|
||||||
|
private String isHttps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 域
|
||||||
|
*/
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展字段
|
||||||
|
*/
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建者
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新者
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,113 @@
|
|||||||
|
package com.ruoyi.system.domain.bo;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.ruoyi.common.core.validate.AddGroup;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置业务对象 sys_oss_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel("云存储配置业务对象")
|
||||||
|
public class SysOssConfigBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主建
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("主建")
|
||||||
|
private Integer ossConfigId;
|
||||||
|
/**
|
||||||
|
* 配置key
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "配置key", required = true)
|
||||||
|
@NotBlank(message = "配置key不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accessKey
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "accessKey")
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秘钥
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "secretKey")
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桶名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "桶名称")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前缀
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "前缀")
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问站点
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "访问站点")
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否htpps(0否 1是)
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "是否htpps(0否 1是)")
|
||||||
|
private String isHttps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 域
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "域")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展字段
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "扩展字段")
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页大小
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("分页大小")
|
||||||
|
private Integer pageSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前页数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer pageNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序列
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("排序列")
|
||||||
|
private String orderByColumn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序的方向desc或者asc
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
|
private String isAsc;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.ruoyi.system.domain.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.ruoyi.common.annotation.ExcelDictFormat;
|
||||||
|
import com.ruoyi.common.convert.ExcelDictConvert;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置视图对象 sys_oss_config
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("云存储配置视图对象")
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class SysOssConfigVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主建
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("主建")
|
||||||
|
private Integer ossConfigId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置key
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "配置key")
|
||||||
|
@ApiModelProperty("配置key")
|
||||||
|
private String configKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* accessKey
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "accessKey")
|
||||||
|
@ApiModelProperty("accessKey")
|
||||||
|
private String accessKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 秘钥
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "secretKey")
|
||||||
|
@ApiModelProperty("secretKey")
|
||||||
|
private String secretKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 桶名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "桶名称")
|
||||||
|
@ApiModelProperty("桶名称")
|
||||||
|
private String bucketName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前缀
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "前缀")
|
||||||
|
@ApiModelProperty("前缀")
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 访问站点
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "访问站点")
|
||||||
|
@ApiModelProperty("访问站点")
|
||||||
|
private String endpoint;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否htpps(0否 1是)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "是否htpps", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(dictType = "sys_yes_no")
|
||||||
|
@ApiModelProperty("是否htpps(0否 1是)")
|
||||||
|
private String isHttps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 域
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "域")
|
||||||
|
@ApiModelProperty("域")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0正常 1停用)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态(0正常 1停用)")
|
||||||
|
@ApiModelProperty("状态(0正常 1停用)")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展字段
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "扩展字段")
|
||||||
|
@ApiModelProperty("扩展字段")
|
||||||
|
private String ext1;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.system.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.SysOssConfig;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||||
|
import org.apache.ibatis.annotations.CacheNamespace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
public interface SysOssConfigMapper extends BaseMapperPlus<SysOssConfig> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package com.ruoyi.system.service;
|
||||||
|
|
||||||
|
import com.ruoyi.system.domain.SysOssConfig;
|
||||||
|
import com.ruoyi.system.domain.vo.SysOssConfigVo;
|
||||||
|
import com.ruoyi.system.domain.bo.SysOssConfigBo;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
public interface ISysOssConfigService extends IServicePlus<SysOssConfig, SysOssConfigVo> {
|
||||||
|
/**
|
||||||
|
* 查询单个
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
SysOssConfigVo queryById(Integer ossConfigId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
List<SysOssConfigVo> queryList(SysOssConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据新增业务对象插入云存储配置
|
||||||
|
* @param bo 云存储配置新增业务对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysOssConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编辑业务对象修改云存储配置
|
||||||
|
* @param bo 云存储配置编辑业务对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(SysOssConfigBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并删除数据
|
||||||
|
* @param ids 主键集合
|
||||||
|
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用停用状态
|
||||||
|
* @param sysOssConfig
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int updateOssConfigStatus(SysOssConfig sysOssConfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断configkey是否唯一
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String checkConfigKeyUnique(SysOssConfigBo bo);
|
||||||
|
}
|
||||||
@ -0,0 +1,146 @@
|
|||||||
|
package com.ruoyi.system.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.ruoyi.common.constant.Constants;
|
||||||
|
import com.ruoyi.common.constant.UserConstants;
|
||||||
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
import com.ruoyi.common.core.redis.RedisCache;
|
||||||
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
|
import com.ruoyi.common.core.page.PagePlus;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.system.domain.SysConfig;
|
||||||
|
import com.ruoyi.system.service.ISysConfigService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.ruoyi.system.domain.bo.SysOssConfigBo;
|
||||||
|
import com.ruoyi.system.domain.vo.SysOssConfigVo;
|
||||||
|
import com.ruoyi.system.domain.SysOssConfig;
|
||||||
|
import com.ruoyi.system.mapper.SysOssConfigMapper;
|
||||||
|
import com.ruoyi.system.service.ISysOssConfigService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 云存储配置Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-08-11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysOssConfigServiceImpl extends ServicePlusImpl<SysOssConfigMapper, SysOssConfig, SysOssConfigVo> implements ISysOssConfigService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysConfigService iSysConfigService;
|
||||||
|
@Autowired
|
||||||
|
private RedisCache redisCache;
|
||||||
|
public static final String sysConfigOss="sys.oss.cloudStorageService";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysOssConfigVo queryById(Integer ossConfigId){
|
||||||
|
return getVoById(ossConfigId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<SysOssConfigVo> queryPageList(SysOssConfigBo bo) {
|
||||||
|
PagePlus<SysOssConfig, SysOssConfigVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
||||||
|
return PageUtils.buildDataInfo(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysOssConfigVo> queryList(SysOssConfigBo bo) {
|
||||||
|
return listVo(buildQueryWrapper(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<SysOssConfig> buildQueryWrapper(SysOssConfigBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<SysOssConfig> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getConfigKey()), SysOssConfig::getConfigKey, bo.getConfigKey());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getBucketName()), SysOssConfig::getBucketName, bo.getBucketName());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(SysOssConfigBo bo) {
|
||||||
|
SysOssConfig add = BeanUtil.toBean(bo, SysOssConfig.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
return save(add);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(SysOssConfigBo bo) {
|
||||||
|
SysOssConfig update = BeanUtil.toBean(bo, SysOssConfig.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return updateById(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*
|
||||||
|
* @param entity 实体类数据
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(SysOssConfig entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return removeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String checkConfigKeyUnique(SysOssConfigBo bo) {
|
||||||
|
Long ossConfigId = StringUtils.isNull(bo.getOssConfigId()) ? -1L : bo.getOssConfigId();
|
||||||
|
SysOssConfig info = getOne(new LambdaQueryWrapper<SysOssConfig>()
|
||||||
|
.select(SysOssConfig::getOssConfigId, SysOssConfig::getConfigKey)
|
||||||
|
.eq(SysOssConfig::getConfigKey, bo.getConfigKey()).last("limit 1"));
|
||||||
|
if (StringUtils.isNotNull(info) && info.getOssConfigId().longValue() != ossConfigId.longValue()) {
|
||||||
|
return UserConstants.NOT_UNIQUE;
|
||||||
|
}
|
||||||
|
return UserConstants.UNIQUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateOssConfigStatus(SysOssConfig sysOssConfig) {
|
||||||
|
LambdaQueryWrapper<SysConfig> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(SysConfig::getConfigKey,sysConfigOss);
|
||||||
|
List<SysConfig> sysConfigs = iSysConfigService.list(queryWrapper);
|
||||||
|
SysConfig config = null;
|
||||||
|
if(ObjectUtil.isNotNull(sysConfigs)){
|
||||||
|
config = sysConfigs.get(0);
|
||||||
|
}
|
||||||
|
//更新sysconfig
|
||||||
|
LambdaUpdateWrapper<SysConfig> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(SysConfig::getConfigKey,sysConfigOss);
|
||||||
|
updateWrapper.set(SysConfig::getConfigValue,sysOssConfig.getConfigKey());
|
||||||
|
boolean bool = iSysConfigService.update(updateWrapper);
|
||||||
|
if(bool){
|
||||||
|
//更新redis缓存
|
||||||
|
redisCache.setCacheObject(getCacheKey(config.getConfigKey()), sysOssConfig.getConfigKey());
|
||||||
|
}
|
||||||
|
return baseMapper.updateById(sysOssConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置cache key
|
||||||
|
*
|
||||||
|
* @param configKey 参数键
|
||||||
|
* @return 缓存键key
|
||||||
|
*/
|
||||||
|
private String getCacheKey(String configKey) {
|
||||||
|
return Constants.SYS_CONFIG_KEY + configKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ruoyi.system.mapper.SysOssConfigMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.system.domain.SysOssConfig" id="SysOssConfigResult">
|
||||||
|
<result property="ossConfigId" column="oss_config_id"/>
|
||||||
|
<result property="configKey" column="config_key"/>
|
||||||
|
<result property="accessKey" column="access_key"/>
|
||||||
|
<result property="secretKey" column="secret_key"/>
|
||||||
|
<result property="bucketName" column="bucket_name"/>
|
||||||
|
<result property="prefix" column="prefix"/>
|
||||||
|
<result property="endpoint" column="endpoint"/>
|
||||||
|
<result property="isHttps" column="is_https"/>
|
||||||
|
<result property="region" column="region"/>
|
||||||
|
<result property="status" column="status"/>
|
||||||
|
<result property="ext1" column="ext1"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
58
ruoyi-ui/src/api/system/sysOssConfig.js
Normal file
58
ruoyi-ui/src/api/system/sysOssConfig.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询云存储配置列表
|
||||||
|
export function listSysOssConfig(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询云存储配置详细
|
||||||
|
export function getSysOssConfig(ossConfigId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig/' + ossConfigId,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增云存储配置
|
||||||
|
export function addSysOssConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改云存储配置
|
||||||
|
export function updateSysOssConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除云存储配置
|
||||||
|
export function delSysOssConfig(ossConfigId) {
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig/' + ossConfigId,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 用户状态修改
|
||||||
|
export function changeOssConfigStatus(ossConfigId, status,configKey) {
|
||||||
|
const data = {
|
||||||
|
ossConfigId,
|
||||||
|
status,
|
||||||
|
configKey
|
||||||
|
}
|
||||||
|
return request({
|
||||||
|
url: '/system/sysOssConfig/changeStatus',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
372
ruoyi-ui/src/views/system/ossConfig/index.vue
Normal file
372
ruoyi-ui/src/views/system/ossConfig/index.vue
Normal file
@ -0,0 +1,372 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
|
||||||
|
<el-form-item label="配置key" prop="configKey">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.configKey"
|
||||||
|
placeholder="请输入配置key"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="桶名称" prop="bucketName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.bucketName"
|
||||||
|
placeholder="请输入桶名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:sysOssConfig:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:sysOssConfig:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
:loading="exportLoading"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:sysOssConfig:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="sysOssConfigList">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="主建" align="center" prop="ossConfigId" v-if="false"/>
|
||||||
|
<el-table-column label="配置key" align="center" prop="configKey" />
|
||||||
|
<el-table-column label="accessKey" align="center" prop="accessKey" />
|
||||||
|
<el-table-column label="seretKey" align="center" prop="secretKey" />
|
||||||
|
<el-table-column label="桶名称" align="center" prop="bucketName" />
|
||||||
|
<el-table-column label="endpoint" align="center" prop="endpoint" />
|
||||||
|
<el-table-column label="前缀" align="center" prop="prefix" />
|
||||||
|
<el-table-column label="是否htpps" align="center" prop="isHttps" :formatter="isHttpsFormat" />
|
||||||
|
<el-table-column label="域" align="center" prop="region" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status" >
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.status"
|
||||||
|
active-value="0"
|
||||||
|
inactive-value="1"
|
||||||
|
@change="handleStatusChange(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:sysOssConfig:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:sysOssConfig:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改云存储配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
|
<el-form-item label="配置key" prop="configKey">
|
||||||
|
<el-input v-model="form.configKey" placeholder="请输入配置key" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="accessKey" prop="accessKey">
|
||||||
|
<el-input v-model="form.accessKey" placeholder="请输入accessKey" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="secretKey" prop="secretKey">
|
||||||
|
<el-input v-model="form.secretKey" placeholder="请输入秘钥" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="桶名称" prop="bucketName">
|
||||||
|
<el-input v-model="form.bucketName" placeholder="请输入桶名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="endpoint" prop="endpoint">
|
||||||
|
<el-input v-model="form.endpoint" placeholder="请输入访问站点" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="前缀" prop="prefix">
|
||||||
|
<el-input v-model="form.prefix" placeholder="请输入前缀" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="配置状态">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in statusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictValue"
|
||||||
|
>{{dict.dictLabel}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否htpps">
|
||||||
|
<el-radio-group v-model="form.isHttps">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in httpsStatusOptions"
|
||||||
|
:key="dict.dictValue"
|
||||||
|
:label="dict.dictValue"
|
||||||
|
>{{dict.dictLabel}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="域" prop="region">
|
||||||
|
<el-input v-model="form.region" placeholder="请输入域" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listSysOssConfig, getSysOssConfig, delSysOssConfig, addSysOssConfig, updateSysOssConfig,changeOssConfigStatus } from "@/api/system/sysOssConfig";
|
||||||
|
import { downLoadExcel } from "@/utils/download";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "SysOssConfig",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 按钮loading
|
||||||
|
buttonLoading: false,
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 导出遮罩层
|
||||||
|
exportLoading: false,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 云存储配置表格数据
|
||||||
|
sysOssConfigList: [],
|
||||||
|
// 状态数据字典
|
||||||
|
statusOptions: [],
|
||||||
|
// 是否https数据字典
|
||||||
|
httpsStatusOptions: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 是否htpps字典
|
||||||
|
isHttpsOptions: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
configKey: undefined,
|
||||||
|
bucketName: undefined,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
configKey: [
|
||||||
|
{ required: true, message: "配置key不能为空", trigger: "blur" },
|
||||||
|
{ min: 2, max: 20, message: '配置key长度必须介于 2 和 20 之间', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
accessKey: [
|
||||||
|
{ required: true, message: "accessKey不能为空", trigger: "blur" },
|
||||||
|
{ min: 2, max: 200, message: 'accessKey长度必须介于 2 和 200 之间', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
secretKey: [
|
||||||
|
{ required: true, message: "secretKey不能为空", trigger: "blur" },
|
||||||
|
{ min: 2, max: 20, message: 'secretKey长度必须介于 2 和 200 之间', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
bucketName: [
|
||||||
|
{ required: true, message: "桶名称不能为空", trigger: "blur" },
|
||||||
|
{ min: 2, max: 20, message: '桶名称长度必须介于 2 和 100 之间', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
endpoint: [
|
||||||
|
{ required: true, message: "endpoint不能为空", trigger: "blur" },
|
||||||
|
//{ min: 2, max: 20, message: 'endpoint名称长度必须介于 2 和 100 之间', trigger: 'blur' }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getDicts("sys_normal_disable").then(response => {
|
||||||
|
this.statusOptions = response.data;
|
||||||
|
});
|
||||||
|
this.getDicts("https_yes_no").then(response => {
|
||||||
|
this.httpsStatusOptions = response.data;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询云存储配置列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listSysOssConfig(this.queryParams).then(response => {
|
||||||
|
this.sysOssConfigList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 是否htpps字典翻译
|
||||||
|
isHttpsFormat(row, column) {
|
||||||
|
return this.selectDictLabel(this.isHttpsOptions, row.isHttps);
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
ossConfigId: undefined,
|
||||||
|
configKey: undefined,
|
||||||
|
accessKey: undefined,
|
||||||
|
secretKey: undefined,
|
||||||
|
bucketName: undefined,
|
||||||
|
prefix: undefined,
|
||||||
|
endpoint: undefined,
|
||||||
|
isHttps: "0",
|
||||||
|
region: undefined,
|
||||||
|
status: "0",
|
||||||
|
remark: undefined
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加云存储配置";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.loading = true;
|
||||||
|
this.reset();
|
||||||
|
const ossConfigId = row.ossConfigId || this.ids
|
||||||
|
getSysOssConfig(ossConfigId).then(response => {
|
||||||
|
this.loading = false;
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改云存储配置";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.ossConfigId != null) {
|
||||||
|
updateSysOssConfig(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addSysOssConfig(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ossConfigIds = row.ossConfigId || this.ids;
|
||||||
|
this.$confirm('是否确认删除云存储配置编号为"' + ossConfigIds + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = true;
|
||||||
|
return delSysOssConfig(ossConfigIds);
|
||||||
|
}).then(() => {
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
downLoadExcel('/system/sysOssConfig/export', this.queryParams);
|
||||||
|
},
|
||||||
|
// 云存储配置状态修改
|
||||||
|
handleStatusChange(row) {
|
||||||
|
let text = row.status === "0" ? "启用" : "停用";
|
||||||
|
this.$confirm('确认要"' + text + '""' + row.configKey + '"配置吗?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return changeOssConfigStatus(row.ossConfigId, row.status,row.configKey);
|
||||||
|
}).then(() => {
|
||||||
|
this.msgSuccess(text + "成功");
|
||||||
|
}).catch(function() {
|
||||||
|
row.status = row.status === "0" ? "1" : "0";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user