| | |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.collections4.bidimap.DualHashBidiMap; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.StringPool; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | |
| | | 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 : ""); |
| | | |
| | | } |
| | | |
| | | public abstract VciFieldTypeEnum getFieldTypeByColumnStr(String columnStr,Integer length); |
| | | |
| | | protected final VciFieldTypeEnum getFieldTypeBeColumnStrInMap(String columnStr,Integer length,BidiMap<VciFieldTypeEnum, DdlFieldMappingAttrBO> map){ |
| | | List<VciFieldTypeEnum> fieldTypes = listFieldInMapByColumnStr(columnStr, map); |
| | | VciFieldTypeEnum finalField = null; |
| | | int i = Integer.MAX_VALUE; |
| | | if (fieldTypes.size() == 1){ |
| | | return fieldTypes.get(0); |
| | | } |
| | | for (VciFieldTypeEnum fieldType : fieldTypes) { |
| | | 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; |
| | | } |
| | | |
| | | } |