Skip to content

Commit 380c332

Browse files
authored
修复数据比较时,max 比较错误问题
MYSQL数据库max(9)比max(10)大?https://segmentfault.com/a/1190000040411098
1 parent c36abcd commit 380c332

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Utils/Uuid.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static function uuid($hex = true)
1717

1818
public static function getCurrentSerialNumber(string $modelClass, $serialNumberField = 'serial_number'): int
1919
{
20-
return $modelClass::whereDate('created_at', now())->max(DB::raw("cast({$serialNumberField} as INTEGER)")) ?? 0;
20+
return $modelClass::whereDate('created_at', now())->max(DB::raw("cast({$serialNumberField} as UNSIGNED INTEGER)")) ?? 0;
2121
}
2222

2323
public static function generateNextSerialNumberNo(int $serialNumber, int $padLength = 3): string

0 commit comments

Comments
 (0)