ソースを参照

simple imgUrl

梁彦春 6 年 前
コミット
254673a0a1
共有2 個のファイルを変更した6 個の追加0 個の削除を含む
  1. 2
    0
      src/main/java/com.huiju.welcome/controller/TaGoodsController.java
  2. 4
    0
      src/main/resources/mapper/TaGoodsSpecMapper.xml

+ 2
- 0
src/main/java/com.huiju.welcome/controller/TaGoodsController.java ファイルの表示

18
 import org.springframework.beans.factory.annotation.Autowired;
18
 import org.springframework.beans.factory.annotation.Autowired;
19
 import org.springframework.web.bind.annotation.*;
19
 import org.springframework.web.bind.annotation.*;
20
 
20
 
21
+import java.math.BigDecimal;
21
 import java.time.LocalDateTime;
22
 import java.time.LocalDateTime;
22
 import java.util.List;
23
 import java.util.List;
23
 
24
 
57
             List<TaGoodsSpec> specList = taGoods.getSpecList();
58
             List<TaGoodsSpec> specList = taGoods.getSpecList();
58
             specList.stream().forEach(e -> {
59
             specList.stream().forEach(e -> {
59
                 e.setGoodsId(taGoods.getGoodsId());
60
                 e.setGoodsId(taGoods.getGoodsId());
61
+                e.setGoodsPrice(BigDecimal.valueOf(0));
60
             });
62
             });
61
 
63
 
62
             boolean result = iTaGoodsSpecService.saveBatch(specList);
64
             boolean result = iTaGoodsSpecService.saveBatch(specList);

+ 4
- 0
src/main/resources/mapper/TaGoodsSpecMapper.xml ファイルの表示

23
         where a.goods_id = #{goodsId}
23
         where a.goods_id = #{goodsId}
24
     </select>
24
     </select>
25
 
25
 
26
+    <delete id="deleteSpecsByGoodsId">
27
+        delete from ta_goods_spec where goods_id = #{goodsId}
28
+    </delete>
29
+
26
 </mapper>
30
 </mapper>