|
|
@ -1,6 +1,9 @@ |
|
|
|
package com.storeroom.modules.dictionary.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import com.storeroom.modules.common.ArchivesListToMap; |
|
|
|
import com.storeroom.modules.dictionary.domain.ArchivesDictionary; |
|
|
|
import com.storeroom.modules.dictionary.domain.Field; |
|
|
|
import com.storeroom.modules.dictionary.domain.vo.FieldVO; |
|
|
|
import com.storeroom.modules.dictionary.service.ArchivesDictionaryService; |
|
|
|
import com.storeroom.modules.dictionary.service.DynamicTableService; |
|
|
@ -15,7 +18,6 @@ import org.springframework.jdbc.datasource.DataSourceUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.sql.DataSource; |
|
|
|
import java.sql.Connection; |
|
|
|
import java.sql.ResultSet; |
|
|
@ -40,7 +42,7 @@ public class DynamicTableImpl implements DynamicTableService { |
|
|
|
List<Integer> integerList = new ArrayList<>(); |
|
|
|
if (type == 4 || type == 5) { |
|
|
|
//#生成文件表名称 |
|
|
|
String fileTableName = "file_"+tableName; |
|
|
|
String fileTableName = "file_" + tableName; |
|
|
|
integerList.add(1); |
|
|
|
integerList.add(2); |
|
|
|
//先查询类型1和2的数据字段 |
|
|
@ -71,6 +73,42 @@ public class DynamicTableImpl implements DynamicTableService { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成模版表 |
|
|
|
* |
|
|
|
* @param categoryId |
|
|
|
* @param tableName |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void DynamicTemplateTable(String categoryId, String tableName) { |
|
|
|
List<ArchivesDictionary> arcList = archivesDictionaryService.queryCategoryId(categoryId); |
|
|
|
//#生成文件表名称 |
|
|
|
String fileTableName = "file_" + tableName; |
|
|
|
List<FieldVO> fieldVOList = new ArrayList<>(); |
|
|
|
arcList.forEach(item -> { |
|
|
|
FieldVO fieldVO = new FieldVO(); |
|
|
|
Field field = fieldService.findByCNName(item.getFieldCnName()); |
|
|
|
if (!ObjectUtil.isEmpty(field)) { |
|
|
|
fieldVO.setId(field.getId()); |
|
|
|
fieldVO.setIsSystem(field.getIsSystem()); |
|
|
|
} |
|
|
|
fieldVO.setFieldName(item.getFieldName()); |
|
|
|
fieldVO.setFieldCnName(item.getFieldCnName()); |
|
|
|
fieldVO.setIsDefaultValue(item.getIsDefaultValue()); |
|
|
|
fieldVO.setIsDataType(item.getIsDataType()); |
|
|
|
fieldVO.setIsDataTypeDetails(item.getIsDataTypeDetails()); |
|
|
|
fieldVO.setIsDefaultValue(item.getIsDefaultValue()); |
|
|
|
fieldVO.setIsColumnLength(item.getIsColumnLength()); |
|
|
|
fieldVO.setIsSequence(item.getIsSequence()); |
|
|
|
fieldVO.setIsType(item.getIsType()); |
|
|
|
|
|
|
|
fieldVOList.add(fieldVO); |
|
|
|
}); |
|
|
|
DynamicInsert(fieldVOList, categoryId); |
|
|
|
DynamicCreateFileTable(fieldVOList, categoryId); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查询字典字段 |
|
|
@ -143,7 +181,7 @@ public class DynamicTableImpl implements DynamicTableService { |
|
|
|
archivesDictionaryDTO.setIsSystem(j.getIsSystem()); |
|
|
|
archivesDictionaryDTO.setIsColumnType(j.getIsType()); |
|
|
|
archivesDictionaryDTO.setIsInput(true); |
|
|
|
archivesDictionaryDTO.setIsInputClass(j.getIsDataType()==2?"number":"text"); |
|
|
|
archivesDictionaryDTO.setIsInputClass(j.getIsDataType() == 2 ? "number" : "text"); |
|
|
|
archivesDictionaryDTO.setEditLength(196); |
|
|
|
newList.add(archivesDictionaryDTO); |
|
|
|
} |
|
|
|