| | |
| | | package com.vci.ubcs.ddl.processor.dll; |
| | | |
| | | import com.vci.ubcs.ddl.bo.DdlFieldMappingAttrBO; |
| | | import com.vci.ubcs.ddl.mapper.DllMapper; |
| | | import com.vci.ubcs.ddl.mapper.DllSqlLiteMapper; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum; |
| | | import org.apache.commons.collections4.BidiMap; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | * @author LiHang |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | public class DllSqlLiteMapperProcessor extends DllMapperProcessor{ |
| | | private static DllMapper mapper = VciSpringUtil.getBean(DllSqlLiteMapper.class); |
| | | |
| | | private static final BidiMap<VciFieldTypeEnum, DdlFieldMappingAttrBO> FIELD_MAP = getMappingMapCopy(); |
| | | |
| | | @Resource |
| | | private DllSqlLiteMapper realMapper; |
| | | |
| | | private static DllMapper mapper; |
| | | |
| | | @PostConstruct |
| | | public void init(){ |
| | | mapper = realMapper; |
| | | static { |
| | | // 需要重新映射的字段类型在这里写 |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDouble,new DdlFieldMappingAttrBO("NUMERIC",26,8,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTInteger,new DdlFieldMappingAttrBO("INT",22,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTLong,new DdlFieldMappingAttrBO("INT",22,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTBoolean,new DdlFieldMappingAttrBO("VARCHAR",5,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDate,new DdlFieldMappingAttrBO("DATETIME",null,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTDateTime,new DdlFieldMappingAttrBO("DATETIME",null,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTTime,new DdlFieldMappingAttrBO("DATETIME",null,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTFilePath,new DdlFieldMappingAttrBO("VARCHAR",100,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTClob,new DdlFieldMappingAttrBO("varchar(max)",100,null,true,null)); |
| | | FIELD_MAP.put(VciFieldTypeEnum.VTString,new DdlFieldMappingAttrBO("VARCHAR",100,null,true,null)); |
| | | } |
| | | |
| | | public DllSqlLiteMapperProcessor() { |
| | | super(mapper); |
| | | System.out.println("-----------------"); |
| | | if (mapper != null){ |
| | | System.out.println("[success]::加载SqlLite数据库DLL操作服务成功"); |
| | | }else { |
| | | System.out.println("[fail]::加载SqlList数据库DLL操作服务失败"); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | return "org.sqlite.JDBC".equals(url); |
| | | } |
| | | |
| | | @Override |
| | | protected DdlFieldMappingAttrBO getMappingBO(VciFieldTypeEnum fieldTypeEnum) { |
| | | return getMappingBOInMap(fieldTypeEnum,FIELD_MAP); |
| | | } |
| | | |
| | | /** |
| | | * 获取创建的sql语句中属性部分 |
| | | * 按数据库字段类型列举所有的VCI字段类型 |
| | | * |
| | | * @param attributeVOList 属性的立碑 |
| | | * @return sql语句 |
| | | * @param columnStr 数据库字段类型 |
| | | * @return VCI字段类型 |
| | | */ |
| | | @Override |
| | | public String getCreateSqlByAttributeForBtm(List<BtmTypeAttributeVO> attributeVOList) { |
| | | return null; |
| | | public List<VciFieldTypeEnum> listFieldByColumnStr(String columnStr) { |
| | | return listFieldInMapByColumnStr(columnStr,FIELD_MAP); |
| | | } |
| | | } |