|
@@ -3,6 +3,7 @@ package restcontroller.webmanage.saletool.fad;
|
|
|
import beans.attachment.Attachment;
|
|
|
import beans.datacontrllog.DataContrlLog;
|
|
|
import beans.datatag.DataTag;
|
|
|
+import beans.salearea.SaleArea;
|
|
|
import beans.time.Time;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
@@ -14,7 +15,9 @@ import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
import restcontroller.system.dataauth.DataAuthHelper;
|
|
|
|
|
|
+import java.awt.geom.Area;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedHashSet;
|
|
|
|
|
|
/**
|
|
|
* 商品管理
|
|
@@ -115,7 +118,6 @@ public class FadGoods extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
sa_fadids.add(sa_fadid);
|
|
|
for (Long id : sa_fadids) {
|
|
|
listSQL.add(FadHelper.getIsOnSalesUpdateSQL(this, id).getSQL());
|
|
@@ -400,18 +402,21 @@ public class FadGoods extends Controller {
|
|
|
sys_enterpriseids.add(sys_enterpriseid);
|
|
|
sys_enterpriseids.add(0L);
|
|
|
|
|
|
+ LinkedHashSet<Long> saleareaidsPath = userInfo.getSaleareaidsPath(this, sys_enterpriseid);
|
|
|
+ String wheresql = "t1.sa_fadid in (SELECT ownerid from sys_dataauths WHERE ownertable='sa_fad' and (sys_enterpriseid =" + sys_enterpriseid + " or sa_saleareaid in " + saleareaidsPath + "))";
|
|
|
+
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, sa_fad,
|
|
|
"sa_fadid", "name", "pricetype", "price", "price_deposit", "unitname")
|
|
|
.setTableAlias("t1");
|
|
|
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_datatag", "t2", "t2.ownertable='sa_fad' and t2.ownerid=t1.sa_fadid and t2.siteid=t1.siteid");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("not EXISTS(SELECT 1 from sa_fad WHERE sys_enterpriseid=" + sys_enterpriseid + " and parentid=t1.sa_fadid and siteid=t1.siteid)");
|
|
|
+ querySQL.setWhere("t1.sa_fadid not in (SELECT parentid from sa_fad WHERE sys_enterpriseid=" + sys_enterpriseid + ")");
|
|
|
+ querySQL.setWhere(wheresql.replace("[", "(").replace("]", ")"));
|
|
|
querySQL.setWhere("sys_enterpriseid", sys_enterpriseids);
|
|
|
querySQL.setWhere("classid", 2);
|
|
|
querySQL.setWhere("isonsale", 1);
|
|
|
querySQL.setWhere(where.toString());
|
|
|
- querySQL.setDataAuth(true);
|
|
|
querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
Rows rows = querySQL.query();
|
|
|
|
|
@@ -465,19 +470,22 @@ public class FadGoods extends Controller {
|
|
|
sys_enterpriseids.add(sys_enterpriseid);
|
|
|
sys_enterpriseids.add(0L);
|
|
|
|
|
|
+ LinkedHashSet<Long> saleareaidsPath = userInfo.getSaleareaidsPath(this, sys_enterpriseid);
|
|
|
+ String wheresql = "t1.sa_fadid in (SELECT ownerid from sys_dataauths WHERE ownertable='sa_fad' and (sys_enterpriseid =" + sys_enterpriseid + " or sa_saleareaid in " + saleareaidsPath + "))";
|
|
|
+
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, sa_fad,
|
|
|
"sa_fadid", "name", "pricetype", "price", "price_deposit", "unitname")
|
|
|
.setTableAlias("t1");
|
|
|
|
|
|
querySQL.addJoinTable(JOINTYPE.left, "sys_datatag", "t2", "t2.ownertable='sa_fad' and t2.ownerid=t1.sa_fadid and t2.siteid=t1.siteid");
|
|
|
querySQL.setSiteid(siteid);
|
|
|
- querySQL.setWhere("not EXISTS(SELECT 1 from sa_fad WHERE sys_enterpriseid=" + sys_enterpriseid + " and parentid=t1.sa_fadid and siteid=t1.siteid)");
|
|
|
+ querySQL.setWhere("t1.sa_fadid not in (SELECT parentid from sa_fad WHERE sys_enterpriseid=" + sys_enterpriseid + ")");
|
|
|
+ querySQL.setWhere(wheresql.replace("[", "(").replace("]", ")"));
|
|
|
querySQL.setWhere("sys_enterpriseid", sys_enterpriseids);
|
|
|
querySQL.setWhere("classid", 2);
|
|
|
querySQL.setWhere("isonsale", 1);
|
|
|
querySQL.setWhere("canadjust", 1);
|
|
|
querySQL.setWhere(where.toString());
|
|
|
- querySQL.setDataAuth(true);
|
|
|
querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
Rows rows = querySQL.query();
|
|
|
|