| | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Locale; |
| | | |
| | | /** |
| | | * Description:DLL的处理接口 |
| | |
| | | return mapper.createViewBySql(viewCreateSql); |
| | | } |
| | | |
| | | |
| | | public int createTableBySql(String tableName, String attributeSql) { |
| | | return mapper.createTableBySql(tableName, attributeSql); |
| | | } |
| | | |
| | | |
| | | public int commentTable(String tableName, String comment) { |
| | | return mapper.commentTable(tableName, comment); |
| | | } |
| | | |
| | | |
| | | public int commentColumnTable(String tableName, String columnName, String comment) { |
| | | return mapper.commentColumnTable(tableName, columnName, comment); |
| | | } |
| | | |
| | | |
| | | public int modifyTableBySql(String tableName, String attributeSql) { |
| | | return mapper.modifyTableBySql(tableName, attributeSql); |
| | | } |
| | | |
| | | |
| | | public int addColumn2TableBySql(String tableName, String attributeSql) { |
| | | return mapper.addColumn2TableBySql(tableName, attributeSql); |
| | | } |
| | | |
| | | |
| | | public int dropTable(String tableName) { |
| | | return mapper.dropTable(tableName); |
| | | } |
| | | |
| | | |
| | | public int checkTableExist(String tableName) { |
| | | return mapper.checkTableExist(tableName); |
| | | } |
| | | |
| | | |
| | | public int countAll(String tableName) { |
| | | return mapper.countAll(tableName); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取字段创建sql |
| | |
| | | } |
| | | mappingBO.setNullable(attributeVO.isNullableFlag()); |
| | | mappingBO.setDefaultValue(attributeVO.getDefaultValue()); |
| | | return mappingBO.toString() + (StringUtil.equals(attributeVO.getId(),"OID") ? StringPool.SPACE + "primary key" + StringPool.SPACE : ""); |
| | | return mappingBO.toString() + (StringUtil.equals(attributeVO.getId().toLowerCase(Locale.ROOT),"OID".toLowerCase(Locale.ROOT)) ? StringPool.SPACE + "primary key" + StringPool.SPACE : ""); |
| | | |
| | | } |
| | | |
| | |
| | | List<VciFieldTypeEnum> fieldTypes = listFieldInMapByColumnStr(columnStr, map); |
| | | VciFieldTypeEnum finalField = null; |
| | | int i = Integer.MAX_VALUE; |
| | | if (CollectionUtils.isEmpty(fieldTypes)){ |
| | | return null; |
| | | } |
| | | if (fieldTypes.size() == 1){ |
| | | return fieldTypes.get(0); |
| | | } |
| | | for (VciFieldTypeEnum fieldType : fieldTypes) { |
| | | DdlFieldMappingAttrBO bo = map.get(fieldType); |
| | | int i1 = Math.abs(bo.getDataLength() - length); |
| | | if (i1 < i){ |
| | | finalField = fieldType; |
| | | i = i1; |
| | | if (fieldType.equals(VciFieldTypeEnum.VTString)) { |
| | | finalField = VciFieldTypeEnum.VTString; |
| | | } |
| | | if (fieldType.equals(VciFieldTypeEnum.VTDateTime)){ |
| | | finalField = VciFieldTypeEnum.VTDateTime; |
| | | } |
| | | if (fieldType.equals(VciFieldTypeEnum.VTInteger) && length <= 26){ |
| | | finalField = VciFieldTypeEnum.VTInteger; |
| | | } |
| | | } |
| | | return finalField; |