提交 f5f07221 编写于 作者: sq3536's avatar sq3536

etl

上级 f79dff9a
...@@ -7,7 +7,6 @@ import cn.ibizlab.core.extensions.util.MQConsumeMsgListenerProcessor; ...@@ -7,7 +7,6 @@ import cn.ibizlab.core.extensions.util.MQConsumeMsgListenerProcessor;
import cn.ibizlab.core.lite.extensions.domain.EntityObj; import cn.ibizlab.core.lite.extensions.domain.EntityObj;
import cn.ibizlab.core.lite.extensions.domain.Setting; import cn.ibizlab.core.lite.extensions.domain.Setting;
import cn.ibizlab.core.lite.extensions.model.DataModel; import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.service.DbEntityService;
import cn.ibizlab.core.lite.extensions.service.LiteDataCallback; import cn.ibizlab.core.lite.extensions.service.LiteDataCallback;
import cn.ibizlab.core.lite.extensions.service.LiteDataService; import cn.ibizlab.core.lite.extensions.service.LiteDataService;
import cn.ibizlab.core.lite.extensions.service.LiteModelService; import cn.ibizlab.core.lite.extensions.service.LiteModelService;
...@@ -50,8 +49,6 @@ public class RuleEngineExService extends RuleEngineServiceImpl { ...@@ -50,8 +49,6 @@ public class RuleEngineExService extends RuleEngineServiceImpl {
public static final String Setting_ResultDataSource = "resultDataSource"; public static final String Setting_ResultDataSource = "resultDataSource";
public static final String Setting_ResultTableName = "resultTableName"; public static final String Setting_ResultTableName = "resultTableName";
@Autowired
private DbEntityService dbEntityService;
@Autowired @Autowired
private IRuleItemService ruleItemService; private IRuleItemService ruleItemService;
......
...@@ -10,13 +10,10 @@ import org.springframework.util.ObjectUtils; ...@@ -10,13 +10,10 @@ import org.springframework.util.ObjectUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class DataObj<K,V> extends ConcurrentHashMap<K,V> { public class DataObj<K,V> extends HashMap<K,V> {
public String getRowKey() public String getRowKey()
......
...@@ -10,17 +10,20 @@ import java.util.List; ...@@ -10,17 +10,20 @@ import java.util.List;
public interface CommonEntityService { public interface CommonEntityService {
List<EntityObj> selectBase(EntityModel entityModel, QueryFilter filter); List<EntityObj> selectBase(String dsName, EntityModel entityModel, QueryFilter filter);
List<EntityObj> selectCore(EntityModel entityModel, QueryFilter filter); List<EntityObj> selectCore(String dsName, EntityModel entityModel, QueryFilter filter);
Integer selectCount(EntityModel entityModel, QueryFilter filter); Integer selectCount(String dsName, EntityModel entityModel, QueryFilter filter);
List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter); List<EntityObj> search(String dsName, String dataSet, EntityModel entityModel, QueryFilter filter);
List<EntityObj> search(String dsName, String sql, QueryFilter filter); List<EntityObj> search(String dsName, String sql, QueryFilter filter);
boolean saveBatch(EntityModel entityModel, List<EntityObj> list); void cursorRead(String dsName, EntityModel entityModel, String sql, QueryFilter filter, LiteDataCallback callback);
boolean save(EntityModel entityModel, EntityObj entityObj);
EntityObj get(EntityModel entityModel, EntityObj entityObj);
boolean saveBatch(String dsName, EntityModel entityModel, List<EntityObj> list);
boolean save(String dsName, EntityModel entityModel, EntityObj entityObj);
EntityObj get(String dsName, EntityModel entityModel, EntityObj entityObj);
void processList(DataModel dataModel, Timestamp lastModify, LiteDataCallback callback); void processList(DataModel dataModel, Timestamp lastModify, LiteDataCallback callback);
......
...@@ -40,19 +40,20 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -40,19 +40,20 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
@Override @Override
public List<EntityObj> selectBase(EntityModel entityModel, QueryFilter filter) { public List<EntityObj> selectBase(String dsName, EntityModel entityModel, QueryFilter filter) {
return search("BASE", entityModel, filter); return search(dsName,"BASE", entityModel, filter);
} }
@Override @Override
public List<EntityObj> selectCore(EntityModel entityModel, QueryFilter filter) { public List<EntityObj> selectCore(String dsName, EntityModel entityModel, QueryFilter filter) {
return search("CORE", entityModel, filter); return search(dsName,"CORE", entityModel, filter);
} }
@Override @Override
public Integer selectCount(EntityModel entityModel, QueryFilter filter) { public Integer selectCount(String dsName, EntityModel entityModel, QueryFilter filter) {
String sql = entityModel.getSqlSegment("COUNT"); String sql = entityModel.getSqlSegment("COUNT");
String dsName = entityModel.getDsName(); if(StringUtils.isEmpty(dsName))
dsName = entityModel.getDsName();
try { try {
dstDataSourceService.initDataSource(dsName); dstDataSourceService.initDataSource(dsName);
DynamicDataSourceContextHolder.push(dsName); DynamicDataSourceContextHolder.push(dsName);
...@@ -74,13 +75,13 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -74,13 +75,13 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
} }
@Override @Override
public List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter) { public List<EntityObj> search(String dsName, String dataSet, EntityModel entityModel, QueryFilter filter) {
String sql = entityModel.getSqlSegment(dataSet); String sql = entityModel.getSqlSegment(dataSet);
if (StringUtils.isEmpty(sql)) if (StringUtils.isEmpty(sql))
return new ArrayList<>(); return new ArrayList<>();
else else
return search(entityModel.getDsName(), sql, filter); return search(dsName, sql, filter);
} }
@Override @Override
...@@ -147,10 +148,76 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -147,10 +148,76 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
} }
@Override @Override
public boolean saveBatch(EntityModel entityModel, List<EntityObj> list) { public void cursorRead(String dsName, EntityModel entityModel, String sql, QueryFilter filter, LiteDataCallback callback) {
if(StringUtils.isEmpty(dsName))
dsName = entityModel.getDsName();
if(StringUtils.isEmpty(sql))
sql=entityModel.getSqlSegment("BASE");
Integer total = this.selectCount(dsName,entityModel, filter);
callback.total(total);
//没有业务数据时,不进行后续操作
if(total == 0){
return;
}
MyBatisCursorItemReader myMyBatisCursorItemReader =new MyBatisCursorItemReader();
try{
myMyBatisCursorItemReader.setSqlSessionFactory(sqlSessionFactory);
myMyBatisCursorItemReader.setQueryId("cn.ibizlab.core.extensions.mapper.DbEntityMapper.search");
DbEntitySearchContext context=new DbEntitySearchContext();
context.setFilter(filter);
QueryWrapper qw=context.getSelectCond();
if(!StringUtils.isEmpty(filter.getCustSqlSegment()))
qw.apply(filter.getCustSqlSegment());
Map<String, Object> paramsMap = new HashMap<>();
paramsMap.put("sql", sql);
paramsMap.put("ew", qw);
myMyBatisCursorItemReader.setParameterValues(paramsMap);// 设置sql传入参数
dstDataSourceService.initDataSource(dsName);
DynamicDataSourceContextHolder.push(dsName);
myMyBatisCursorItemReader.open(new ExecutionContext()); // 开启游标
//DynamicDataSourceContextHolder.poll();
List<EntityObj> datas = new ArrayList<>();
EntityObj rowdata;
while ((rowdata = (EntityObj) myMyBatisCursorItemReader.read()) != null) {
datas.add(rowdata);
if(datas.size() >= processSize){
boolean rt=callback.processData(datas);
datas.clear();
if(!rt)
break;
}
}
if(datas.size() > 0){
callback.processData(datas);
datas.clear();
}
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
} finally {
try {
myMyBatisCursorItemReader.close();// 关闭游标
} catch (Exception ex) {
//log.error(ex.getMessage());
}
DynamicDataSourceContextHolder.poll();
}
}
@Override
public boolean saveBatch(String dsName, EntityModel entityModel, List<EntityObj> list) {
try { try {
dstDataSourceService.initDataSource(entityModel.getDsName()); if(StringUtils.isEmpty(dsName))
DynamicDataSourceContextHolder.push(entityModel.getDsName()); dsName=entityModel.getDsName();
dstDataSourceService.initDataSource(dsName);
DynamicDataSourceContextHolder.push(dsName);
list.forEach(entityObj -> { list.forEach(entityObj -> {
entityObj.keySet().forEach(key -> { entityObj.keySet().forEach(key -> {
...@@ -170,10 +237,12 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -170,10 +237,12 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
} }
@Override @Override
public boolean save(EntityModel entityModel, EntityObj entityObj) { public boolean save(String dsName, EntityModel entityModel, EntityObj entityObj) {
try { try {
dstDataSourceService.initDataSource(entityModel.getDsName()); if(StringUtils.isEmpty(dsName))
DynamicDataSourceContextHolder.push(entityModel.getDsName()); dsName=entityModel.getDsName();
dstDataSourceService.initDataSource(dsName);
DynamicDataSourceContextHolder.push(dsName);
entityObj.keySet().forEach(key -> { entityObj.keySet().forEach(key -> {
if(!key.toUpperCase().equals(key)) if(!key.toUpperCase().equals(key))
entityObj.put(key.toUpperCase(),entityObj.get(key)); entityObj.put(key.toUpperCase(),entityObj.get(key));
...@@ -190,7 +259,9 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -190,7 +259,9 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
@Override @Override
public EntityObj get(EntityModel entityModel, EntityObj entityObj) { public EntityObj get(String dsName, EntityModel entityModel, EntityObj entityObj) {
if(StringUtils.isEmpty(dsName))
dsName=entityModel.getDsName();
QueryFilter filter=QueryFilter.createQuery(); QueryFilter filter=QueryFilter.createQuery();
entityModel.getKeyFields().forEach(item->{ entityModel.getKeyFields().forEach(item->{
Object val=entityObj.get(item.getColumnName()); Object val=entityObj.get(item.getColumnName());
...@@ -199,7 +270,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -199,7 +270,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
filter.eq(item.getColumnName().toUpperCase(),val); filter.eq(item.getColumnName().toUpperCase(),val);
} }
}); });
List<EntityObj> list=this.selectBase(entityModel,filter); List<EntityObj> list=this.selectBase(dsName,entityModel,filter);
if(list.size()==1) if(list.size()==1)
entityObj.putAll(list.get(0)); entityObj.putAll(list.get(0));
return entityObj; return entityObj;
...@@ -221,7 +292,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl ...@@ -221,7 +292,7 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
//记录处理的总业务数据量 //记录处理的总业务数据量
String sql=entityModel.getSqlSegment("CORE"); String sql=entityModel.getSqlSegment("CORE");
Integer total = this.selectCount(entityModel, filter); Integer total = this.selectCount(entityModel.getDsName(),entityModel, filter);
callback.total(total); callback.total(total);
......
...@@ -56,31 +56,31 @@ public class LiteDataService { ...@@ -56,31 +56,31 @@ public class LiteDataService {
} }
public boolean saveBatch(String systemId, String entityName, List<EntityObj> list) { public boolean saveBatch(String systemId, String entityName, String dsName, List<EntityObj> list) {
EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName); EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName);
splitList(list, 500).forEach(objs->{ splitList(list, 500).forEach(objs->{
getEntityService(entityModel.getDsName()).saveBatch(entityModel,objs); getEntityService(entityModel.getDsName()).saveBatch(dsName,entityModel,objs);
}); });
return true; return true;
} }
public boolean save(String systemId, String entityName, EntityObj entityObj) { public boolean save(String systemId, String entityName, String dsName, EntityObj entityObj) {
EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName); EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName);
return getEntityService(entityModel.getDsName()).save(entityModel,entityObj); return getEntityService(entityModel.getDsName()).save(dsName,entityModel,entityObj);
} }
public EntityObj get(String systemId, String entityName, EntityObj entityObj) { public EntityObj get(String systemId, String entityName, String dsName, EntityObj entityObj) {
EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName); EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName);
return getEntityService(entityModel.getDsName()).get(entityModel,entityObj); return getEntityService(entityModel.getDsName()).get(dsName,entityModel,entityObj);
} }
public List<EntityObj> search(String systemId, String entityName, QueryFilter filter) { public List<EntityObj> search(String systemId, String entityName, String dsName, QueryFilter filter) {
return search(systemId,entityName,"BASE",filter); return search(systemId,entityName,"BASE",dsName,filter);
} }
public List<EntityObj> search(String systemId, String entityName, String dataset,QueryFilter filter) { public List<EntityObj> search(String systemId, String entityName, String dataset, String dsName, QueryFilter filter) {
EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName); EntityModel entityModel = liteModelService.getEntityModel(systemId,entityName);
return getEntityService(entityModel.getDsName()).search(dataset,entityModel,filter); return getEntityService(entityModel.getDsName()).search(dsName,dataset,entityModel,filter);
} }
...@@ -126,7 +126,7 @@ public class LiteDataService { ...@@ -126,7 +126,7 @@ public class LiteDataService {
List<ModelObj> rt = new ArrayList<>(); List<ModelObj> rt = new ArrayList<>();
List<EntityObj> factEntityList = new ArrayList<>(); List<EntityObj> factEntityList = new ArrayList<>();
if (fillPropertys == null || fillPropertys.size() == 0 || fillPropertys.contains(dataModel.getFactPorperty().getPropertyName())) if (fillPropertys == null || fillPropertys.size() == 0 || fillPropertys.contains(dataModel.getFactPorperty().getPropertyName()))
splitList(kEntityObjs, 1000).forEach(list -> factEntityList.addAll(getEntityService(entityModel.getDsName()).selectBase(entityModel, QueryFilter.createQuery().cust(dataModel.lookup(list))))); splitList(kEntityObjs, 1000).forEach(list -> factEntityList.addAll(getEntityService(entityModel.getDsName()).selectBase(entityModel.getDsName(), entityModel, QueryFilter.createQuery().cust(dataModel.lookup(list)))));
factEntityList.forEach(entityObj -> factEntityList.forEach(entityObj ->
rt.add(new ModelObj().setDataModel(dataModel).setFactEntity(entityObj.setProperty(dataModel.getFactPorperty())))); rt.add(new ModelObj().setDataModel(dataModel).setFactEntity(entityObj.setProperty(dataModel.getFactPorperty()))));
fillEntityObj(dataModel, fillPropertys, rt); fillEntityObj(dataModel, fillPropertys, rt);
...@@ -144,7 +144,7 @@ public class LiteDataService { ...@@ -144,7 +144,7 @@ public class LiteDataService {
EntityModel entityModel = property.getEntityModel(); EntityModel entityModel = property.getEntityModel();
List<EntityObj> entityObjs = new ArrayList<>(); List<EntityObj> entityObjs = new ArrayList<>();
if (fillPropertys == null || fillPropertys.size() == 0 || fillPropertys.contains(property.getPropertyName())) if (fillPropertys == null || fillPropertys.size() == 0 || fillPropertys.contains(property.getPropertyName()))
splitList(modelObjs, 1000).forEach(list -> entityObjs.addAll(getEntityService(entityModel.getDsName()).selectBase(entityModel, QueryFilter.createQuery().cust(property.lookup(list))))); splitList(modelObjs, 1000).forEach(list -> entityObjs.addAll(getEntityService(entityModel.getDsName()).selectBase(entityModel.getDsName(), entityModel, QueryFilter.createQuery().cust(property.lookup(list)))));
entityObjs.forEach(entityObj -> { entityObjs.forEach(entityObj -> {
entityObj.setProperty(property); entityObj.setProperty(property);
......
...@@ -13,24 +13,24 @@ import java.util.Set; ...@@ -13,24 +13,24 @@ import java.util.Set;
@Service @Service
public class MongoEntityService implements CommonEntityService{ public class MongoEntityService implements CommonEntityService{
@Override @Override
public List<EntityObj> selectBase(EntityModel entityModel, QueryFilter filter) { public List<EntityObj> selectBase(String dsName, EntityModel entityModel, QueryFilter filter) {
return null; return null;
} }
@Override @Override
public List<EntityObj> selectCore(EntityModel entityModel, QueryFilter filter) { public List<EntityObj> selectCore(String dsName, EntityModel entityModel, QueryFilter filter) {
return null; return null;
} }
@Override @Override
public Integer selectCount(EntityModel entityModel, QueryFilter filter) { public Integer selectCount(String dsName, EntityModel entityModel, QueryFilter filter) {
return null; return null;
} }
@Override @Override
public List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter) { public List<EntityObj> search(String dsName, String dataSet, EntityModel entityModel, QueryFilter filter) {
return null; return null;
} }
...@@ -40,21 +40,25 @@ public class MongoEntityService implements CommonEntityService{ ...@@ -40,21 +40,25 @@ public class MongoEntityService implements CommonEntityService{
} }
@Override @Override
public boolean saveBatch(EntityModel entityModel, List<EntityObj> list) { public void cursorRead(String dsName, EntityModel entityModel, String sql, QueryFilter filter, LiteDataCallback callback) {
}
@Override
public boolean saveBatch(String dsName, EntityModel entityModel, List<EntityObj> list) {
return false; return false;
} }
@Override @Override
public boolean save(EntityModel entityModel, EntityObj entityObj) { public boolean save(String dsName, EntityModel entityModel, EntityObj entityObj) {
return false; return false;
} }
@Override @Override
public EntityObj get(EntityModel entityModel, EntityObj entityObj) { public EntityObj get(String dsName, EntityModel entityModel, EntityObj entityObj) {
return null; return null;
} }
@Override @Override
public void processList(DataModel dataModel, Timestamp lastModify, LiteDataCallback callback) { public void processList(DataModel dataModel, Timestamp lastModify, LiteDataCallback callback) {
......
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.8.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="mac (generated)" id="1592972881575-1">
<preConditions onFail="MARK_RAN" >
<not>
<tableExists tableName="IBZDICTCATALOG" />
</not>
</preConditions>
<createTable tableName="IBZDICTCATALOG">
<column name="CID" type="VARCHAR(100)">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_DICT_CATALOG_CID"/>
</column>
<column name="CCODE" type="VARCHAR(100)"/>
<column name="CNAME" type="VARCHAR(100)"/>
<column name="CGROUP" type="VARCHAR(100)"/>
<column name="MEMO" type="VARCHAR(255)"/>
<column name="ENABLE" type="INT"/>
<column name="UPDATEDATE" type="TIMESTAMP"/>
<column name="CREATEDATE" type="TIMESTAMP"/>
</createTable>
<createTable tableName="IBZDICTOPTION">
<column name="VKEY" type="VARCHAR(100)">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_DICT_OPTION_VKEY"/>
</column>
<column name="CID" type="VARCHAR(100)"/>
<column name="CNAME" type="VARCHAR(100)"/>
<column name="VAL" type="VARCHAR(40)"/>
<column name="LABEL" type="VARCHAR(100)"/>
<column name="PVAL" type="VARCHAR(40)"/>
<column name="VFILTER" type="VARCHAR(500)"/>
<column name="CLS" type="VARCHAR(500)"/>
<column name="ICONCLS" type="VARCHAR(255)"/>
<column name="DISABLED" type="INT"/>
<column name="EXPIRED" type="INT"/>
<column name="SHOWORDER" type="INT"/>
<column name="EXTENSION" type="VARCHAR(1000)"/>
<column name="UPDATEDATE" type="TIMESTAMP"/>
<column name="CREATEDATE" type="TIMESTAMP"/>
</createTable>
<addForeignKeyConstraint baseColumnNames="CID" baseTableName="IBZDICTOPTION" constraintName="DER1N_DICT_OPTION_DICT_CATALOG" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="CID" referencedTableName="IBZDICTCATALOG" validate="true"/>
</changeSet>
</databaseChangeLog>
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-3.9.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
<changeSet author="mac (generated)" id="1615290744065-1">
<preConditions onFail="MARK_RAN" >
<not>
<tableExists tableName="IBZTABLESYNC" />
</not>
</preConditions>
<createTable tableName="IBZTABLESYNC">
<column name="SYNCID" type="VARCHAR(100)">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_ETL_TABLE_SYNC_SYNCID"/>
</column>
<column name="SYNCNAME" type="VARCHAR(100)"/>
<column name="SRCENTITYID" type="VARCHAR(100)"/>
<column name="SRCENTITYNAME" type="VARCHAR(100)"/>
<column name="SRCDSID" type="VARCHAR(100)"/>
<column name="SRCEXP" type="CLOB"/>
<column name="ENTITYID" type="VARCHAR(100)"/>
<column name="ENTITYNAME" type="VARCHAR(100)"/>
<column name="DSID" type="VARCHAR(100)"/>
<column name="SYSTEMID" type="VARCHAR(100)"/>
<column name="MAPPINGCFG" type="CLOB"/>
<column name="SYNCGROUP" type="VARCHAR(200)"/>
<column name="RUNORDER" type="INT"/>
<column name="RUNCRON" type="VARCHAR(100)"/>
<column name="ETLTIMESTAMP" type="TIMESTAMP"/>
<column name="LASTRUNTIME" type="TIMESTAMP"/>
<column name="LASTENDTIME" type="TIMESTAMP"/>
<column name="LASTRUNRESULT" type="VARCHAR(20)"/>
<column name="LASTREAD" type="BIGINT"/>
<column name="LASTWRITE" type="BIGINT"/>
<column name="ISENABLE" type="INT"/>
<column name="UPDATEDATE" type="TIMESTAMP"/>
</createTable>
</changeSet>
</databaseChangeLog>
...@@ -5,7 +5,6 @@ import cn.ibizlab.core.lite.domain.MetaField; ...@@ -5,7 +5,6 @@ import cn.ibizlab.core.lite.domain.MetaField;
import cn.ibizlab.core.lite.extensions.domain.*; import cn.ibizlab.core.lite.extensions.domain.*;
import cn.ibizlab.core.lite.extensions.model.DataModel; import cn.ibizlab.core.lite.extensions.model.DataModel;
import cn.ibizlab.core.lite.extensions.model.Property; import cn.ibizlab.core.lite.extensions.model.Property;
import cn.ibizlab.core.lite.extensions.service.DbEntityService;
import cn.ibizlab.core.lite.extensions.service.LiteDataService; import cn.ibizlab.core.lite.extensions.service.LiteDataService;
import cn.ibizlab.core.lite.extensions.service.LiteModelService; import cn.ibizlab.core.lite.extensions.service.LiteModelService;
import cn.ibizlab.util.client.IBZDictFeignClient; import cn.ibizlab.util.client.IBZDictFeignClient;
...@@ -186,24 +185,24 @@ public class DstCoreResource { ...@@ -186,24 +185,24 @@ public class DstCoreResource {
for (String key : params.keySet()) { for (String key : params.keySet()) {
entityObj.set(key.toUpperCase(),params.get(key)[0]); entityObj.set(key.toUpperCase(),params.get(key)[0]);
} }
return ResponseEntity.status(HttpStatus.OK).body(liteDataService.get(system,entity,entityObj)); return ResponseEntity.status(HttpStatus.OK).body(liteDataService.get(system,entity,entityObj.getStringValue("link"),entityObj));
} }
@RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/search{dataset}") @RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/search{dataset}")
public ResponseEntity<List<EntityObj>> searchEntity(@PathVariable("system") String system, @PathVariable("entity") String entity, @PathVariable(value = "dataset",required = false) String dataset,@RequestBody QueryFilter filter) { public ResponseEntity<List<EntityObj>> searchEntity(@PathVariable("system") String system, @PathVariable("entity") String entity, @PathVariable(value = "dataset",required = false) String dataset,@RequestParam(value = "link",required = false) String link,@RequestBody QueryFilter filter) {
if(StringUtils.isEmpty(dataset)) if(StringUtils.isEmpty(dataset))
dataset="BASE"; dataset="BASE";
return ResponseEntity.status(HttpStatus.OK).body(liteDataService.search(system,entity,filter)); return ResponseEntity.status(HttpStatus.OK).body(liteDataService.search(system,entity,link,filter));
} }
@RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/save") @RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/save")
public ResponseEntity<Boolean> saveEntity(@PathVariable("system") String system, @PathVariable("entity") String entity,@RequestBody EntityObj entityObj) { public ResponseEntity<Boolean> saveEntity(@PathVariable("system") String system, @PathVariable("entity") String entity,@RequestParam(value = "link",required = false) String link,@RequestBody EntityObj entityObj) {
return ResponseEntity.status(HttpStatus.OK).body(liteDataService.save(system,entity,entityObj)); return ResponseEntity.status(HttpStatus.OK).body(liteDataService.save(system,entity,link,entityObj));
} }
@RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/batch") @RequestMapping(method = RequestMethod.POST, value = "/dst/{system}/entitys/{entity}/batch")
public ResponseEntity<Boolean> saveEntity(@PathVariable("system") String system, @PathVariable("entity") String entity,@RequestBody List<EntityObj> list) { public ResponseEntity<Boolean> saveEntity(@PathVariable("system") String system, @PathVariable("entity") String entity,@RequestBody List<EntityObj> list, @RequestParam(value = "link",required = false) String link) {
return ResponseEntity.status(HttpStatus.OK).body(liteDataService.saveBatch(system,entity,list)); return ResponseEntity.status(HttpStatus.OK).body(liteDataService.saveBatch(system,entity,link,list));
} }
@RequestMapping(method = RequestMethod.GET, value = "/dst/sysapps") @RequestMapping(method = RequestMethod.GET, value = "/dst/sysapps")
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册