Index: maku-generator-core/src/main/java/net/maku/generator/service/TemplateDetailService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/src/main/java/net/maku/generator/service/TemplateDetailService.java (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/src/main/java/net/maku/generator/service/TemplateDetailService.java (date 1708486403589)
@@ -30,12 +30,20 @@
List<TemplateDetailEntity> getList(Long templateId);
/**
- * 获取模板配置内容
+ * 获取有效模板配置内容
* @param templateID
* @return
*/
List<TemplateDetailEntity> listTemplate(Long templateID);
+
+ /**
+ * 获取所有模板配置内容
+ * @param templateID
+ * @return
+ */
+ List<TemplateDetailEntity> listAllTemplate(Long templateID);
+
/**
* 删除模板配置详情
* @param templateIds
Index: maku-generator-core/pom.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/pom.xml (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/pom.xml (date 1708583194310)
@@ -50,10 +50,13 @@
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
+ <!-- 高斯驱动 -->
<dependency>
- <groupId>org.postgresql</groupId>
- <artifactId>postgresql</artifactId>
+ <groupId>org.postgresql.Driver</groupId>
+ <artifactId>GaussDBV5</artifactId>
+ <version>R002C10SPC620_2.11.30</version>
</dependency>
+
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
Index: maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateServiceImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateServiceImpl.java (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateServiceImpl.java (date 1708486268825)
@@ -146,4 +146,17 @@
// 删除模板详情
templateDetailService.deleteBatchTemplateIds(ids);
}
+
+ @Override
+ public TemplateEntity selectOne() {
+ // 读取模板配置
+ LambdaQueryWrapper<TemplateEntity> queryWrapper = Wrappers.lambdaQuery();
+ queryWrapper.eq(TemplateEntity::getEnableFlag, "1");
+
+ TemplateEntity template = baseMapper.selectOne(queryWrapper);
+ if (template == null) {
+ throw new ServerException("模板配置不存在!");
+ }
+ return template;
+ }
}
\ No newline at end of file
Index: maku-generator-core/src/main/java/net/maku/generator/service/impl/GeneratorServiceImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/src/main/java/net/maku/generator/service/impl/GeneratorServiceImpl.java (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/src/main/java/net/maku/generator/service/impl/GeneratorServiceImpl.java (date 1708496696327)
@@ -1,5 +1,22 @@
package net.maku.generator.service.impl;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import com.google.common.collect.Lists;
+
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.util.ArrayUtil;
@@ -14,21 +31,18 @@
import net.maku.generator.entity.BaseClassEntity;
import net.maku.generator.entity.TableEntity;
import net.maku.generator.entity.TableFieldEntity;
-import net.maku.generator.service.*;
+import net.maku.generator.entity.TemplateDetailEntity;
+import net.maku.generator.entity.TemplateEntity;
+import net.maku.generator.service.BaseClassService;
+import net.maku.generator.service.DataSourceService;
+import net.maku.generator.service.FieldTypeService;
+import net.maku.generator.service.GeneratorService;
+import net.maku.generator.service.TableFieldService;
+import net.maku.generator.service.TableService;
+import net.maku.generator.service.TemplateDetailService;
+import net.maku.generator.service.TemplateService;
import net.maku.generator.utils.TemplateUtils;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import com.google.common.collect.Lists;
-
/**
* 代码生成
*
@@ -45,6 +59,7 @@
private final TableService tableService;
private final TableFieldService tableFieldService;
private final TemplateService templateService;
+ private final TemplateDetailService templateDetailService;
@Override
public void downloadCode(Long tableId, ZipOutputStream zip) {
@@ -192,6 +207,14 @@
dataModel.put("backendPath", table.getBackendPath());
dataModel.put("frontendPath", table.getFrontendPath());
+ //查询模板详情
+ TemplateEntity template = templateService.selectOne();
+ List<TemplateDetailEntity> list = templateDetailService.listAllTemplate(template.getId());
+ if (!CollectionUtils.isEmpty(list)) {
+ for (TemplateDetailEntity entity : list) {
+ dataModel.put(entity.getTemplateName().replace(".", ""), entity.getEnableFlag());
+ }
+ }
return dataModel;
}
Index: maku-generator-core/src/main/java/net/maku/generator/service/TemplateService.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/src/main/java/net/maku/generator/service/TemplateService.java (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/src/main/java/net/maku/generator/service/TemplateService.java (date 1708485633855)
@@ -46,4 +46,10 @@
void deleteBatchIds(Long[] ids);
+ /***
+ * 查询当前模板
+ * @return
+ */
+ TemplateEntity selectOne();
+
}
\ No newline at end of file
Index: maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateDetailServiceImpl.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateDetailServiceImpl.java (revision c31528287392043dc8699de92ee2f33aad89993f)
+++ maku-generator-core/src/main/java/net/maku/generator/service/impl/TemplateDetailServiceImpl.java (date 1708486403574)
@@ -88,6 +88,14 @@
return list;
}
+ @Override
+ public List<TemplateDetailEntity> listAllTemplate(Long templateID) {
+ LambdaQueryWrapper<TemplateDetailEntity> queryWrapper = Wrappers.lambdaQuery();
+ queryWrapper.eq(TemplateDetailEntity::getTemplateId, templateID);
+ List<TemplateDetailEntity> list = baseMapper.selectList(queryWrapper);
+ return list;
+ }
+
@Override
public void deleteBatchTemplateIds(Long[] templateIds) {
baseMapper.deleteBatchTemplateIds(templateIds);
makugenerate增加自定义crud控制
最新推荐文章于 2024-08-16 08:35:00 发布