类 AutoCodeHelper

java.lang.Object
net.sohelp.boot.admin.core.helper.AutoCodeHelper

@Component public class AutoCodeHelper extends Object
生成下一个唯一自动编码
从以下版本开始:
2024/8/27 7:23
作者:
AaronFung
  • 构造器详细资料

    • AutoCodeHelper

      public AutoCodeHelper()
  • 方法详细资料

    • format

      @Comment("\u6839\u636e\u6a21\u677f\u4e2d\u7684\u53d8\u91cf\u540d\u4ece dataMap \u83b7\u53d6\u6570\u636e") public String format(String template, Map<String,Object> dataMap) throws TokenAuthenticationException, SQLException
      根据模板中的变量名从 dataMap 获取数据
      参数:
      template - 模板字符串
      dataMap - 数据映射
      返回:
      替换后的字符串
      抛出:
      TokenAuthenticationException
      SQLException
    • padPre

      public String padPre(int value, int len)
      指定长度,不满使用前缀0补齐
      参数:
      value - 数字
      len - 长度
      返回:
    • nextVal

      @Comment("\u83b7\u53d6\u4e0b\u4e00\u4e2a\u81ea\u52a8\u7f16\u7801") public String nextVal(String tableName, String fieldName, String periodValue, int len) throws SQLException
      获取下一个自动编码
      参数:
      tableName - 表名
      fieldName - 字段名
      periodValue - 周期值
      返回:
      抛出:
      SQLException
    • nextVal

      public String nextVal(String tableName, String fieldName, String periodValue, int len, boolean commit) throws SQLException
      生成下一个值
      参数:
      tableName - 表名
      fieldName - 字段名
      periodValue - 周期值
      len - 长度
      commit - 是否提交
      返回:
      生成的下一个值
      抛出:
      SQLException - 如果查询数据库时发生错误,则抛出此异常