修复后台规格修改的问题及其分类删除的问题
This commit is contained in:
1 parent
d1f895e554
commit
2c37450637
4 files changed
+25
-8
No files matched your search
@@ -60,4 +60,6 @@ public interface StoreSpecGoodsPriceMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteStoreSpecGoodsPriceByIds(String[] itemIds);
|
public int deleteStoreSpecGoodsPriceByIds(String[] itemIds);
|
||||||
|
|
||||||
|
public int delStoreSpecGoodsPriceByGoodsId(int goodsId);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.ruoyi.shop.service.impl;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import com.ruoyi.common.core.domain.Ztree;
|
import com.ruoyi.common.core.domain.Ztree;
|
||||||
|
import com.ruoyi.common.exception.BusinessException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.shop.mapper.StoreGoodsCateMapper;
|
import com.ruoyi.shop.mapper.StoreGoodsCateMapper;
|
||||||
@@ -90,6 +91,11 @@ public class StoreGoodsCateServiceImpl implements IStoreGoodsCateService
|
|||||||
*/
|
*/
|
||||||
public int deleteStoreGoodsCateById(Long id)
|
public int deleteStoreGoodsCateById(Long id)
|
||||||
{
|
{
|
||||||
|
StoreGoodsCate goodsCate = new StoreGoodsCate();
|
||||||
|
goodsCate.setPid(id);
|
||||||
|
List<StoreGoodsCate> goodsCates = storeGoodsCateMapper
|
||||||
|
.selectStoreGoodsCateList(goodsCate);
|
||||||
|
if(!goodsCates.isEmpty()) throw new BusinessException("请先删除子分类");
|
||||||
return storeGoodsCateMapper.deleteStoreGoodsCateById(id);
|
return storeGoodsCateMapper.deleteStoreGoodsCateById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,25 +50,30 @@ public class StoreGoodsServiceImpl implements IStoreGoodsService
|
|||||||
StoreSpecGoodsPrice goodsPriceDomain = new StoreSpecGoodsPrice();
|
StoreSpecGoodsPrice goodsPriceDomain = new StoreSpecGoodsPrice();
|
||||||
storeSpecGoodsPrice.setGoodsId(Long.valueOf(goodsId));
|
storeSpecGoodsPrice.setGoodsId(Long.valueOf(goodsId));
|
||||||
goodsPriceDomain.setGoodsId(Long.valueOf(goodsId));
|
goodsPriceDomain.setGoodsId(Long.valueOf(goodsId));
|
||||||
|
storeSpecGoodsPriceMapper.delStoreSpecGoodsPriceByGoodsId(Integer.valueOf(goodsId));
|
||||||
|
|
||||||
for(Map.Entry<String, Map<String,String>> entry : specDataMap.entrySet()){
|
for(Map.Entry<String, Map<String,String>> entry : specDataMap.entrySet()){
|
||||||
String mapKey = entry.getKey();
|
String mapKey = entry.getKey();
|
||||||
Map map = entry.getValue();
|
Map map = entry.getValue();
|
||||||
System.out.println(mapKey+":"+map);
|
//System.out.println(mapKey+":"+map);
|
||||||
storeSpecGoodsPrice.setKey(mapKey);
|
storeSpecGoodsPrice.setKey(mapKey);
|
||||||
List<StoreSpecGoodsPrice> storeSpecGoodsPrices = storeSpecGoodsPriceService
|
// List<StoreSpecGoodsPrice> storeSpecGoodsPrices = storeSpecGoodsPriceService
|
||||||
.selectStoreSpecGoodsPriceList(storeSpecGoodsPrice);
|
// .selectStoreSpecGoodsPriceList(storeSpecGoodsPrice);
|
||||||
|
|
||||||
goodsPriceDomain.setKey(mapKey);
|
goodsPriceDomain.setKey(mapKey);
|
||||||
goodsPriceDomain.setPrice(Double.valueOf(map.get("price").toString()));
|
goodsPriceDomain.setPrice(Double.valueOf(map.get("price").toString()));
|
||||||
goodsPriceDomain.setMarketPrice(Double.valueOf(map.get("market_price").toString()));
|
goodsPriceDomain.setMarketPrice(Double.valueOf(map.get("market_price").toString()));
|
||||||
goodsPriceDomain.setStoreCount(Long.valueOf(map.get("store_count").toString()));
|
goodsPriceDomain.setStoreCount(Long.valueOf(map.get("store_count").toString()));
|
||||||
if(storeSpecGoodsPrices.isEmpty()){
|
|
||||||
goodsPriceDomain.setKeyName(map.get("key_name").toString());
|
goodsPriceDomain.setKeyName(map.get("key_name").toString());
|
||||||
storeSpecGoodsPriceService.insertStoreSpecGoodsPrice(goodsPriceDomain);
|
storeSpecGoodsPriceService.insertStoreSpecGoodsPrice(goodsPriceDomain);
|
||||||
}else{
|
|
||||||
goodsPriceDomain.setItemId(storeSpecGoodsPrices.get(0).getItemId());
|
// if(storeSpecGoodsPrices.isEmpty()){
|
||||||
storeSpecGoodsPriceService.updateStoreSpecGoodsPrice(goodsPriceDomain);
|
// goodsPriceDomain.setKeyName(map.get("key_name").toString());
|
||||||
}
|
// storeSpecGoodsPriceService.insertStoreSpecGoodsPrice(goodsPriceDomain);
|
||||||
|
// }else{
|
||||||
|
// goodsPriceDomain.setItemId(storeSpecGoodsPrices.get(0).getItemId());
|
||||||
|
// storeSpecGoodsPriceService.updateStoreSpecGoodsPrice(goodsPriceDomain);
|
||||||
|
// }
|
||||||
//System.out.println(mapKey+":"+map);
|
//System.out.println(mapKey+":"+map);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
delete from store_spec_goods_price where item_id = #{itemId}
|
delete from store_spec_goods_price where item_id = #{itemId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<delete id="delStoreSpecGoodsPriceByGoodsId" parameterType="int">
|
||||||
|
delete from store_spec_goods_price where goods_id = #{goodsId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
<delete id="deleteStoreSpecGoodsPriceByIds" parameterType="String">
|
<delete id="deleteStoreSpecGoodsPriceByIds" parameterType="String">
|
||||||
delete from store_spec_goods_price where item_id in
|
delete from store_spec_goods_price where item_id in
|
||||||
<foreach item="itemId" collection="array" open="(" separator="," close=")">
|
<foreach item="itemId" collection="array" open="(" separator="," close=")">
|
||||||
|
|||||||
Reference in new issue
Block a user