lvzhikai il y a 4 ans
Parent
commit
7727d16810

+ 2 - 0
src/main/java/com/chinaitop/depot/business/mapper/BusinessDeliveryStorageNoticeMapper.java

@@ -128,4 +128,6 @@ public interface BusinessDeliveryStorageNoticeMapper {
128 128
 	Integer getcw(Integer orgId);
129 129
 
130 130
 	Integer selectCustomer(Map<String, Object> mapCustomer);
131
+
132
+    List<BusinessDeliveryStorageNotice> selectByExampleDetails(Map<String,Object> map);
131 133
 }

+ 18 - 5
src/main/java/com/chinaitop/depot/business/mapper/BusinessDeliveryStorageNoticeMapper.xml

@@ -148,11 +148,6 @@
148 148
     change_reason, change_time, change_content, jhbzwh
149 149
   </sql>
150 150
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.business.model.BusinessDeliveryStorageNoticeExample" >
151
-    <!--
152
-      WARNING - @mbggenerated
153
-      This element is automatically generated by MyBatis Generator, do not modify.
154
-      This element was generated on Wed Jan 20 15:07:25 CST 2021.
155
-    -->
156 151
     select
157 152
     <if test="distinct" >
158 153
       distinct
@@ -1252,4 +1247,22 @@
1252 1247
   	select id from business_customer where name = #{deliveryCustomer} and 
1253 1248
   	identification = #{identification} and org_id = #{orgId}
1254 1249
   </select>
1250
+
1251
+  <select id="selectByExampleDetails" resultMap="BaseResultMap" parameterType="java.util.Map" >
1252
+    SELECT
1253
+      notice.id,
1254
+      group_concat(case de.house_id when 0 then de.warehouse_name else de.house_name end) house_name,
1255
+      group_concat(case de.in_price when ISNULL(de.in_price) then de.out_price else de.in_price end) quantity,
1256
+      group_concat(case de.in_count when ISNULL(de.in_count) then de.out_count else de.in_count end) price
1257
+    FROM
1258
+      business_delivery_storage_notice notice
1259
+        LEFT JOIN business_store_ware_detail de ON de.zid = notice.id
1260
+    WHERE
1261
+      notice.org_id = #{orgId}
1262
+      and notice.id in
1263
+    <foreach collection="ids" item="id" open="(" close=")" separator="," >
1264
+      #{id}
1265
+    </foreach>
1266
+    group by notice.id
1267
+  </select>
1255 1268
 </mapper>

+ 19 - 0
src/main/java/com/chinaitop/depot/business/model/BusinessDeliveryStorageNotice.java

@@ -1776,4 +1776,23 @@ public class BusinessDeliveryStorageNotice {
1776 1776
     public void setJhbzwh(String jhbzwh) {
1777 1777
         this.jhbzwh = jhbzwh == null ? null : jhbzwh.trim();
1778 1778
     }
1779
+
1780
+    public String quantity;//数量
1781
+    public String price;//单价
1782
+
1783
+    public String getQuantity() {
1784
+        return quantity;
1785
+    }
1786
+
1787
+    public void setQuantity(String quantity) {
1788
+        this.quantity = quantity;
1789
+    }
1790
+
1791
+    public String getPrice() {
1792
+        return price;
1793
+    }
1794
+
1795
+    public void setPrice(String price) {
1796
+        this.price = price;
1797
+    }
1779 1798
 }

+ 22 - 0
src/main/java/com/chinaitop/depot/business/service/impl/BusinessDeliveryStorageNoticeServiceImpl.java

@@ -10,6 +10,7 @@ import java.util.Map;
10 10
 
11 11
 import javax.annotation.Resource;
12 12
 
13
+import com.chinaitop.depot.utils.ParameterUtil;
13 14
 import org.apache.commons.lang.StringUtils;
14 15
 import org.springframework.stereotype.Service;
15 16
 import org.springframework.transaction.annotation.Transactional;
@@ -1122,6 +1123,27 @@ public class BusinessDeliveryStorageNoticeServiceImpl implements BusinessDeliver
1122 1123
             PageHelper.startPage(pageNum, pageSize);
1123 1124
         }
1124 1125
         List<BusinessDeliveryStorageNotice> list = businessDeliveryStorageNoticeMapper.selectByExample(example);
1126
+        if (list.size() > 0) {
1127
+            Map<String, Object> returnMap = new HashMap<String, Object>();
1128
+            returnMap.put("orgId",notice.getOrgId());
1129
+            List<Integer> ids = new ArrayList<>();
1130
+            for (BusinessDeliveryStorageNotice notices : list) {
1131
+                ids.add(notices.getId());
1132
+            }
1133
+            returnMap.put("orgId",notice.getOrgId());
1134
+            returnMap.put("ids",ids);
1135
+
1136
+            List<BusinessDeliveryStorageNotice> details = businessDeliveryStorageNoticeMapper.selectByExampleDetails(returnMap);
1137
+            for (BusinessDeliveryStorageNotice detail : details) {
1138
+                for (BusinessDeliveryStorageNotice notices : list) {
1139
+                    if (ParameterUtil.isequal(detail.getId(),notices.getId())) {
1140
+                        notices.setHouseName(detail.getHouseName());
1141
+                        notices.setQuantity(detail.getQuantity());
1142
+                        notices.setPrice(detail.getPrice());
1143
+                    }
1144
+                }
1145
+            }
1146
+        }
1125 1147
         return list;
1126 1148
     }
1127 1149