Przeglądaj źródła

区域经理查询商城显示一级价

hu 1 rok temu
rodzic
commit
4f8611875c

+ 4 - 0
src/custom/restcontroller/sale/itemgroup/SQL/查询商品原价.sql

@@ -0,0 +1,4 @@
+SELECT t1.sa_itemgroupid,t1.itemid,t7.price
+FROM sa_itemgroupmx t1
+         left join sa_itemprice t7 on t1.itemid = t7.itemid and t7.pricegrade = 1
+where t1.siteid=$siteid$ and t1.sa_itemgroupid=$sa_itemgroupid$

+ 15 - 1
src/custom/restcontroller/sale/itemgroup/itemgroup.java

@@ -366,6 +366,12 @@ public class itemgroup extends Controller {
         RowsMap itemclassRowsMap = rowsitemclass.toRowsMap("itemid");
 
         RowsMap itemextendRowsMap = dbConnect.runSqlQuery("select itemid,material,device,prodline,specalnote,pressure,connection,valveplatematerial,actuatortype,actuatorbrand,butterflyplatedrive from plm_itemextend where siteid='" + siteid + "'").toRowsMap("itemid");
+
+        SQLFactory priceSqlFactory = new SQLFactory(this, "查询商品原价");
+        priceSqlFactory.addParameter("sa_itemgroupid", sa_itemgroupid);
+        priceSqlFactory.addParameter("siteid", siteid);
+        Rows pricerows = dbConnect.runSqlQuery(priceSqlFactory);
+        RowsMap pricerowsMap = pricerows.toRowsMap("itemid");
         for (Row row : rows) {
 
             ItemPrice itemPrice = ItemPrice.getItemPrice(this, sys_enterpriseid, row.getLong("itemid"));
@@ -373,7 +379,15 @@ public class itemgroup extends Controller {
             if (sys_enterpriseid > 0 || (usertype == 21 || usertype == 22)) {
                 row.put("gradeprice", itemPrice.getContractprice());
             } else {
-                row.put("gradeprice", itemPrice.getMarketprice());
+                if(pricerowsMap.containsKey(row.getString("itemid"))){
+                    if(pricerowsMap.get(row.getString("itemid")).isNotEmpty()){
+                        row.put("gradeprice", pricerowsMap.get(row.getString("itemid")).get(0).getBigDecimal("price"));
+                    }else{
+                        row.put("gradeprice",0);
+                    }
+                }else {
+                    row.put("gradeprice", 0);
+                }
             }
 
             Rows jsonArray = new Rows();