From 8201d8788cba8f331e66b36e4d52f3f9988cf3e2 Mon Sep 17 00:00:00 2001 From: gphwxhq <67794409+gphwxhq@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:00:53 +0800 Subject: [PATCH] [Fix-3728][admin] Fix the issue with the saveOrUpdate method in the git project module (#3730) --- .../dinky/service/impl/GitProjectServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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();