支持ams分阵地数据库查询(初版)

develop
yuemian 2024-08-29 10:22:05 +08:00
parent 6ec0a3741e
commit c6ec5bf3f3
2 changed files with 8 additions and 3 deletions

View File

@ -76,7 +76,12 @@ public class ModuleGroupRepository extends BasicGenericDao<ModuleGroup, Long> {
} }
public List<ModuleGroup> all(String positionKey) throws Exception { public List<ModuleGroup> all(String positionKey) throws Exception {
String sql = "select * from " + positionKey + ".ci_module_group where is_deleted=0 "; String sql;
if (StringUtils.isNotEmpty(positionKey)) {
sql = "select * from " + positionKey + ".ci_module_group where is_deleted=0 ";
} else {
sql = "select * from ci_module_group where is_deleted=0 ";
}
return this.list(ModuleGroup.class, sql, null); return this.list(ModuleGroup.class, sql, null);
} }

View File

@ -37,9 +37,9 @@ public class ModuleRepository extends BasicGenericDao<CiModule, Long> {
public List<CiModule> list(Pager pager, String positionKey) throws Exception { public List<CiModule> list(Pager pager, String positionKey) throws Exception {
String sql; String sql;
if (StringUtils.isNotBlank(positionKey)) { if (StringUtils.isNotBlank(positionKey)) {
sql = "select a.* from ci_module a where a.position_key=:positionKey "; sql = "select a.* from "+positionKey+".ci_module a where a.is_deleted=0 ";
} else { } else {
sql = "select a.* from ci_module a where a.position_key=:positionKey "; sql = "select a.* from ci_module a where a.is_deleted=0 ";
} }
sql = getQueryBuilder().buildRaw(sql, pager, "a"); sql = getQueryBuilder().buildRaw(sql, pager, "a");
return this.list(CiModule.class, sql, getQueryBuilder().getParam(pager.getParams())); return this.list(CiModule.class, sql, getQueryBuilder().getParam(pager.getParams()));