Commit d22d266a by s_guodong

count返回数据类型问题

parent 99e094af
......@@ -72,7 +72,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
private static final String SQLID_SELECTBYID = "selectByInr";
private static final String SQLID_SELECTBYPRIMARYKEY = "selectByPrimaryKey";
private static boolean isMultiDb= MybatisDbUtil.isMultilDb();
private static boolean isMultiDb = MybatisDbUtil.isMultilDb();
@Autowired
......@@ -107,7 +107,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbInsert(T module) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -117,7 +117,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbUpdate(T module) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -127,7 +127,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbDelete(T module) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -137,7 +137,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbDelete(T m, Argument... args) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(m);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -147,7 +147,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
}
public <T extends IModule> int dbDelete(T module, Serializable... id) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -167,7 +167,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> T dbRead(T module, Argument... args) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -182,7 +182,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> T dbReadByInr(T module, String inr) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleDB(module);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -214,7 +214,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbReadset(IModuleList<T>[] lists, CacheOption cacheOption, String whereSql, Object[] param) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleListsDB(lists);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -244,7 +244,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbReadset(IModuleList<T> list, Argument... args) {
if(isMultiDb){
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleListDB(list);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
......@@ -301,10 +301,10 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public <T extends IModule> int dbReadset(IModuleList<T> list, String whereSql, Object[] objects) {
if(isMultiDb){
String moduleDB = MdaUtils.getModuleListDB(list);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
if (isMultiDb) {
String moduleDB = MdaUtils.getModuleListDB(list);
DynamicDataSourceContextHolder.setDataSourceType(moduleDB);
}
list.clear();
MybatisArgumentAdapter adapter = new MybatisArgumentAdapter(SELECT, list.getDataClass(), whereSql, objects);
List<T> result = this.dyncRead(list.getDataClass(), adapter);
......@@ -327,7 +327,7 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
@Override
public void dbExecuteSQL(String sql, Object... objects) {
if(isMultiDb){
if (isMultiDb) {
String tableName = MdaUtils.getTableNameFromSQL(sql);
String tableDB = MdaUtils.getTableDB(tableName);
DynamicDataSourceContextHolder.setDataSourceType(tableDB);
......@@ -343,6 +343,12 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
setNoMoreRow();
return;
}
for (int i = 0; i < result.size(); i++) {
Map<String, Object> map1 = result.get(i);
if (map1.get("COUNT") != null) {
map1.put("COUNT", Integer.valueOf(map1.get("COUNT") + ""));
}
}
resultLocal.set(new ResultSet(result));
} else {
int cnt = dbExecuteMapper.dyncUpdateForMap(map);
......@@ -420,8 +426,8 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
setNoMoreRow();
}
return entity;
}catch (InvocationTargetException e) {
throw new RuntimeException(e.getMessage());
} catch (InvocationTargetException e) {
throw new RuntimeException(e.getMessage());
} catch (InstantiationException e) {
throw new RuntimeException(e.getMessage());
} catch (IllegalAccessException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment