接口 ISohelpBootResourceService

所有已知实现类:
SohelpBootResourceDBServiceImpl, SohelpBootResourceFileServiceImpl

public interface ISohelpBootResourceService
商邦资源管理
从以下版本开始:
2024/7/17 16:37
作者:
AaronFung
  • 方法详细资料

    • importAll

      void importAll(List<Map<String,Object>> list) throws BusiException
      导入所有记录
      参数:
      list -
      抛出:
      BusiException
    • exportAll

      List<Map<String,Object>> exportAll()
      导出所有记录
      返回:
    • formatFilePath

      @Comment("\u683c\u5f0f\u5316\u6587\u4ef6\u8def\u5f84") default String formatFilePath(String filePath)
      检查并格式化文件路径

      该方法会检查传入的文件路径是否合法,并将路径中的多余斜杠(/)替换为单个斜杠(/)。

      参数:
      filePath - 文件路径字符串
      返回:
      格式化后的文件路径字符串
      抛出:
      IllegalArgumentException - 如果filePath为null,则抛出此异常
    • convertClass

      default <T> T convertClass(com.alibaba.fastjson.JSONObject jsonObject, Class<T> cls)
      将 JSONObject 转换为指定类型的对象
      类型参数:
      T - 目标对象的类型
      参数:
      jsonObject - 要转换的 JSONObject 对象
      cls - 目标对象的类型
      返回:
      转换后的对象,如果 jsonObject 或 cls 为 null,则返回 null;如果转换失败,则记录日志或进行异常处理并返回 null
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 如果 JSON 解析过程中发生错误,会抛出此异常
    • readOnly

      @Comment("\u8d44\u6e90\u8bbe\u7f6e\u4e3a\u53ea\u8bfb\u6a21\u5f0f") default boolean readOnly()
      设置资源为只读模式
      返回:
      如果资源为只读模式,则返回 true;否则返回 false
    • exists

      @Comment("\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728") boolean exists(String filePath)
      判断文件是否存在
      参数:
      filePath - 文件路径
      返回:
      如果文件存在,则返回true;否则返回false
    • getByPath

      @Comment("\u6839\u636e\u8def\u5f84\u83b7\u53d6\u5bf9\u8c61") com.alibaba.fastjson.JSONObject getByPath(String filePath)
      根据路径获取对象
      参数:
      filePath - 文件路径
      返回:
      JSONObject对象
    • getByPath

      @Comment("\u6839\u636e\u8def\u5f84\u83b7\u53d6\u5bf9\u8c61") <T> T getByPath(String filePath, Class<T> cls) throws BusiException, SQLException
      根据路径获取对象
      参数:
      filePath - 文件路径
      cls - 目标对象的类类型
      返回:
      目标类型的对象
      抛出:
      BusiException - 业务异常
      SQLException - SQL异常
    • save

      @Comment("\u4fdd\u5b58\u914d\u7f6e\u8d44\u6e90") Map<String,Object> save(String filePath, Map<String,Object> formMap) throws SQLException, BusiException
      保存配置资源
      参数:
      filePath - 配置资源文件的路径
      formMap - 配置资源的键值对集合
      返回:
      保存后的配置资源键值对集合
      抛出:
      SQLException - SQL异常
      BusiException - 业务异常
    • save

      @Comment("\u4fdd\u5b58\u914d\u7f6e\u8d44\u6e90") Map<String,Object> save(String filePath, String fileJson) throws SQLException, BusiException
      保存配置资源
      参数:
      filePath - 配置资源文件的路径
      fileJson - 配置资源的JSON字符串
      返回:
      保存后的配置资源键值对集合
      抛出:
      SQLException - SQL异常
      BusiException - 业务异常
    • add

      @Comment("\u6dfb\u52a0\u914d\u7f6e\u8d44\u6e90") Map<String,Object> add(String filePath, String fileJson) throws SQLException, BusiException
      添加配置资源
      参数:
      filePath - 配置资源文件的路径
      fileJson - 配置资源的JSON字符串
      返回:
      添加后的配置资源键值对集合
      抛出:
      SQLException - SQL异常
      BusiException - 业务异常
    • renamePath

      @Comment("\u4fee\u6539\u8def\u5f84") void renamePath(String srcFilePath, String newFilePath) throws SQLException, BusiException
      修改路径
      参数:
      srcFilePath - 原路径
      newFilePath - 新路径
      抛出:
      SQLException - SQL异常
      BusiException - 业务异常
    • updateByPath

      @Comment("\u66f4\u65b0\u914d\u7f6e\u8d44\u6e90") Map<String,Object> updateByPath(String filePath, String fileJson) throws SQLException, BusiException
      更新配置资源
      参数:
      filePath - 配置资源文件的路径
      fileJson - 配置资源的JSON字符串
      返回:
      更新后的配置资源键值对集合
      抛出:
      SQLException - SQL异常
      BusiException - 业务异常
    • listByPath

      @Comment("\u67e5\u8be2\u6587\u4ef6\u5217\u8868") <T> List<T> listByPath(String filePath, Class<T> cls) throws SQLException
      查询文件列表
      类型参数:
      T - 泛型参数,表示文件对象类型
      参数:
      filePath - 文件路径
      cls - 文件对象类型
      返回:
      文件对象列表
      抛出:
      SQLException - 如果数据库查询操作发生异常,则抛出此异常
    • listByRegex

      @Comment("\u67e5\u8be2\u6587\u4ef6\u5217\u8868") List<com.alibaba.fastjson.JSONObject> listByRegex(String filePath, String regex) throws SQLException
      查询文件列表
      参数:
      filePath - 文件路径
      regex - 正则表达式
      返回:
      文件列表
      抛出:
      SQLException - 如果发生数据库访问异常,抛出此异常
    • listByRegex

      @Comment("\u67e5\u8be2\u6587\u4ef6\u5217\u8868") <T> List<T> listByRegex(String filePath, String regex, Class<T> cls) throws SQLException
      查询文件列表
      类型参数:
      T - 返回对象类型
      参数:
      filePath - 文件路径
      regex - 正则表达式
      cls - 返回对象类型
      返回:
      文件列表
      抛出:
      SQLException - 数据库操作异常
    • listByPath

      @Comment("\u67e5\u8be2\u6587\u4ef6\u5217\u8868") List<com.alibaba.fastjson.JSONObject> listByPath(String filePath)
      查询文件列表
      参数:
      filePath - 文件路径
      返回:
      包含文件信息的JSON对象列表
    • deleteByPath

      @Comment("\u5220\u9664\u914d\u7f6e\u8d44\u6e90") void deleteByPath(String filePath) throws BusiException
      删除配置资源
      参数:
      filePath - 配置资源的路径
      抛出:
      BusiException - 如果删除过程中出现业务异常
    • deleteBatch

      @Comment("\u6279\u91cf\u5220\u9664\u914d\u7f6e\u8d44\u6e90") void deleteBatch(String filePath) throws BusiException
      批量删除配置资源
      参数:
      filePath - 配置文件的路径
      抛出:
      BusiException - 业务异常