fix(material): 修复材料编码生成问题

This commit is contained in:
han0
2023-12-15 17:45:06 +08:00
parent dcdd2e21e6
commit 7e5b8bd195
2 changed files with 4 additions and 1 deletions

View File

@@ -144,7 +144,7 @@ public class MaterialController {
query.orderByDesc(Material::getId); query.orderByDesc(Material::getId);
var data = materialService.list(query); var data = materialService.list(query);
String maxBrotherId; String maxBrotherId;
if (data == null) { if (data == null || data.size() == 0) {
maxBrotherId = null; maxBrotherId = null;
} else { } else {
maxBrotherId = data.get(0).getId(); maxBrotherId = data.get(0).getId();

View File

@@ -11,6 +11,9 @@ public class MaterialService extends ServiceImpl<BaseMapper<Material>, Material>
String prefix; String prefix;
String suffix; String suffix;
String previous; String previous;
if (maxBrotherId == null) {
maxBrotherId = "60.60.60.60";
}
if (parentId.contains("00.00.00.00")) { if (parentId.contains("00.00.00.00")) {
prefix = ""; prefix = "";
suffix = ".00.00.00"; suffix = ".00.00.00";