liurunyu
2025-02-10 2247f804a94f5bb44e1dc92ae43f4f0a4932db83
ID生成器优化
1个文件已修改
9 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/util/IDLongGenerator.java
@@ -22,6 +22,7 @@
    //此ID生成器在各个子系统中难免为同一类数据生成相同的ID,造成数据库插入因主键相同而报错,
    //所以设计此后缀,每个子系统后缀不同
    private static int suffix = 0 ;
    private static final int noSuffix = 0 ;
    static {
        last = current() ;
@@ -56,7 +57,7 @@
     * @return ID
     */
    public static Long generateTodayStartId(){
        return (currentTodayStart() * chengShu) * 100 + suffix;
        return (currentTodayStart() * chengShu) * 100 + noSuffix;
    }
    
    /**
@@ -64,7 +65,7 @@
     * @return ID
     */
    public static Long generateTodayEndId(){
        return (currentTodayEnd() * chengShu) * 100 + suffix;
        return (currentTodayEnd() * chengShu) * 100 + noSuffix;
    }
    
    
@@ -73,7 +74,7 @@
     * @return ID
     */
    public static Long generateBeforeXDayStartId(int xday){
        return (beforeXDayStart(xday) * chengShu) * 100 + suffix;
        return (beforeXDayStart(xday) * chengShu) * 100 + noSuffix;
    }
    
    /**
@@ -81,7 +82,7 @@
     * @return ID
     */
    public static Long generateBeforeXDayEndId(int xday){
        return (beforeXDayEnd(xday) * chengShu) * 100 + suffix;
        return (beforeXDayEnd(xday) * chengShu) * 100 + noSuffix;
    }