diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java index 37a2b2cefe..8e45ac0ff6 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/GitProjectServiceImpl.java @@ -68,15 +68,13 @@ public void saveOrUpdate(GitProjectDTO gitProjectDTO) { GitProject gitProject = BeanUtil.toBean(gitProjectDTO, GitProject.class); if (gitProject.getOrderLine() == null) { - Integer maxOrderLine = Opt.ofNullable(baseMapper - .selectOne(new LambdaQueryWrapper() - .orderByAsc(GitProject::getOrderLine) - .last(" limit 1")) - .getOrderLine()) - .orElse(999); + Integer maxOrderLine = Opt.ofNullable(baseMapper.selectOne(new LambdaQueryWrapper() + .orderByDesc(GitProject::getOrderLine) + .last(" limit 1"))) + .map(GitProject::getOrderLine) + .orElse(0); gitProject.setOrderLine(maxOrderLine + 1); } - BeanUtil.copyProperties(gitProjectDTO, gitProject); gitProject.insertOrUpdate();