diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketMaterial.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketMaterial.java
index 09000c8..e9fd213 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketMaterial.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/domain/SupermarketMaterial.java
@@ -47,6 +47,11 @@ public class SupermarketMaterial extends BaseEntity {
@ApiModelProperty(value = "类别id")
private Long materialTypeId;
+ /** 类别ids */
+ @Excel(name = "类别ids")
+ @ApiModelProperty(value = "类别ids")
+ private Long[] materialTypeIds;
+
/** 条码 */
@Excel(name = "条码")
@ApiModelProperty(value = "条码")
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketMaterialTypeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketMaterialTypeMapper.java
index 71c00b9..9975486 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketMaterialTypeMapper.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/mapper/SupermarketMaterialTypeMapper.java
@@ -59,4 +59,6 @@ public interface SupermarketMaterialTypeMapper {
* @return 结果
*/
public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
+
+ public int getSupermarketMaterialTypeChildCountByMaterialTypes(Long[] materialTypeIds);
}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialTypeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialTypeServiceImpl.java
index 94da4fc..2d8f338 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialTypeServiceImpl.java
+++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/supermarket/service/impl/SupermarketMaterialTypeServiceImpl.java
@@ -100,10 +100,14 @@ public class SupermarketMaterialTypeServiceImpl implements ISupermarketMaterialT
*/
@Override
public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds) {
- int count = supermarketMaterialMapper.getSupermarketMaterialCountByMaterialTypes(materialTypeIds);
- if (count > 0) {
+ int count1 = supermarketMaterialMapper.getSupermarketMaterialCountByMaterialTypes(materialTypeIds);
+ if (count1 > 0) {
throw new ServiceException("该超市商品类型含有商品信息,不能删除");
}
+ int count2 = supermarketMaterialTypeMapper.getSupermarketMaterialTypeChildCountByMaterialTypes(materialTypeIds);
+ if (count2 > 0) {
+ throw new ServiceException("该超市商品类型含有子类型,不能删除");
+ }
return supermarketMaterialTypeMapper.deleteSupermarketMaterialTypeByMaterialTypeIds(materialTypeIds);
}
diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketMaterialMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketMaterialMapper.xml
index d78facb..c81f43b 100644
--- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketMaterialMapper.xml
+++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/supermarket/SupermarketMaterialMapper.xml
@@ -28,7 +28,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- select material_id, area_id, material_name, material_code, img_url, material_type_id, bar_code, unit_id, sale_price, unit_price, sales_mode, shelf_life_type, shelf_life_days, pur_price_ceiling, big_category_id, size, description, create_by, create_time, update_by, update_time from supermarket_material
+ select material_id, area_id, material_name, material_code, img_url, material_type_id,
+ bar_code, unit_id, sale_price, unit_price, sales_mode, shelf_life_type,
+ shelf_life_days, pur_price_ceiling, big_category_id, `size`, description,
+ create_by, create_time, update_by, update_time
+ from supermarket_material