shiqian 4 years ago
parent
commit
b3aaf73bfd

+ 2 - 1
boman-modules/boman-system/src/main/java/com/boman/system/utils/IdUtils.java

@@ -28,7 +28,8 @@ public class IdUtils {
         StandardlyMapper mapper = SpringUtils.getBean(StandardlyMapper.class);
         Long maxId = mapper.selectMaxId(tableName, pkName);
         if (null == maxId || maxId <= 0) {
-            redisService.setCacheObject(sequencesKey, 1L);
+            maxId = 1L;
+            redisService.setCacheObject(sequencesKey, maxId);
         } else {
             redisService.increment(sequencesKey, ++maxId);
         }