|
|
|
@ -35,12 +35,8 @@ public class DataAccessFunction implements Function {
|
|
|
|
|
private static final Map defaultTargets = new HashMap();
|
|
|
|
|
static{
|
|
|
|
|
//数据库默认的跟组织和用户相关字段
|
|
|
|
|
defaultTargets.put("org", "SELECT count(0)>0 FROM core_org WHERE id");
|
|
|
|
|
defaultTargets.put("user", "SELECT count(0)>0 FROM core_user WHERE id");
|
|
|
|
|
defaultTargets.put("g_org", "t.online_shop_id");
|
|
|
|
|
defaultTargets.put("g_user", "t.user_id");
|
|
|
|
|
defaultTargets.put("u_org", "o.id");
|
|
|
|
|
defaultTargets.put("u_user", "u.id");
|
|
|
|
|
defaultTargets.put("org", "t.org_id");
|
|
|
|
|
defaultTargets.put("user", "t.user_id");
|
|
|
|
|
}
|
|
|
|
|
private static final String SQL_MY_DATA = "user_id=? ";
|
|
|
|
|
private static final String SQL_MY_ORG_DATA = "org_id=? ";
|
|
|
|
@ -97,13 +93,7 @@ public class DataAccessFunction implements Function {
|
|
|
|
|
|
|
|
|
|
switch(ret.getStatus()){
|
|
|
|
|
case NoneOrg:{
|
|
|
|
|
if( functionCode.contains("user.") ){
|
|
|
|
|
sb.append(targets.get("u_org")+" in (-1) ");
|
|
|
|
|
}else if( functionCode.contains("goods.") ){
|
|
|
|
|
sb.append(targets.get("g_org")+" in (-1) ");
|
|
|
|
|
}else {
|
|
|
|
|
sb.append(targets.get("org")+" in (-1) ");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case AllOrg:{
|
|
|
|
@ -113,13 +103,7 @@ public class DataAccessFunction implements Function {
|
|
|
|
|
}
|
|
|
|
|
case OnlyUser:{
|
|
|
|
|
List<Long> ids = ret.getUserIds();
|
|
|
|
|
if( functionCode.contains("user.") ){
|
|
|
|
|
sb.append(targets.get("u_user"));
|
|
|
|
|
}else if( functionCode.contains("goods.") ){
|
|
|
|
|
sb.append(targets.get("g_user"));
|
|
|
|
|
}else {
|
|
|
|
|
sb.append(targets.get("user"));
|
|
|
|
|
}
|
|
|
|
|
if(ids.size()==0){
|
|
|
|
|
sb.append("=-1/*指定用户,但没有候选用户*/");
|
|
|
|
|
continue;
|
|
|
|
@ -144,13 +128,7 @@ public class DataAccessFunction implements Function {
|
|
|
|
|
}
|
|
|
|
|
case OnlyOrg:{
|
|
|
|
|
List<Long> ids = ret.getOrgIds();
|
|
|
|
|
if( functionCode.contains("user.") ){
|
|
|
|
|
sb.append(targets.get("u_org"));
|
|
|
|
|
}else if( functionCode.contains("goods.") ){
|
|
|
|
|
sb.append(targets.get("g_org"));
|
|
|
|
|
}else {
|
|
|
|
|
sb.append(targets.get("org"));
|
|
|
|
|
}
|
|
|
|
|
if(ids.size()==0){
|
|
|
|
|
sb.append("=-1/*指定机构,但没有候选机构*/");
|
|
|
|
|
continue;
|
|
|
|
|