columnList = model.getColumnList();
StringBuilder str = new StringBuilder();
str.append("CREATE TABLE `").append(SQLFilterKit.replaceSQL(tableName))
.append("`").append(" (");
for (int i = 0; i < columnList.size(); i++) {
- CreaterTableColumnModel tmp = columnList.get(i);
+ GenTableColumnModel tmp = columnList.get(i);
// 字段名
str.append("`").append(
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/SyncStrategy.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/SyncStrategy.java
similarity index 80%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/SyncStrategy.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/SyncStrategy.java
index 04b76dd8..7020a481 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/SyncStrategy.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/SyncStrategy.java
@@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.core.creater.strategy.sync;
+package org.opsli.core.generator.strategy.sync;
-import org.opsli.core.creater.enums.DataBaseType;
-import org.opsli.modulars.creater.table.wrapper.CreaterTableAndColumnModel;
+import org.opsli.core.generator.enums.DataBaseType;
+import org.opsli.modulars.generator.table.wrapper.GenTableAndColumnModel;
/**
* 同步策略
@@ -37,6 +37,6 @@ public interface SyncStrategy {
*
* @param model 模型
*/
- void execute(CreaterTableAndColumnModel model);
+ void execute(GenTableAndColumnModel model);
}
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/entity/FieldTypeAttribute.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/entity/FieldTypeAttribute.java
similarity index 94%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/entity/FieldTypeAttribute.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/entity/FieldTypeAttribute.java
index e8fe02ad..9859c34c 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/entity/FieldTypeAttribute.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/entity/FieldTypeAttribute.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.core.creater.strategy.sync.mysql.entity;
+package org.opsli.core.generator.strategy.sync.mysql.entity;
import lombok.Data;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/enums/MySQLSyncColumnType.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/enums/MySQLSyncColumnType.java
similarity index 95%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/enums/MySQLSyncColumnType.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/enums/MySQLSyncColumnType.java
index 64ad6ccd..c057af5c 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/mysql/enums/MySQLSyncColumnType.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/mysql/enums/MySQLSyncColumnType.java
@@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.core.creater.strategy.sync.mysql.enums;
+package org.opsli.core.generator.strategy.sync.mysql.enums;
-import org.opsli.core.creater.strategy.sync.mysql.entity.FieldTypeAttribute;
+import org.opsli.core.generator.strategy.sync.mysql.entity.FieldTypeAttribute;
import java.util.HashMap;
import java.util.Map;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/util/SqlSyncUtil.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/util/SqlSyncUtil.java
similarity index 88%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/util/SqlSyncUtil.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/util/SqlSyncUtil.java
index 289282a9..68ae3e5b 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/strategy/sync/util/SqlSyncUtil.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/strategy/sync/util/SqlSyncUtil.java
@@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.core.creater.strategy.sync.util;
+package org.opsli.core.generator.strategy.sync.util;
import cn.hutool.core.util.ClassUtil;
import lombok.extern.slf4j.Slf4j;
-import org.opsli.core.creater.enums.DataBaseType;
-import org.opsli.core.creater.strategy.sync.SyncStrategy;
+import org.opsli.core.generator.enums.DataBaseType;
+import org.opsli.core.generator.strategy.sync.SyncStrategy;
import org.opsli.core.utils.SpringContextHolder;
-import org.opsli.modulars.creater.table.wrapper.CreaterTableAndColumnModel;
+import org.opsli.modulars.generator.table.wrapper.GenTableAndColumnModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -68,7 +68,7 @@ public class SqlSyncUtil {
* 执行
* @param model 模型
*/
- public static void execute(CreaterTableAndColumnModel model){
+ public static void execute(GenTableAndColumnModel model){
if(model == null){
return;
}
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/utils/EnjoyUtil.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/EnjoyUtil.java
similarity index 72%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/utils/EnjoyUtil.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/EnjoyUtil.java
index 17c0ee2a..0d6b48a1 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/core/creater/utils/EnjoyUtil.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/EnjoyUtil.java
@@ -1,4 +1,19 @@
-package org.opsli.core.creater.utils;
+/**
+ * Copyright 2020 OPSLI 快速开发平台 https://www.opsli.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.opsli.core.generator.utils;
import cn.hutool.core.io.IoUtil;
import com.google.common.collect.Maps;
diff --git a/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/GeneratorHandleUtil.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/GeneratorHandleUtil.java
new file mode 100644
index 00000000..43208a67
--- /dev/null
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/core/generator/utils/GeneratorHandleUtil.java
@@ -0,0 +1,114 @@
+/**
+ * Copyright 2020 OPSLI 快速开发平台 https://www.opsli.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.opsli.core.generator.utils;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.collection.ListUtil;
+import org.apache.commons.lang3.StringUtils;
+import org.opsli.common.enums.DictType;
+import org.opsli.common.enums.ValiArgsType;
+import org.opsli.common.utils.HumpUtil;
+import org.opsli.modulars.generator.column.wrapper.GenTableColumnModel;
+import org.opsli.modulars.generator.logs.wrapper.GenBuilderModel;
+import org.opsli.modulars.generator.table.wrapper.GenTableAndColumnModel;
+
+import java.util.List;
+
+/***
+ * 代码生成器 处理工具类
+ *
+ * @author parker
+ * @date 2020-11-18 13:21
+ */
+public final class GeneratorHandleUtil {
+
+ /** 后端 验证前缀 */
+ private static final String BACKEND_VALIDATE_TYPE_PREFIX = "ValiArgsType.";
+
+ public static GenBuilderModel handleData(GenBuilderModel builderModel, List excludeFields){
+ if(builderModel == null){
+ return null;
+ }
+
+ // 非法处理
+ if(CollUtil.isEmpty(excludeFields)){
+ excludeFields = ListUtil.empty();
+ }
+
+ // 处理表信息
+ GenTableAndColumnModel model = builderModel.getModel();
+ // 数据库表名转驼峰
+ model.setTableHumpName(
+ HumpUtil.captureName(
+ HumpUtil.underlineToHump(
+ model.getTableName()
+ )
+ )
+ );
+
+ // 表字段数据处理
+ List columnList = model.getColumnList();
+ if(!CollUtil.isEmpty(columnList)){
+ // 遍历排除字段
+ List finalExcludeFields = excludeFields;
+ columnList.removeIf(tmp -> finalExcludeFields.contains(tmp.getFieldName()));
+
+ for (GenTableColumnModel columnModel : columnList) {
+ // 1. 数据库字段名转驼峰
+ columnModel.setFieldHumpName(
+ HumpUtil.underlineToHump(
+ columnModel.getFieldName()
+ )
+ );
+
+ // 2. 后端字段验证
+ // 处理验证器
+ String validateType = columnModel.getValidateType();
+ if(StringUtils.isNotBlank(validateType)){
+ String[] validateTypes = validateType.split(",");
+ StringBuilder stb = new StringBuilder();
+ boolean izNotNull = false;
+ // 如果非空 则开启非空验证
+ if(DictType.NO_YES_YES.getValue().equals(columnModel.getIzNotNull())){
+ izNotNull = true;
+ stb.append(BACKEND_VALIDATE_TYPE_PREFIX).append(ValiArgsType.IS_NOT_NULL);
+ }
+
+ for (int i = 0; i < validateTypes.length; i++) {
+ String type = validateTypes[i];
+ if(izNotNull){
+ stb.append(", ");
+ izNotNull = false;
+ }
+ if(!ValiArgsType.IS_NOT_NULL.equals(ValiArgsType.valueOf(type))){
+ stb.append(BACKEND_VALIDATE_TYPE_PREFIX).append(type);
+ }
+ if(i < validateTypes.length -1 ){
+ stb.append(", ");
+ }
+ }
+ columnModel.setBackendValidateType(stb.toString());
+ }
+ }
+ }
+
+ return builderModel;
+ }
+
+ // =================
+
+ private GeneratorHandleUtil(){}
+}
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/entity/CreaterTableColumn.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/entity/GenTableColumn.java
similarity index 92%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/entity/CreaterTableColumn.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/entity/GenTableColumn.java
index 5c0fd790..4e2d6e52 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/entity/CreaterTableColumn.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/entity/GenTableColumn.java
@@ -13,9 +13,8 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.column.entity;
+package org.opsli.modulars.generator.column.entity;
-import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.opsli.core.base.entity.BaseEntity;
@@ -28,7 +27,7 @@ import org.opsli.core.base.entity.BaseEntity;
*/
@Data
@EqualsAndHashCode(callSuper = false)
-public class CreaterTableColumn extends BaseEntity {
+public class GenTableColumn extends BaseEntity {
/** 归属表ID */
private String tableId;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/mapper/TableColumnMapper.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/GenTableColumnMapper.java
similarity index 81%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/mapper/TableColumnMapper.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/GenTableColumnMapper.java
index 67db26f5..6eacc182 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/mapper/TableColumnMapper.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/GenTableColumnMapper.java
@@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.column.mapper;
+package org.opsli.modulars.generator.column.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
-import org.opsli.modulars.creater.column.entity.CreaterTableColumn;
+import org.opsli.modulars.generator.column.entity.GenTableColumn;
/**
@@ -27,7 +27,7 @@ import org.opsli.modulars.creater.column.entity.CreaterTableColumn;
* @date 2020-09-16 17:34
*/
@Mapper
-public interface TableColumnMapper extends BaseMapper {
+public interface GenTableColumnMapper extends BaseMapper {
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/createrlogs/mapper/xml/CreaterLogsMapper.xml b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/xml/GenTableColumnMapper.xml
similarity index 65%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/createrlogs/mapper/xml/CreaterLogsMapper.xml
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/xml/GenTableColumnMapper.xml
index d0425f58..c4d2595f 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/createrlogs/mapper/xml/CreaterLogsMapper.xml
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/mapper/xml/GenTableColumnMapper.xml
@@ -1,6 +1,6 @@
-
+
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/ITableColumnService.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/IGenTableColumnService.java
similarity index 75%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/ITableColumnService.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/IGenTableColumnService.java
index 86e163e1..e4c41f19 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/ITableColumnService.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/IGenTableColumnService.java
@@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.column.service;
+package org.opsli.modulars.generator.column.service;
import org.opsli.core.base.service.interfaces.CrudServiceInterface;
-import org.opsli.modulars.creater.column.entity.CreaterTableColumn;
-import org.opsli.modulars.creater.column.wrapper.CreaterTableColumnModel;
+import org.opsli.modulars.generator.column.entity.GenTableColumn;
+import org.opsli.modulars.generator.column.wrapper.GenTableColumnModel;
import java.util.List;
@@ -28,14 +28,14 @@ import java.util.List;
* @author parker
* @date 2020-09-16 17:34
*/
-public interface ITableColumnService extends CrudServiceInterface {
+public interface IGenTableColumnService extends CrudServiceInterface {
/**
* 根据表ID 获得数据
* @param tableId 表ID
* @return List
*/
- List getByTableId(String tableId);
+ List getByTableId(String tableId);
/**
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/impl/TableColumnServiceImpl.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/impl/GenTableColumnServiceImpl.java
similarity index 69%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/impl/TableColumnServiceImpl.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/impl/GenTableColumnServiceImpl.java
index 36fd5ca0..8e2c2415 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/service/impl/TableColumnServiceImpl.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/service/impl/GenTableColumnServiceImpl.java
@@ -13,21 +13,21 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.column.service.impl;
+package org.opsli.modulars.generator.column.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.opsli.common.constants.MyBatisConstants;
import org.opsli.core.base.service.impl.CrudServiceImpl;
-import org.opsli.core.creater.exception.CreaterException;
-import org.opsli.core.creater.msg.CreaterMsg;
+import org.opsli.core.generator.exception.GeneratorException;
+import org.opsli.core.generator.msg.GeneratorMsg;
import org.opsli.core.persistence.querybuilder.GenQueryBuilder;
import org.opsli.core.persistence.querybuilder.QueryBuilder;
import org.opsli.core.utils.ValidationUtil;
-import org.opsli.modulars.creater.column.entity.CreaterTableColumn;
-import org.opsli.modulars.creater.column.mapper.TableColumnMapper;
-import org.opsli.modulars.creater.column.service.ITableColumnService;
-import org.opsli.modulars.creater.column.wrapper.CreaterTableColumnModel;
+import org.opsli.modulars.generator.column.entity.GenTableColumn;
+import org.opsli.modulars.generator.column.mapper.GenTableColumnMapper;
+import org.opsli.modulars.generator.column.service.IGenTableColumnService;
+import org.opsli.modulars.generator.column.wrapper.GenTableColumnModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -42,15 +42,15 @@ import java.util.List;
* @date 2020-09-16 17:34
*/
@Service
-public class TableColumnServiceImpl extends CrudServiceImpl
- implements ITableColumnService {
+public class GenTableColumnServiceImpl extends CrudServiceImpl
+ implements IGenTableColumnService {
@Autowired(required = false)
- private TableColumnMapper mapper;
+ private GenTableColumnMapper mapper;
@Override
@Transactional(rollbackFor = Exception.class)
- public CreaterTableColumnModel insert(CreaterTableColumnModel model) {
+ public GenTableColumnModel insert(GenTableColumnModel model) {
// 验证对象
ValidationUtil.verify(model);
@@ -62,7 +62,7 @@ public class TableColumnServiceImpl extends CrudServiceImpl 0){
// 重复
- throw new CreaterException(CreaterMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
+ throw new GeneratorException(GeneratorMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
}
return super.insert(model);
@@ -75,13 +75,13 @@ public class TableColumnServiceImpl extends CrudServiceImpl models) {
+ public boolean insertBatch(List models) {
if(models == null || models.size() == 0){
return false;
}
- for (CreaterTableColumnModel model : models) {
+ for (GenTableColumnModel model : models) {
// 验证对象合法性
ValidationUtil.verify(model);
@@ -90,7 +90,7 @@ public class TableColumnServiceImpl extends CrudServiceImpl 0){
// 重复
- throw new CreaterException(CreaterMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
+ throw new GeneratorException(GeneratorMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
}
// 默认清空 创建人和修改人
@@ -104,14 +104,14 @@ public class TableColumnServiceImpl extends CrudServiceImpl entitys = transformMs2Ts(models);
- return super.saveBatch(entitys);
+ List entityList = transformMs2Ts(models);
+ return super.saveBatch(entityList);
}
@Override
@Transactional(rollbackFor = Exception.class)
- public CreaterTableColumnModel update(CreaterTableColumnModel model) {
+ public GenTableColumnModel update(GenTableColumnModel model) {
// 验证对象
ValidationUtil.verify(model);
@@ -123,24 +123,24 @@ public class TableColumnServiceImpl extends CrudServiceImpl 0){
// 重复
- throw new CreaterException(CreaterMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
+ throw new GeneratorException(GeneratorMsg.EXCEPTION_TABLE_COLUMN_FIELD_NAME_REPEAT);
}
return super.update(model);
}
@Override
- public List getByTableId(String tableId) {
+ public List getByTableId(String tableId) {
if( StringUtils.isEmpty(tableId) ){
return null;
}
- QueryBuilder queryBuilder =
+ QueryBuilder queryBuilder =
new GenQueryBuilder<>();
- QueryWrapper wrapper = queryBuilder.build();
+ QueryWrapper wrapper = queryBuilder.build();
wrapper.eq("table_id", tableId);
wrapper.orderByAsc("sort");
- List tableColumnList = this.findList(wrapper);
+ List tableColumnList = this.findList(wrapper);
return super.transformTs2Ms(tableColumnList);
}
@@ -149,9 +149,9 @@ public class TableColumnServiceImpl extends CrudServiceImpl queryBuilder =
+ QueryBuilder queryBuilder =
new GenQueryBuilder<>();
- QueryWrapper wrapper = queryBuilder.build();
+ QueryWrapper wrapper = queryBuilder.build();
wrapper.eq("table_id", tableId);
super.remove(wrapper);
}
@@ -161,9 +161,9 @@ public class TableColumnServiceImpl extends CrudServiceImpl queryBuilder =
+ QueryBuilder queryBuilder =
new GenQueryBuilder<>();
- QueryWrapper wrapper = queryBuilder.build();
+ QueryWrapper wrapper = queryBuilder.build();
wrapper.eq("table_id", tableId);
super.remove(wrapper);
}
@@ -179,11 +179,11 @@ public class TableColumnServiceImpl extends CrudServiceImpl wrapper = new QueryWrapper<>();
+ QueryWrapper wrapper = new QueryWrapper<>();
// code 唯一
wrapper.eq("table_id", model.getTableId())
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/wrapper/CreaterTableColumnModel.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/wrapper/GenTableColumnModel.java
similarity index 70%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/wrapper/CreaterTableColumnModel.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/wrapper/GenTableColumnModel.java
index 0ccf1013..b24fabe6 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/column/wrapper/CreaterTableColumnModel.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/column/wrapper/GenTableColumnModel.java
@@ -13,9 +13,10 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.column.wrapper;
+package org.opsli.modulars.generator.column.wrapper;
-import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -23,7 +24,8 @@ import org.opsli.api.base.warpper.ApiWrapper;
import org.opsli.common.annotation.validation.ValidationArgs;
import org.opsli.common.annotation.validation.ValidationArgsLenMax;
import org.opsli.common.enums.ValiArgsType;
-import org.opsli.plugins.excel.annotation.ExcelInfo;
+
+import java.util.List;
/**
* 代码生成器 - 表 模型
@@ -33,122 +35,123 @@ import org.opsli.plugins.excel.annotation.ExcelInfo;
*/
@Data
@EqualsAndHashCode(callSuper = false)
-public class CreaterTableColumnModel extends ApiWrapper {
+public class GenTableColumnModel extends ApiWrapper {
/** 归属表ID */
@ApiModelProperty(value = "归属表ID")
- @ExcelProperty(value = "归属表ID", order = 1)
- @ExcelInfo
+ @ExcelIgnore
private String tableId;
/** 字段名称 */
@ApiModelProperty(value = "字段名称")
- @ExcelProperty(value = "字段名称", order = 2)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(100)
private String fieldName;
/** 字段类型 */
@ApiModelProperty(value = "字段类型")
- @ExcelProperty(value = "字段类型", order = 3)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(100)
private String fieldType;
/** 字段长度 */
@ApiModelProperty(value = "字段长度")
- @ExcelProperty(value = "字段长度", order = 4)
- @ExcelInfo
+ @ExcelIgnore
private Integer fieldLength;
/** 字段精度 */
@ApiModelProperty(value = "字段精度")
- @ExcelProperty(value = "字段精度", order = 5)
- @ExcelInfo
+ @ExcelIgnore
private Integer fieldPrecision;
/** 字段描述 */
@ApiModelProperty(value = "字段描述")
- @ExcelProperty(value = "字段描述", order = 6)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgsLenMax(200)
private String fieldComments;
/** 是否主键 */
@ApiModelProperty(value = "是否主键")
- @ExcelProperty(value = "是否主键", order = 7)
- @ExcelInfo(dictType = "no_yes")
+ @ExcelIgnore
@ValidationArgsLenMax(1)
private String izPk;
/** 是否可为空 */
@ApiModelProperty(value = "是否可为空")
- @ExcelProperty(value = "是否可为空", order = 8)
- @ExcelInfo(dictType = "no_yes")
+ @ExcelIgnore
@ValidationArgsLenMax(1)
private String izNotNull;
/** 是否列表显示 */
@ApiModelProperty(value = "是否列表显示")
- @ExcelProperty(value = "是否列表显示", order = 9)
- @ExcelInfo(dictType = "no_yes")
+ @ExcelIgnore
@ValidationArgsLenMax(1)
private String izShowList;
/** 是否表单显示 */
@ApiModelProperty(value = "是否表单显示")
- @ExcelProperty(value = "是否表单显示", order = 10)
- @ExcelInfo(dictType = "no_yes")
+ @ExcelIgnore
@ValidationArgsLenMax(1)
private String izShowForm;
/** Java字段类型 */
@ApiModelProperty(value = "Java字段类型")
- @ExcelProperty(value = "Java字段类型", order = 11)
- @ExcelInfo(dictType = "java_type")
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL, ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(50)
private String javaType;
/** 字段生成方案(文本框、文本域、字典选择) */
@ApiModelProperty(value = "字段生成方案")
- @ExcelProperty(value = "字段生成方案", order = 12)
- @ExcelInfo(dictType = "show_type")
+ @ExcelIgnore
@ValidationArgsLenMax(1)
private String showType;
/** 字典类型编号 */
@ApiModelProperty(value = "字典类型编号")
- @ExcelProperty(value = "字典类型编号", order = 13)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(100)
private String dictTypeCode;
/** 排序(升序) */
@ApiModelProperty(value = "排序")
- @ExcelProperty(value = "排序", order = 14)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_NOT_NULL})
@ValidationArgsLenMax(6)
private Integer sort;
/** 验证类别 */
@ApiModelProperty(value = "验证类别")
- @ExcelProperty(value = "验证类别", order = 15)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgsLenMax(500)
private String validateType;
/** 检索类别 */
@ApiModelProperty(value = "检索类别")
- @ExcelProperty(value = "检索类别", order = 16)
- @ExcelInfo
+ @ExcelIgnore
@ValidationArgs({ValiArgsType.IS_GENERAL})
@ValidationArgsLenMax(100)
private String queryType;
+ // =======================
+
+ /** 字段名称 - 驼峰 */
+ @JsonIgnore
+ @ExcelIgnore
+ private String fieldHumpName;
+
+ /** 后台验证集合 */
+ @JsonIgnore
+ @ExcelIgnore
+ private String backendValidateType;
+
+ /** 前台验证集合 */
+ @JsonIgnore
+ @ExcelIgnore
+ private List frontendValidateType;
+
}
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/general/actuator/SQLActuator.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/general/actuator/SQLActuator.java
similarity index 94%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/general/actuator/SQLActuator.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/general/actuator/SQLActuator.java
index e23a547c..3440ca28 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/general/actuator/SQLActuator.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/general/actuator/SQLActuator.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.general.actuator;
+package org.opsli.modulars.generator.general.actuator;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/ImportTableUtil.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/ImportTableUtil.java
similarity index 95%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/ImportTableUtil.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/ImportTableUtil.java
index 949247a8..2a1115e1 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/ImportTableUtil.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/ImportTableUtil.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.importable;
+package org.opsli.modulars.generator.importable;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ClassUtil;
@@ -22,11 +22,11 @@ import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.opsli.core.autoconfigure.properties.DbSourceProperties;
-import org.opsli.core.creater.enums.DataBaseType;
+import org.opsli.core.generator.enums.DataBaseType;
import org.opsli.core.utils.SpringContextHolder;
-import org.opsli.modulars.creater.importable.entity.DatabaseColumn;
-import org.opsli.modulars.creater.importable.entity.DatabaseTable;
-import org.opsli.modulars.creater.importable.service.DatabaseTableService;
+import org.opsli.modulars.generator.importable.entity.DatabaseColumn;
+import org.opsli.modulars.generator.importable.entity.DatabaseTable;
+import org.opsli.modulars.generator.importable.service.DatabaseTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseColumn.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseColumn.java
similarity index 96%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseColumn.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseColumn.java
index 0d52ffef..ca99dd9d 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseColumn.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseColumn.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.importable.entity;
+package org.opsli.modulars.generator.importable.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseTable.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseTable.java
similarity index 95%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseTable.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseTable.java
index eaaec52f..e46f54c2 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/entity/DatabaseTable.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/entity/DatabaseTable.java
@@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.importable.entity;
+package org.opsli.modulars.generator.importable.entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/MySQLDatabaseTableMapper.java b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/MySQLDatabaseTableMapper.java
similarity index 85%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/MySQLDatabaseTableMapper.java
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/MySQLDatabaseTableMapper.java
index 2bc5005a..ecb642d1 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/MySQLDatabaseTableMapper.java
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/MySQLDatabaseTableMapper.java
@@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations under
* the License.
*/
-package org.opsli.modulars.creater.importable.mapper;
+package org.opsli.modulars.generator.importable.mapper;
import org.apache.ibatis.annotations.Mapper;
-import org.opsli.modulars.creater.importable.entity.DatabaseColumn;
-import org.opsli.modulars.creater.importable.entity.DatabaseTable;
+import org.opsli.modulars.generator.importable.entity.DatabaseColumn;
+import org.opsli.modulars.generator.importable.entity.DatabaseTable;
import java.util.List;
diff --git a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/xml/MySQLDatabaseTableMapper.xml b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/xml/MySQLDatabaseTableMapper.xml
similarity index 80%
rename from opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/xml/MySQLDatabaseTableMapper.xml
rename to opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/xml/MySQLDatabaseTableMapper.xml
index 31c13bcf..97e83193 100644
--- a/opsli-modulars/opsli-modulars-creater/src/main/java/org/opsli/modulars/creater/importable/mapper/xml/MySQLDatabaseTableMapper.xml
+++ b/opsli-modulars/opsli-modulars-generator/src/main/java/org/opsli/modulars/generator/importable/mapper/xml/MySQLDatabaseTableMapper.xml
@@ -1,9 +1,9 @@
-
+
-