提交 c5692772 编写于 作者: hebao@lab.ibiz5.com's avatar hebao@lab.ibiz5.com

引擎构建处理逻辑相关调整

上级 bc028771
......@@ -11,5 +11,6 @@ public class EngineMQMsg {
private String engineId;
private String batch;
private Timestamp runTime;
private Integer count;
private List<EntityObj> datas;
}
......@@ -11,6 +11,7 @@ import java.util.List;
public interface DbEntityMapper extends BaseMapper<EntityObj>{
List<EntityObj> search(@Param("sql") String sql, @Param("ew") Wrapper<EntityObj> wrapper);
Integer searchCount(@Param("sql") String sql, @Param("ew") Wrapper<EntityObj> wrapper);
int replaceBatch(List<ExecResult> var1);
int clearBatch(List<ExecResult> var1);
......
......@@ -213,6 +213,10 @@ public class EntityModel {
return "select "+columnSet+" from "+this.getTableName()+" ";
}
else if("COUNT".equalsIgnoreCase(dataSet))
{
return "select count(1) from "+this.getTableName()+" ";
}
else
{
if(dataSets!=null)
......
......@@ -14,6 +14,7 @@ public interface CommonEntityService {
List<EntityObj> selectBase(EntityModel entityModel, QueryFilter filter);
List<EntityObj> selectCore(EntityModel entityModel, QueryFilter filter);
Integer selectCount(EntityModel entityModel, QueryFilter filter);
List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter);
......
......@@ -51,6 +51,35 @@ public class DbEntityService extends ServiceImpl<DbEntityMapper, EntityObj> impl
return search("CORE",entityModel,filter);
}
@Override
public Integer selectCount(EntityModel entityModel, QueryFilter filter) {
String sql=entityModel.getSqlSegment("COUNT");
String dsName = entityModel.getDsName();
try
{
dstDataSourceService.initDataSource(dsName);
DynamicDataSourceContextHolder.push(dsName);
DbEntitySearchContext context=new DbEntitySearchContext();
context.setFilter(filter);
QueryWrapper qw=context.getSelectCond();
if(!StringUtils.isEmpty(filter.getCustSqlSegment()))
qw.apply(filter.getCustSqlSegment());
Integer count=baseMapper.searchCount(sql,qw);
return count;
}
catch(Exception ex)
{
log.error("详细错误信息:" + ex.getMessage() + ", 执行sql:" + sql);
return null;
}
finally
{
DynamicDataSourceContextHolder.poll();
}
}
@Override
public List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter) {
......
......@@ -24,6 +24,12 @@ public class MongoEntityService implements CommonEntityService{
return null;
}
@Override
public Integer selectCount(EntityModel entityModel, QueryFilter filter) {
return null;
}
@Override
public List<EntityObj> search(String dataSet, EntityModel entityModel, QueryFilter filter) {
return null;
......
......@@ -55,7 +55,7 @@ public class MQConsumerConfigure {
* 设置consumer第一次启动是从队列头部开始还是队列尾部开始
* 如果不是第一次启动,那么按照上次消费的位置继续消费
*/
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);
/**
* 设置消费模型,集群还是广播,默认为集群
*/
......
......@@ -9,6 +9,11 @@
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<select id="searchCount" parameterType="cn.ibizlab.core.lite.extensions.filter.DbEntitySearchContext" resultType="Integer">
${sql}
<where><if test="ew!=null and ew.sqlSegment!=null and !ew.emptyOfWhere">${ew.sqlSegment}</if></where>
<if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">${ew.sqlSegment}</if>
</select>
<insert id="replaceBatch" parameterType="java.util.List" databaseId="mysql">
<foreach collection="list" item="item" index="index" separator=";">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册