From 70f39cb1eecbb742dab0eb517a48a6bab8d0a576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Thu, 29 Dec 2022 15:42:31 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=E4=B8=8E=E6=A1=86=E6=9E=B6=E4=B8=BB?= =?UTF-8?q?=E4=BD=93=E4=BD=BF=E7=94=A8=E7=9B=B8=E5=90=8C=E7=9A=84=E4=B8=BB?= =?UTF-8?q?=E9=94=AE=E7=94=9F=E6=88=90=E5=99=A8=20=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E7=BB=9F=E4=B8=80=E9=81=BF=E5=85=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/generator/service/GenTableServiceImpl.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java index 7a80229b..085589fb 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/service/GenTableServiceImpl.java @@ -3,12 +3,11 @@ package com.ruoyi.generator.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.lang.Dict; -import cn.hutool.core.lang.Snowflake; -import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.dynamic.datasource.annotation.DS; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.constant.Constants; @@ -58,6 +57,7 @@ public class GenTableServiceImpl implements IGenTableService { private final GenTableMapper baseMapper; private final GenTableColumnMapper genTableColumnMapper; + private final IdentifierGenerator identifierGenerator; /** * 查询业务字段列表 @@ -205,10 +205,9 @@ public class GenTableServiceImpl implements IGenTableService { Map dataMap = new LinkedHashMap<>(); // 查询表信息 GenTable table = baseMapper.selectGenTableById(tableId); - Snowflake snowflake = IdUtil.getSnowflake(); List menuIds = new ArrayList<>(); for (int i = 0; i < 6; i++) { - menuIds.add(snowflake.nextId()); + menuIds.add(identifierGenerator.nextId(null).longValue()); } table.setMenuIds(menuIds); // 设置主子表信息 @@ -356,10 +355,9 @@ public class GenTableServiceImpl implements IGenTableService { private void generatorCode(String tableName, ZipOutputStream zip) { // 查询表信息 GenTable table = baseMapper.selectGenTableByName(tableName); - Snowflake snowflake = IdUtil.getSnowflake(); List menuIds = new ArrayList<>(); for (int i = 0; i < 6; i++) { - menuIds.add(snowflake.nextId()); + menuIds.add(identifierGenerator.nextId(null).longValue()); } table.setMenuIds(menuIds); // 设置主子表信息