注释超市商品接口

This commit is contained in:
sxu 2025-07-02 11:22:08 +08:00
parent e58f0e0256
commit 0c0c30683d
13 changed files with 889 additions and 1175 deletions

View File

@ -1,119 +1,119 @@
package com.bonus.canteen.core.supermarket.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.supermarket.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 商品信息Controller
*
* @author xsheng
* @date 2025-05-25
*/
@Api(tags = "商品信息接口")
@RestController
@RequestMapping("/supermarket_material")
public class SupermarketMaterialController extends BaseController {
@Autowired
private ISupermarketMaterialService supermarketMaterialService;
/**
* 查询商品信息列表
*/
@ApiOperation(value = "查询商品信息列表")
//@RequiresPermissions("supermarket:material:list")
@GetMapping("/list")
public TableDataInfo list(SupermarketMaterial supermarketMaterial) {
startPage();
List<SupermarketMaterial> list = supermarketMaterialService.selectSupermarketMaterialList(supermarketMaterial);
return getDataTable(list);
}
/**
* 导出商品信息列表
*/
@ApiOperation(value = "导出商品信息列表")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:material:export")
@SysLog(title = "商品信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出商品信息")
@PostMapping("/export")
public void export(HttpServletResponse response, SupermarketMaterial supermarketMaterial) {
List<SupermarketMaterial> list = supermarketMaterialService.selectSupermarketMaterialList(supermarketMaterial);
ExcelUtil<SupermarketMaterial> util = new ExcelUtil<SupermarketMaterial>(SupermarketMaterial.class);
util.exportExcel(response, list, "商品信息数据");
}
/**
* 获取商品信息详细信息
*/
@ApiOperation(value = "获取商品信息详细信息")
//@RequiresPermissions("supermarket:material:query")
@GetMapping(value = "/{materialId}")
public AjaxResult getInfo(@PathVariable("materialId") Long materialId) {
return success(supermarketMaterialService.selectSupermarketMaterialByMaterialId(materialId));
}
/**
* 新增商品信息
*/
@ApiOperation(value = "新增商品信息")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:material:add")
@SysLog(title = "商品信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增商品信息")
@PostMapping
public AjaxResult add(@RequestBody SupermarketMaterial supermarketMaterial) {
try {
return toAjax(supermarketMaterialService.insertSupermarketMaterial(supermarketMaterial));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 修改商品信息
*/
@ApiOperation(value = "修改商品信息")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:material:edit")
@SysLog(title = "商品信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改商品信息")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody SupermarketMaterial supermarketMaterial) {
try {
return toAjax(supermarketMaterialService.updateSupermarketMaterial(supermarketMaterial));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 删除商品信息
*/
@ApiOperation(value = "删除商品信息")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:material:remove")
@SysLog(title = "商品信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除商品信息")
@PostMapping("/del/{materialIds}")
public AjaxResult remove(@PathVariable Long[] materialIds) {
return toAjax(supermarketMaterialService.deleteSupermarketMaterialByMaterialIds(materialIds));
}
}
//package com.bonus.canteen.core.supermarket.controller;
//
//import java.util.List;
//import javax.servlet.http.HttpServletResponse;
//import com.bonus.common.log.enums.OperaType;
////import com.bonus.canteen.core.supermarket.common.annotation.PreventRepeatSubmit;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.bonus.common.log.annotation.SysLog;
//import com.bonus.common.security.annotation.RequiresPermissions;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
//import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
//import com.bonus.common.core.web.controller.BaseController;
//import com.bonus.common.core.web.domain.AjaxResult;
//import com.bonus.common.core.utils.poi.ExcelUtil;
//import com.bonus.common.core.web.page.TableDataInfo;
//
///**
// * 商品信息Controller
// *
// * @author xsheng
// * @date 2025-05-25
// */
//@Api(tags = "商品信息接口")
//@RestController
//@RequestMapping("/supermarket_material")
//public class SupermarketMaterialController extends BaseController {
// @Autowired
// private ISupermarketMaterialService supermarketMaterialService;
//
// /**
// * 查询商品信息列表
// */
// @ApiOperation(value = "查询商品信息列表")
// //@RequiresPermissions("supermarket:material:list")
// @GetMapping("/list")
// public TableDataInfo list(SupermarketMaterial supermarketMaterial) {
// startPage();
// List<SupermarketMaterial> list = supermarketMaterialService.selectSupermarketMaterialList(supermarketMaterial);
// return getDataTable(list);
// }
//
// /**
// * 导出商品信息列表
// */
// @ApiOperation(value = "导出商品信息列表")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:material:export")
// @SysLog(title = "商品信息", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出商品信息")
// @PostMapping("/export")
// public void export(HttpServletResponse response, SupermarketMaterial supermarketMaterial) {
// List<SupermarketMaterial> list = supermarketMaterialService.selectSupermarketMaterialList(supermarketMaterial);
// ExcelUtil<SupermarketMaterial> util = new ExcelUtil<SupermarketMaterial>(SupermarketMaterial.class);
// util.exportExcel(response, list, "商品信息数据");
// }
//
// /**
// * 获取商品信息详细信息
// */
// @ApiOperation(value = "获取商品信息详细信息")
// //@RequiresPermissions("supermarket:material:query")
// @GetMapping(value = "/{materialId}")
// public AjaxResult getInfo(@PathVariable("materialId") Long materialId) {
// return success(supermarketMaterialService.selectSupermarketMaterialByMaterialId(materialId));
// }
//
// /**
// * 新增商品信息
// */
// @ApiOperation(value = "新增商品信息")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:material:add")
// @SysLog(title = "商品信息", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增商品信息")
// @PostMapping
// public AjaxResult add(@RequestBody SupermarketMaterial supermarketMaterial) {
// try {
// return toAjax(supermarketMaterialService.insertSupermarketMaterial(supermarketMaterial));
// } catch (Exception e) {
// return error(e.getMessage());
// }
// }
//
// /**
// * 修改商品信息
// */
// @ApiOperation(value = "修改商品信息")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:material:edit")
// @SysLog(title = "商品信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改商品信息")
// @PostMapping("/edit")
// public AjaxResult edit(@RequestBody SupermarketMaterial supermarketMaterial) {
// try {
// return toAjax(supermarketMaterialService.updateSupermarketMaterial(supermarketMaterial));
// } catch (Exception e) {
// return error(e.getMessage());
// }
// }
//
// /**
// * 删除商品信息
// */
// @ApiOperation(value = "删除商品信息")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:material:remove")
// @SysLog(title = "商品信息", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除商品信息")
// @PostMapping("/del/{materialIds}")
// public AjaxResult remove(@PathVariable Long[] materialIds) {
// return toAjax(supermarketMaterialService.deleteSupermarketMaterialByMaterialIds(materialIds));
// }
//}

View File

@ -1,119 +1,119 @@
package com.bonus.canteen.core.supermarket.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.supermarket.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialTypeService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 商品类别Controller
*
* @author xsheng
* @date 2025-05-25
*/
@Api(tags = "商品类别接口")
@RestController
@RequestMapping("/supermarket_material_type")
public class SupermarketMaterialTypeController extends BaseController {
@Autowired
private ISupermarketMaterialTypeService supermarketMaterialTypeService;
/**
* 查询商品类别列表
*/
@ApiOperation(value = "查询商品类别列表")
//@RequiresPermissions("supermarket:type:list")
@GetMapping("/list")
public TableDataInfo list(SupermarketMaterialType supermarketMaterialType) {
startPage();
List<SupermarketMaterialType> list = supermarketMaterialTypeService.selectSupermarketMaterialTypeList(supermarketMaterialType);
return getDataTable(list);
}
/**
* 导出商品类别列表
*/
@ApiOperation(value = "导出商品类别列表")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:type:export")
@SysLog(title = "商品类别", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出商品类别")
@PostMapping("/export")
public void export(HttpServletResponse response, SupermarketMaterialType supermarketMaterialType) {
List<SupermarketMaterialType> list = supermarketMaterialTypeService.selectSupermarketMaterialTypeList(supermarketMaterialType);
ExcelUtil<SupermarketMaterialType> util = new ExcelUtil<SupermarketMaterialType>(SupermarketMaterialType.class);
util.exportExcel(response, list, "商品类别数据");
}
/**
* 获取商品类别详细信息
*/
@ApiOperation(value = "获取商品类别详细信息")
//@RequiresPermissions("supermarket:type:query")
@GetMapping(value = "/{materialTypeId}")
public AjaxResult getInfo(@PathVariable("materialTypeId") Long materialTypeId) {
return success(supermarketMaterialTypeService.selectSupermarketMaterialTypeByMaterialTypeId(materialTypeId));
}
/**
* 新增商品类别
*/
@ApiOperation(value = "新增商品类别")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:type:add")
@SysLog(title = "商品类别", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增商品类别")
@PostMapping
public AjaxResult add(@RequestBody SupermarketMaterialType supermarketMaterialType) {
try {
return toAjax(supermarketMaterialTypeService.insertSupermarketMaterialType(supermarketMaterialType));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 修改商品类别
*/
@ApiOperation(value = "修改商品类别")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:type:edit")
@SysLog(title = "商品类别", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改商品类别")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody SupermarketMaterialType supermarketMaterialType) {
try {
return toAjax(supermarketMaterialTypeService.updateSupermarketMaterialType(supermarketMaterialType));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 删除商品类别
*/
@ApiOperation(value = "删除商品类别")
//@PreventRepeatSubmit
//@RequiresPermissions("supermarket:type:remove")
@SysLog(title = "商品类别", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除商品类别")
@PostMapping("/del/{materialTypeIds}")
public AjaxResult remove(@PathVariable Long[] materialTypeIds) {
return toAjax(supermarketMaterialTypeService.deleteSupermarketMaterialTypeByMaterialTypeIds(materialTypeIds));
}
}
//package com.bonus.canteen.core.supermarket.controller;
//
//import java.util.List;
//import javax.servlet.http.HttpServletResponse;
//import com.bonus.common.log.enums.OperaType;
////import com.bonus.canteen.core.supermarket.common.annotation.PreventRepeatSubmit;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.bonus.common.log.annotation.SysLog;
//import com.bonus.common.security.annotation.RequiresPermissions;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
//import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialTypeService;
//import com.bonus.common.core.web.controller.BaseController;
//import com.bonus.common.core.web.domain.AjaxResult;
//import com.bonus.common.core.utils.poi.ExcelUtil;
//import com.bonus.common.core.web.page.TableDataInfo;
//
///**
// * 商品类别Controller
// *
// * @author xsheng
// * @date 2025-05-25
// */
//@Api(tags = "商品类别接口")
//@RestController
//@RequestMapping("/supermarket_material_type")
//public class SupermarketMaterialTypeController extends BaseController {
// @Autowired
// private ISupermarketMaterialTypeService supermarketMaterialTypeService;
//
// /**
// * 查询商品类别列表
// */
// @ApiOperation(value = "查询商品类别列表")
// //@RequiresPermissions("supermarket:type:list")
// @GetMapping("/list")
// public TableDataInfo list(SupermarketMaterialType supermarketMaterialType) {
// startPage();
// List<SupermarketMaterialType> list = supermarketMaterialTypeService.selectSupermarketMaterialTypeList(supermarketMaterialType);
// return getDataTable(list);
// }
//
// /**
// * 导出商品类别列表
// */
// @ApiOperation(value = "导出商品类别列表")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:type:export")
// @SysLog(title = "商品类别", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出商品类别")
// @PostMapping("/export")
// public void export(HttpServletResponse response, SupermarketMaterialType supermarketMaterialType) {
// List<SupermarketMaterialType> list = supermarketMaterialTypeService.selectSupermarketMaterialTypeList(supermarketMaterialType);
// ExcelUtil<SupermarketMaterialType> util = new ExcelUtil<SupermarketMaterialType>(SupermarketMaterialType.class);
// util.exportExcel(response, list, "商品类别数据");
// }
//
// /**
// * 获取商品类别详细信息
// */
// @ApiOperation(value = "获取商品类别详细信息")
// //@RequiresPermissions("supermarket:type:query")
// @GetMapping(value = "/{materialTypeId}")
// public AjaxResult getInfo(@PathVariable("materialTypeId") Long materialTypeId) {
// return success(supermarketMaterialTypeService.selectSupermarketMaterialTypeByMaterialTypeId(materialTypeId));
// }
//
// /**
// * 新增商品类别
// */
// @ApiOperation(value = "新增商品类别")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:type:add")
// @SysLog(title = "商品类别", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增商品类别")
// @PostMapping
// public AjaxResult add(@RequestBody SupermarketMaterialType supermarketMaterialType) {
// try {
// return toAjax(supermarketMaterialTypeService.insertSupermarketMaterialType(supermarketMaterialType));
// } catch (Exception e) {
// return error(e.getMessage());
// }
// }
//
// /**
// * 修改商品类别
// */
// @ApiOperation(value = "修改商品类别")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:type:edit")
// @SysLog(title = "商品类别", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改商品类别")
// @PostMapping("/edit")
// public AjaxResult edit(@RequestBody SupermarketMaterialType supermarketMaterialType) {
// try {
// return toAjax(supermarketMaterialTypeService.updateSupermarketMaterialType(supermarketMaterialType));
// } catch (Exception e) {
// return error(e.getMessage());
// }
// }
//
// /**
// * 删除商品类别
// */
// @ApiOperation(value = "删除商品类别")
// //@PreventRepeatSubmit
// //@RequiresPermissions("supermarket:type:remove")
// @SysLog(title = "商品类别", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除商品类别")
// @PostMapping("/del/{materialTypeIds}")
// public AjaxResult remove(@PathVariable Long[] materialTypeIds) {
// return toAjax(supermarketMaterialTypeService.deleteSupermarketMaterialTypeByMaterialTypeIds(materialTypeIds));
// }
//}

View File

@ -1,124 +1,124 @@
package com.bonus.canteen.core.supermarket.domain;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 商品信息对象 supermarket_material
*
* @author xsheng
* @date 2025-05-25
*/
@Data
@ToString
public class SupermarketMaterial extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 原料id */
private Long materialId;
/** 区域id */
@Excel(name = "区域id")
@ApiModelProperty(value = "区域id")
private Long areaId;
private String areaName;
/** 原料名称 */
@Excel(name = "原料名称")
@ApiModelProperty(value = "原料名称")
private String materialName;
/** 原料编码 */
@Excel(name = "原料编码")
@ApiModelProperty(value = "原料编码")
private String materialCode;
/** 原料图片 */
@Excel(name = "原料图片")
@ApiModelProperty(value = "原料图片")
private String imgUrl;
/** 类别id */
@Excel(name = "类别id")
@ApiModelProperty(value = "类别id")
private Long materialTypeId;
private String materialTypeName;
/** 类别ids */
@Excel(name = "类别ids")
@ApiModelProperty(value = "类别ids")
private Long[] materialTypeIds;
/** 原料类型(1原料2商品) */
@ApiModelProperty(value = "原料类型(1原料2商品)")
private Long goodsType;
/** 条码 */
@Excel(name = "条码")
@ApiModelProperty(value = "条码")
private String barCode;
/** 单位 */
@Excel(name = "单位")
@ApiModelProperty(value = "单位")
private Long unitId;
private String unitName;
/** 销售价 */
@Excel(name = "销售价")
@ApiModelProperty(value = "销售价")
private Long salePrice;
/** 进价 */
@Excel(name = "进价")
@ApiModelProperty(value = "进价")
private Long unitPrice;
/** 售卖类型(1计量2散称) */
@Excel(name = "售卖类型(1计量2散称)")
@ApiModelProperty(value = "售卖类型(1计量2散称)")
private Long salesMode;
/** 保质期类型 1年 2月 3日 */
@Excel(name = "保质期类型 1年 2月 3日")
@ApiModelProperty(value = "保质期类型 1年 2月 3日")
private Long shelfLifeType;
/** 保质期数 */
@Excel(name = "保质期数")
@ApiModelProperty(value = "保质期数")
private Long shelfLifeDays;
/** 采购价格上限 */
@Excel(name = "采购价格上限")
@ApiModelProperty(value = "采购价格上限")
private Long purPriceCeiling;
/** 大类id */
@Excel(name = "大类id")
@ApiModelProperty(value = "大类id")
private Long bigCategoryId;
/** 规格 */
@Excel(name = "规格")
@ApiModelProperty(value = "规格")
private String size;
/** 简介 */
@Excel(name = "简介")
@ApiModelProperty(value = "简介")
private String description;
public String getImgUrl() {
return FileUrlUtil.getFileUrl(imgUrl);
}
}
//package com.bonus.canteen.core.supermarket.domain;
//
//import com.bonus.canteen.core.common.utils.FileUrlUtil;
//import com.bonus.common.core.annotation.Excel;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//import lombok.ToString;
//import com.bonus.common.core.web.domain.BaseEntity;
//
///**
// * 商品信息对象 supermarket_material
// *
// * @author xsheng
// * @date 2025-05-25
// */
//
//
//@Data
//@ToString
//public class SupermarketMaterial extends BaseEntity {
// private static final long serialVersionUID = 1L;
//
// /** 原料id */
// private Long materialId;
//
// /** 区域id */
// @Excel(name = "区域id")
// @ApiModelProperty(value = "区域id")
// private Long areaId;
//
// private String areaName;
//
// /** 原料名称 */
// @Excel(name = "原料名称")
// @ApiModelProperty(value = "原料名称")
// private String materialName;
//
// /** 原料编码 */
// @Excel(name = "原料编码")
// @ApiModelProperty(value = "原料编码")
// private String materialCode;
//
// /** 原料图片 */
// @Excel(name = "原料图片")
// @ApiModelProperty(value = "原料图片")
// private String imgUrl;
//
// /** 类别id */
// @Excel(name = "类别id")
// @ApiModelProperty(value = "类别id")
// private Long materialTypeId;
//
// private String materialTypeName;
//
// /** 类别ids */
// @Excel(name = "类别ids")
// @ApiModelProperty(value = "类别ids")
// private Long[] materialTypeIds;
//
// /** 原料类型(1原料2商品) */
// @ApiModelProperty(value = "原料类型(1原料2商品)")
// private Long goodsType;
//
// /** 条码 */
// @Excel(name = "条码")
// @ApiModelProperty(value = "条码")
// private String barCode;
//
// /** 单位 */
// @Excel(name = "单位")
// @ApiModelProperty(value = "单位")
// private Long unitId;
//
// private String unitName;
//
// /** 销售价 */
// @Excel(name = "销售价")
// @ApiModelProperty(value = "销售价")
// private Long salePrice;
//
// /** 进价 */
// @Excel(name = "进价")
// @ApiModelProperty(value = "进价")
// private Long unitPrice;
//
// /** 售卖类型(1计量2散称) */
// @Excel(name = "售卖类型(1计量2散称)")
// @ApiModelProperty(value = "售卖类型(1计量2散称)")
// private Long salesMode;
//
// /** 保质期类型 1年 2月 3日 */
// @Excel(name = "保质期类型 1年 2月 3日")
// @ApiModelProperty(value = "保质期类型 1年 2月 3日")
// private Long shelfLifeType;
//
// /** 保质期数 */
// @Excel(name = "保质期数")
// @ApiModelProperty(value = "保质期数")
// private Long shelfLifeDays;
//
// /** 采购价格上限 */
// @Excel(name = "采购价格上限")
// @ApiModelProperty(value = "采购价格上限")
// private Long purPriceCeiling;
//
// /** 大类id */
// @Excel(name = "大类id")
// @ApiModelProperty(value = "大类id")
// private Long bigCategoryId;
//
// /** 规格 */
// @Excel(name = "规格")
// @ApiModelProperty(value = "规格")
// private String size;
//
// /** 简介 */
// @Excel(name = "简介")
// @ApiModelProperty(value = "简介")
// private String description;
//
// public String getImgUrl() {
// return FileUrlUtil.getFileUrl(imgUrl);
// }
//}

View File

@ -1,49 +1,49 @@
package com.bonus.canteen.core.supermarket.domain;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 商品类别对象 supermarket_material_type
*
* @author xsheng
* @date 2025-05-25
*/
@Data
@ToString
public class SupermarketMaterialType extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */
private Long materialTypeId;
/** 类别名称 */
@Excel(name = "类别名称")
@ApiModelProperty(value = "类别名称")
private String materialTypeName;
/** 父类id */
@Excel(name = "父类id")
@ApiModelProperty(value = "父类id")
private Long parentId;
/** 等级(0,1,2,3) */
@Excel(name = "等级(0,1,2,3)")
@ApiModelProperty(value = "等级(0,1,2,3)")
private Long level;
/** 区域id */
@Excel(name = "区域id")
@ApiModelProperty(value = "区域id")
private Long areaId;
/** 商品类型(1原料2商品) */
@Excel(name = "商品类型(1原料2商品)")
@ApiModelProperty(value = "商品类型(1原料2商品)")
private Long goodsType;
}
//package com.bonus.canteen.core.supermarket.domain;
//
//import com.bonus.common.core.annotation.Excel;
//import io.swagger.annotations.ApiModelProperty;
//import lombok.Data;
//import lombok.ToString;
//import com.bonus.common.core.web.domain.BaseEntity;
//
///**
// * 商品类别对象 supermarket_material_type
// *
// * @author xsheng
// * @date 2025-05-25
// */
//
//
//@Data
//@ToString
//public class SupermarketMaterialType extends BaseEntity {
// private static final long serialVersionUID = 1L;
//
// /** 主键id */
// private Long materialTypeId;
//
// /** 类别名称 */
// @Excel(name = "类别名称")
// @ApiModelProperty(value = "类别名称")
// private String materialTypeName;
//
// /** 父类id */
// @Excel(name = "父类id")
// @ApiModelProperty(value = "父类id")
// private Long parentId;
//
// /** 等级(0,1,2,3) */
// @Excel(name = "等级(0,1,2,3)")
// @ApiModelProperty(value = "等级(0,1,2,3)")
// private Long level;
//
// /** 区域id */
// @Excel(name = "区域id")
// @ApiModelProperty(value = "区域id")
// private Long areaId;
//
// /** 商品类型(1原料2商品) */
// @Excel(name = "商品类型(1原料2商品)")
// @ApiModelProperty(value = "商品类型(1原料2商品)")
// private Long goodsType;
//}

View File

@ -1,62 +1,62 @@
package com.bonus.canteen.core.supermarket.mapper;
import java.util.List;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
/**
* 商品信息Mapper接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface SupermarketMaterialMapper {
/**
* 查询商品信息
*
* @param materialId 商品信息主键
* @return 商品信息
*/
public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId);
/**
* 查询商品信息列表
*
* @param supermarketMaterial 商品信息
* @return 商品信息集合
*/
public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial);
/**
* 新增商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial);
/**
* 修改商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial);
/**
* 删除商品信息
*
* @param materialId 商品信息主键
* @return 结果
*/
public int deleteSupermarketMaterialByMaterialId(Long materialId);
/**
* 批量删除商品信息
*
* @param materialIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds);
public int getSupermarketMaterialCountByMaterialTypes(Long[] materialTypeIds);
}
//package com.bonus.canteen.core.supermarket.mapper;
//
//import java.util.List;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
//
///**
// * 商品信息Mapper接口
// *
// * @author xsheng
// * @date 2025-05-25
// */
//public interface SupermarketMaterialMapper {
// /**
// * 查询商品信息
// *
// * @param materialId 商品信息主键
// * @return 商品信息
// */
// public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId);
//
// /**
// * 查询商品信息列表
// *
// * @param supermarketMaterial 商品信息
// * @return 商品信息集合
// */
// public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial);
//
// /**
// * 新增商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial);
//
// /**
// * 修改商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial);
//
// /**
// * 删除商品信息
// *
// * @param materialId 商品信息主键
// * @return 结果
// */
// public int deleteSupermarketMaterialByMaterialId(Long materialId);
//
// /**
// * 批量删除商品信息
// *
// * @param materialIds 需要删除的数据主键集合
// * @return 结果
// */
// public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds);
//
// public int getSupermarketMaterialCountByMaterialTypes(Long[] materialTypeIds);
//}

View File

@ -1,64 +1,64 @@
package com.bonus.canteen.core.supermarket.mapper;
import java.util.List;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
/**
* 商品类别Mapper接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface SupermarketMaterialTypeMapper {
/**
* 查询商品类别
*
* @param materialTypeId 商品类别主键
* @return 商品类别
*/
public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeName(SupermarketMaterialType supermarketMaterialType);
/**
* 查询商品类别列表
*
* @param supermarketMaterialType 商品类别
* @return 商品类别集合
*/
public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType);
/**
* 新增商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
/**
* 修改商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
/**
* 删除商品类别
*
* @param materialTypeId 商品类别主键
* @return 结果
*/
public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
/**
* 批量删除商品类别
*
* @param materialTypeIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
public int getSupermarketMaterialTypeChildCountByMaterialTypes(Long[] materialTypeIds);
}
//package com.bonus.canteen.core.supermarket.mapper;
//
//import java.util.List;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
//
///**
// * 商品类别Mapper接口
// *
// * @author xsheng
// * @date 2025-05-25
// */
//public interface SupermarketMaterialTypeMapper {
// /**
// * 查询商品类别
// *
// * @param materialTypeId 商品类别主键
// * @return 商品类别
// */
// public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
//
// public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeName(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 查询商品类别列表
// *
// * @param supermarketMaterialType 商品类别
// * @return 商品类别集合
// */
// public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 新增商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 修改商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 删除商品类别
// *
// * @param materialTypeId 商品类别主键
// * @return 结果
// */
// public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
//
// /**
// * 批量删除商品类别
// *
// * @param materialTypeIds 需要删除的数据主键集合
// * @return 结果
// */
// public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
//
// public int getSupermarketMaterialTypeChildCountByMaterialTypes(Long[] materialTypeIds);
//}

View File

@ -1,60 +1,60 @@
package com.bonus.canteen.core.supermarket.service;
import java.util.List;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
/**
* 商品信息Service接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface ISupermarketMaterialService {
/**
* 查询商品信息
*
* @param materialId 商品信息主键
* @return 商品信息
*/
public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId);
/**
* 查询商品信息列表
*
* @param supermarketMaterial 商品信息
* @return 商品信息集合
*/
public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial);
/**
* 新增商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial);
/**
* 修改商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial);
/**
* 批量删除商品信息
*
* @param materialIds 需要删除的商品信息主键集合
* @return 结果
*/
public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds);
/**
* 删除商品信息信息
*
* @param materialId 商品信息主键
* @return 结果
*/
public int deleteSupermarketMaterialByMaterialId(Long materialId);
}
//package com.bonus.canteen.core.supermarket.service;
//
//import java.util.List;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
//
///**
// * 商品信息Service接口
// *
// * @author xsheng
// * @date 2025-05-25
// */
//public interface ISupermarketMaterialService {
// /**
// * 查询商品信息
// *
// * @param materialId 商品信息主键
// * @return 商品信息
// */
// public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId);
//
// /**
// * 查询商品信息列表
// *
// * @param supermarketMaterial 商品信息
// * @return 商品信息集合
// */
// public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial);
//
// /**
// * 新增商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial);
//
// /**
// * 修改商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial);
//
// /**
// * 批量删除商品信息
// *
// * @param materialIds 需要删除的商品信息主键集合
// * @return 结果
// */
// public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds);
//
// /**
// * 删除商品信息信息
// *
// * @param materialId 商品信息主键
// * @return 结果
// */
// public int deleteSupermarketMaterialByMaterialId(Long materialId);
//}

View File

@ -1,60 +1,60 @@
package com.bonus.canteen.core.supermarket.service;
import java.util.List;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
/**
* 商品类别Service接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface ISupermarketMaterialTypeService {
/**
* 查询商品类别
*
* @param materialTypeId 商品类别主键
* @return 商品类别
*/
public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
/**
* 查询商品类别列表
*
* @param supermarketMaterialType 商品类别
* @return 商品类别集合
*/
public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType);
/**
* 新增商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
/**
* 修改商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
/**
* 批量删除商品类别
*
* @param materialTypeIds 需要删除的商品类别主键集合
* @return 结果
*/
public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
/**
* 删除商品类别信息
*
* @param materialTypeId 商品类别主键
* @return 结果
*/
public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
}
//package com.bonus.canteen.core.supermarket.service;
//
//import java.util.List;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
//
///**
// * 商品类别Service接口
// *
// * @author xsheng
// * @date 2025-05-25
// */
//public interface ISupermarketMaterialTypeService {
// /**
// * 查询商品类别
// *
// * @param materialTypeId 商品类别主键
// * @return 商品类别
// */
// public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
//
// /**
// * 查询商品类别列表
// *
// * @param supermarketMaterialType 商品类别
// * @return 商品类别集合
// */
// public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 新增商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 修改商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType);
//
// /**
// * 批量删除商品类别
// *
// * @param materialTypeIds 需要删除的商品类别主键集合
// * @return 结果
// */
// public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds);
//
// /**
// * 删除商品类别信息
// *
// * @param materialTypeId 商品类别主键
// * @return 结果
// */
// public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId);
//}

View File

@ -3,11 +3,7 @@ package com.bonus.canteen.core.supermarket.service.impl;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.bonus.canteen.core.basic.domain.BasicCanteen;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
import com.bonus.canteen.core.supermarket.domain.SupermarketProduct;
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;

View File

@ -1,108 +1,108 @@
package com.bonus.canteen.core.supermarket.service.impl;
import java.util.List;
import com.bonus.canteen.core.supermarket.domain.SupermarketProduct;
import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
import org.springframework.util.CollectionUtils;
/**
* 商品信息Service业务层处理
*
* @author xsheng
* @date 2025-05-25
*/
@Service
public class SupermarketMaterialServiceImpl implements ISupermarketMaterialService {
@Autowired
private SupermarketMaterialMapper supermarketMaterialMapper;
@Autowired
private SupermarketProductMapper supermarketProductMapper;
/**
* 查询商品信息
*
* @param materialId 商品信息主键
* @return 商品信息
*/
@Override
public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId) {
return supermarketMaterialMapper.selectSupermarketMaterialByMaterialId(materialId);
}
/**
* 查询商品信息列表
*
* @param supermarketMaterial 商品信息
* @return 商品信息
*/
@Override
public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial) {
return supermarketMaterialMapper.selectSupermarketMaterialList(supermarketMaterial);
}
/**
* 新增商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
@Override
public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial) {
supermarketMaterial.setCreateTime(DateUtils.getNowDate());
try {
return supermarketMaterialMapper.insertSupermarketMaterial(supermarketMaterial);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 修改商品信息
*
* @param supermarketMaterial 商品信息
* @return 结果
*/
@Override
public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial) {
supermarketMaterial.setUpdateTime(DateUtils.getNowDate());
try {
return supermarketMaterialMapper.updateSupermarketMaterial(supermarketMaterial);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 批量删除商品信息
*
* @param materialIds 需要删除的商品信息主键
* @return 结果
*/
@Override
public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds) {
List<SupermarketProduct> list = supermarketProductMapper.selectSupermarketProductByMaterialIds(materialIds);
if (!CollectionUtils.isEmpty(list)) {
throw new ServiceException("该原料下含有商品,不能删除");
}
return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialIds(materialIds);
}
/**
* 删除商品信息信息
*
* @param materialId 商品信息主键
* @return 结果
*/
@Override
public int deleteSupermarketMaterialByMaterialId(Long materialId) {
return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialId(materialId);
}
}
//package com.bonus.canteen.core.supermarket.service.impl;
//
//import java.util.List;
//
//import com.bonus.canteen.core.supermarket.domain.SupermarketProduct;
//import com.bonus.canteen.core.supermarket.mapper.SupermarketProductMapper;
//import com.bonus.common.core.exception.ServiceException;
//import com.bonus.common.core.utils.DateUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterial;
//import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialService;
//import org.springframework.util.CollectionUtils;
//
///**
// * 商品信息Service业务层处理
// *
// * @author xsheng
// * @date 2025-05-25
// */
//@Service
//public class SupermarketMaterialServiceImpl implements ISupermarketMaterialService {
// @Autowired
// private SupermarketMaterialMapper supermarketMaterialMapper;
// @Autowired
// private SupermarketProductMapper supermarketProductMapper;
//
// /**
// * 查询商品信息
// *
// * @param materialId 商品信息主键
// * @return 商品信息
// */
// @Override
// public SupermarketMaterial selectSupermarketMaterialByMaterialId(Long materialId) {
// return supermarketMaterialMapper.selectSupermarketMaterialByMaterialId(materialId);
// }
//
// /**
// * 查询商品信息列表
// *
// * @param supermarketMaterial 商品信息
// * @return 商品信息
// */
// @Override
// public List<SupermarketMaterial> selectSupermarketMaterialList(SupermarketMaterial supermarketMaterial) {
// return supermarketMaterialMapper.selectSupermarketMaterialList(supermarketMaterial);
// }
//
// /**
// * 新增商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// @Override
// public int insertSupermarketMaterial(SupermarketMaterial supermarketMaterial) {
// supermarketMaterial.setCreateTime(DateUtils.getNowDate());
// try {
// return supermarketMaterialMapper.insertSupermarketMaterial(supermarketMaterial);
// } catch (Exception e) {
// throw new ServiceException(e.getMessage());
// }
// }
//
// /**
// * 修改商品信息
// *
// * @param supermarketMaterial 商品信息
// * @return 结果
// */
// @Override
// public int updateSupermarketMaterial(SupermarketMaterial supermarketMaterial) {
// supermarketMaterial.setUpdateTime(DateUtils.getNowDate());
// try {
// return supermarketMaterialMapper.updateSupermarketMaterial(supermarketMaterial);
// } catch (Exception e) {
// throw new ServiceException(e.getMessage());
// }
// }
//
// /**
// * 批量删除商品信息
// *
// * @param materialIds 需要删除的商品信息主键
// * @return 结果
// */
// @Override
// public int deleteSupermarketMaterialByMaterialIds(Long[] materialIds) {
// List<SupermarketProduct> list = supermarketProductMapper.selectSupermarketProductByMaterialIds(materialIds);
// if (!CollectionUtils.isEmpty(list)) {
// throw new ServiceException("该原料下含有商品,不能删除");
// }
// return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialIds(materialIds);
// }
//
// /**
// * 删除商品信息信息
// *
// * @param materialId 商品信息主键
// * @return 结果
// */
// @Override
// public int deleteSupermarketMaterialByMaterialId(Long materialId) {
// return supermarketMaterialMapper.deleteSupermarketMaterialByMaterialId(materialId);
// }
//}

View File

@ -1,124 +1,124 @@
package com.bonus.canteen.core.supermarket.service.impl;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.security.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialTypeMapper;
import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialTypeService;
/**
* 商品类别Service业务层处理
*
* @author xsheng
* @date 2025-05-25
*/
@Service
public class SupermarketMaterialTypeServiceImpl implements ISupermarketMaterialTypeService {
@Autowired
private SupermarketMaterialTypeMapper supermarketMaterialTypeMapper;
@Autowired
private SupermarketMaterialMapper supermarketMaterialMapper;
/**
* 查询商品类别
*
* @param materialTypeId 商品类别主键
* @return 商品类别
*/
@Override
public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId) {
return supermarketMaterialTypeMapper.selectSupermarketMaterialTypeByMaterialTypeId(materialTypeId);
}
/**
* 查询商品类别列表
*
* @param supermarketMaterialType 商品类别
* @return 商品类别
*/
@Override
public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType) {
return supermarketMaterialTypeMapper.selectSupermarketMaterialTypeList(supermarketMaterialType);
}
/**
* 新增商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
@Override
public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType) {
supermarketMaterialType.setCreateTime(DateUtils.getNowDate());
supermarketMaterialType.setCreateBy(SecurityUtils.getUsername());
try {
SupermarketMaterialType checkResult = supermarketMaterialTypeMapper.selectSupermarketMaterialTypeByMaterialTypeName(supermarketMaterialType);
if (Objects.nonNull(checkResult)) {
throw new ServiceException("该超市商品类别名已存在");
}
return supermarketMaterialTypeMapper.insertSupermarketMaterialType(supermarketMaterialType);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 修改商品类别
*
* @param supermarketMaterialType 商品类别
* @return 结果
*/
@Override
public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType) {
supermarketMaterialType.setUpdateTime(DateUtils.getNowDate());
supermarketMaterialType.setUpdateBy(SecurityUtils.getUsername());
try {
List<SupermarketMaterialType> allSupermarketMaterialTypeList = supermarketMaterialTypeMapper.selectSupermarketMaterialTypeList(new SupermarketMaterialType());
List<String> otherSupermarketMaterialTypeList = allSupermarketMaterialTypeList.stream().filter(item -> !item.getMaterialTypeId().equals(supermarketMaterialType.getMaterialTypeId()))
.map(SupermarketMaterialType::getMaterialTypeName).collect(Collectors.toList());
if (otherSupermarketMaterialTypeList.contains(supermarketMaterialType.getMaterialTypeName())) {
throw new ServiceException("该超市商品类别名已存在");
}
return supermarketMaterialTypeMapper.updateSupermarketMaterialType(supermarketMaterialType);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 批量删除商品类别
*
* @param materialTypeIds 需要删除的商品类别主键
* @return 结果
*/
@Override
public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds) {
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);
}
/**
* 删除商品类别信息
*
* @param materialTypeId 商品类别主键
* @return 结果
*/
@Override
public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId) {
return supermarketMaterialTypeMapper.deleteSupermarketMaterialTypeByMaterialTypeId(materialTypeId);
}
}
//package com.bonus.canteen.core.supermarket.service.impl;
//
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper;
//import com.bonus.common.core.exception.ServiceException;
//import com.bonus.common.core.utils.DateUtils;
//import com.bonus.common.security.utils.SecurityUtils;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialTypeMapper;
//import com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType;
//import com.bonus.canteen.core.supermarket.service.ISupermarketMaterialTypeService;
//
///**
// * 商品类别Service业务层处理
// *
// * @author xsheng
// * @date 2025-05-25
// */
//@Service
//public class SupermarketMaterialTypeServiceImpl implements ISupermarketMaterialTypeService {
// @Autowired
// private SupermarketMaterialTypeMapper supermarketMaterialTypeMapper;
// @Autowired
// private SupermarketMaterialMapper supermarketMaterialMapper;
//
// /**
// * 查询商品类别
// *
// * @param materialTypeId 商品类别主键
// * @return 商品类别
// */
// @Override
// public SupermarketMaterialType selectSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId) {
// return supermarketMaterialTypeMapper.selectSupermarketMaterialTypeByMaterialTypeId(materialTypeId);
// }
//
// /**
// * 查询商品类别列表
// *
// * @param supermarketMaterialType 商品类别
// * @return 商品类别
// */
// @Override
// public List<SupermarketMaterialType> selectSupermarketMaterialTypeList(SupermarketMaterialType supermarketMaterialType) {
// return supermarketMaterialTypeMapper.selectSupermarketMaterialTypeList(supermarketMaterialType);
// }
//
// /**
// * 新增商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// @Override
// public int insertSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType) {
// supermarketMaterialType.setCreateTime(DateUtils.getNowDate());
// supermarketMaterialType.setCreateBy(SecurityUtils.getUsername());
// try {
// SupermarketMaterialType checkResult = supermarketMaterialTypeMapper.selectSupermarketMaterialTypeByMaterialTypeName(supermarketMaterialType);
// if (Objects.nonNull(checkResult)) {
// throw new ServiceException("该超市商品类别名已存在");
// }
// return supermarketMaterialTypeMapper.insertSupermarketMaterialType(supermarketMaterialType);
// } catch (Exception e) {
// throw new ServiceException(e.getMessage());
// }
// }
//
// /**
// * 修改商品类别
// *
// * @param supermarketMaterialType 商品类别
// * @return 结果
// */
// @Override
// public int updateSupermarketMaterialType(SupermarketMaterialType supermarketMaterialType) {
// supermarketMaterialType.setUpdateTime(DateUtils.getNowDate());
// supermarketMaterialType.setUpdateBy(SecurityUtils.getUsername());
// try {
// List<SupermarketMaterialType> allSupermarketMaterialTypeList = supermarketMaterialTypeMapper.selectSupermarketMaterialTypeList(new SupermarketMaterialType());
// List<String> otherSupermarketMaterialTypeList = allSupermarketMaterialTypeList.stream().filter(item -> !item.getMaterialTypeId().equals(supermarketMaterialType.getMaterialTypeId()))
// .map(SupermarketMaterialType::getMaterialTypeName).collect(Collectors.toList());
// if (otherSupermarketMaterialTypeList.contains(supermarketMaterialType.getMaterialTypeName())) {
// throw new ServiceException("该超市商品类别名已存在");
// }
// return supermarketMaterialTypeMapper.updateSupermarketMaterialType(supermarketMaterialType);
// } catch (Exception e) {
// throw new ServiceException(e.getMessage());
// }
// }
//
// /**
// * 批量删除商品类别
// *
// * @param materialTypeIds 需要删除的商品类别主键
// * @return 结果
// */
// @Override
// public int deleteSupermarketMaterialTypeByMaterialTypeIds(Long[] materialTypeIds) {
// 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);
// }
//
// /**
// * 删除商品类别信息
// *
// * @param materialTypeId 商品类别主键
// * @return 结果
// */
// @Override
// public int deleteSupermarketMaterialTypeByMaterialTypeId(Long materialTypeId) {
// return supermarketMaterialTypeMapper.deleteSupermarketMaterialTypeByMaterialTypeId(materialTypeId);
// }
//}

View File

@ -1,176 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialMapper">
<resultMap type="com.bonus.canteen.core.supermarket.domain.SupermarketMaterial" id="SupermarketMaterialResult">
<result property="materialId" column="material_id" />
<result property="areaId" column="area_id" />
<result property="areaName" column="area_name" />
<result property="materialName" column="material_name" />
<result property="materialCode" column="material_code" />
<result property="imgUrl" column="img_url" />
<result property="materialTypeId" column="material_type_id" />
<result property="materialTypeName" column="material_type_name" />
<result property="goodsType" column="goods_type" />
<result property="barCode" column="bar_code" />
<result property="unitId" column="unit_id" />
<result property="unitName" column="unit_name" />
<result property="salePrice" column="sale_price" />
<result property="unitPrice" column="unit_price" />
<result property="salesMode" column="sales_mode" />
<result property="shelfLifeType" column="shelf_life_type" />
<result property="shelfLifeDays" column="shelf_life_days" />
<result property="purPriceCeiling" column="pur_price_ceiling" />
<result property="bigCategoryId" column="big_category_id" />
<result property="size" column="size" />
<result property="description" column="description" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSupermarketMaterialVo">
select sm.material_id, sm.area_id, sm.material_name, sm.material_code, sm.img_url, sm.material_type_id,
sm.bar_code, sm.unit_id, sm.sale_price, sm.unit_price, sm.sales_mode, sm.shelf_life_type,
sm.shelf_life_days, sm.pur_price_ceiling, sm.big_category_id, sm.`size`, sm.description, sm.goods_type,
sm.create_by, sm.create_time, sm.update_by, sm.update_time,
ba.area_name, smt.material_type_name, iu.unit_name
from cook_material sm
left join basic_area ba on ba.area_id = sm.area_id
left join cook_material_type smt on smt.material_type_id = sm.material_type_id
left join ims_unit iu on iu.unit_id = sm.unit_id
</sql>
<select id="selectSupermarketMaterialList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterial" resultMap="SupermarketMaterialResult">
<include refid="selectSupermarketMaterialVo"/>
<where>
goods_type = 2
<if test="areaId != null "> and sm.area_id = #{areaId}</if>
<if test="materialName != null and materialName != ''"> and sm.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and sm.material_code like concat('%', #{materialCode}, '%')</if>
<if test="imgUrl != null and imgUrl != ''"> and sm.img_url = #{imgUrl}</if>
<if test="materialTypeIds != null and materialTypeIds.length > 0">
and sm.material_type_id in
<foreach collection="materialTypeIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="barCode != null and barCode != ''"> and sm.bar_code like concat('%', #{barCode}, '%')</if>
<if test="unitId != null "> and sm.unit_id = #{unitId}</if>
<if test="salePrice != null "> and sm.sale_price = #{salePrice}</if>
<if test="unitPrice != null "> and sm.unit_price = #{unitPrice}</if>
<if test="salesMode != null "> and sm.sales_mode = #{salesMode}</if>
<if test="shelfLifeType != null "> and sm.shelf_life_type = #{shelfLifeType}</if>
<if test="shelfLifeDays != null "> and sm.shelf_life_days = #{shelfLifeDays}</if>
<if test="purPriceCeiling != null "> and sm.pur_price_ceiling = #{purPriceCeiling}</if>
<if test="bigCategoryId != null "> and sm.big_category_id = #{bigCategoryId}</if>
<if test="size != null and size != ''"> and sm.`size` = #{size}</if>
<if test="description != null and description != ''"> and sm.description = #{description}</if>
</where>
</select>
<select id="selectSupermarketMaterialByMaterialId" parameterType="Long" resultMap="SupermarketMaterialResult">
<include refid="selectSupermarketMaterialVo"/>
where goods_type = 2 and sm.material_id = #{materialId}
</select>
<insert id="insertSupermarketMaterial" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterial" useGeneratedKeys="true" keyProperty="materialId">
insert into cook_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="areaId != null">area_id,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="imgUrl != null and imgUrl != ''">img_url,</if>
<if test="materialTypeId != null">material_type_id,</if>
<if test="goodsType != null">goods_type,</if>
<if test="barCode != null">bar_code,</if>
<if test="unitId != null">unit_id,</if>
<if test="salePrice != null">sale_price,</if>
<if test="unitPrice != null">unit_price,</if>
<if test="salesMode != null">sales_mode,</if>
<if test="shelfLifeType != null">shelf_life_type,</if>
<if test="shelfLifeDays != null">shelf_life_days,</if>
<if test="purPriceCeiling != null">pur_price_ceiling,</if>
<if test="bigCategoryId != null">big_category_id,</if>
<if test="size != null">`size`,</if>
<if test="description != null">description,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="areaId != null">#{areaId},</if>
<if test="materialName != null and materialName != ''">#{materialName},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
<if test="materialTypeId != null">#{materialTypeId},</if>
<if test="goodsType != null">#{goodsType},</if>
<if test="barCode != null">#{barCode},</if>
<if test="unitId != null">#{unitId},</if>
<if test="salePrice != null">#{salePrice},</if>
<if test="unitPrice != null">#{unitPrice},</if>
<if test="salesMode != null">#{salesMode},</if>
<if test="shelfLifeType != null">#{shelfLifeType},</if>
<if test="shelfLifeDays != null">#{shelfLifeDays},</if>
<if test="purPriceCeiling != null">#{purPriceCeiling},</if>
<if test="bigCategoryId != null">#{bigCategoryId},</if>
<if test="size != null">#{size},</if>
<if test="description != null">#{description},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSupermarketMaterial" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterial">
update cook_material
<trim prefix="SET" suffixOverrides=",">
<if test="areaId != null">area_id = #{areaId},</if>
<if test="materialName != null and materialName != ''">material_name = #{materialName},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
<if test="materialTypeId != null">material_type_id = #{materialTypeId},</if>
<if test="goodsType != null">goods_type = #{goodsType},</if>
<if test="barCode != null">bar_code = #{barCode},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="salePrice != null">sale_price = #{salePrice},</if>
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
<if test="salesMode != null">sales_mode = #{salesMode},</if>
<if test="shelfLifeType != null">shelf_life_type = #{shelfLifeType},</if>
<if test="shelfLifeDays != null">shelf_life_days = #{shelfLifeDays},</if>
<if test="purPriceCeiling != null">pur_price_ceiling = #{purPriceCeiling},</if>
<if test="bigCategoryId != null">big_category_id = #{bigCategoryId},</if>
<if test="size != null">`size` = #{size},</if>
<if test="description != null">description = #{description},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where material_id = #{materialId}
</update>
<delete id="deleteSupermarketMaterialByMaterialId" parameterType="Long">
delete from cook_material where material_id = #{materialId}
</delete>
<delete id="deleteSupermarketMaterialByMaterialIds" parameterType="String">
delete from cook_material where material_id in
<foreach item="materialId" collection="array" open="(" separator="," close=")">
#{materialId}
</foreach>
</delete>
<select id="getSupermarketMaterialCountByMaterialTypes" resultType="Integer">
select count(1)
from cook_material
where material_type_id in
<foreach item="materialTypeId" collection="array" open="(" separator="," close=")">
#{materialTypeId}
</foreach>
</select>
</mapper>

View File

@ -1,106 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.supermarket.mapper.SupermarketMaterialTypeMapper">
<resultMap type="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType" id="SupermarketMaterialTypeResult">
<result property="materialTypeId" column="material_type_id" />
<result property="materialTypeName" column="material_type_name" />
<result property="parentId" column="parent_id" />
<result property="level" column="level" />
<result property="areaId" column="area_id" />
<result property="goodsType" column="goods_type" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectSupermarketMaterialTypeVo">
select material_type_id, material_type_name, parent_id, level, area_id, goods_type, create_by, create_time, update_by, update_time
from cook_material_type
</sql>
<select id="selectSupermarketMaterialTypeList" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType" resultMap="SupermarketMaterialTypeResult">
<include refid="selectSupermarketMaterialTypeVo"/>
<where>
goods_type = 2
<if test="materialTypeName != null and materialTypeName != ''"> and material_type_name like concat('%', #{materialTypeName}, '%')</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="level != null "> and level = #{level}</if>
<if test="areaId != null "> and area_id = #{areaId}</if>
</where>
</select>
<select id="selectSupermarketMaterialTypeByMaterialTypeId" parameterType="Long" resultMap="SupermarketMaterialTypeResult">
<include refid="selectSupermarketMaterialTypeVo"/>
where goods_type = 2 and material_type_id = #{materialTypeId}
</select>
<select id="selectSupermarketMaterialTypeByMaterialTypeName" resultMap="SupermarketMaterialTypeResult">
<include refid="selectSupermarketMaterialTypeVo"/>
where goods_type = 2 and material_type_name = #{materialTypeName}
</select>
<insert id="insertSupermarketMaterialType" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType" useGeneratedKeys="true" keyProperty="materialTypeId">
insert into cook_material_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialTypeName != null and materialTypeName != ''">material_type_name,</if>
<if test="parentId != null">parent_id,</if>
<if test="level != null">level,</if>
<if test="areaId != null">area_id,</if>
<if test="goodsType != null">goods_type,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialTypeName != null and materialTypeName != ''">#{materialTypeName},</if>
<if test="parentId != null">#{parentId},</if>
<if test="level != null">#{level},</if>
<if test="areaId != null">#{areaId},</if>
<if test="goodsType != null">#{goodsType},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateSupermarketMaterialType" parameterType="com.bonus.canteen.core.supermarket.domain.SupermarketMaterialType">
update cook_material_type
<trim prefix="SET" suffixOverrides=",">
<if test="materialTypeName != null and materialTypeName != ''">material_type_name = #{materialTypeName},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="level != null">level = #{level},</if>
<if test="areaId != null">area_id = #{areaId},</if>
<if test="goodsType != null">goods_type = #{goodsType},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where material_type_id = #{materialTypeId}
</update>
<delete id="deleteSupermarketMaterialTypeByMaterialTypeId" parameterType="Long">
delete from cook_material_type where material_type_id = #{materialTypeId}
</delete>
<delete id="deleteSupermarketMaterialTypeByMaterialTypeIds" parameterType="String">
delete from cook_material_type where material_type_id in
<foreach item="materialTypeId" collection="array" open="(" separator="," close=")">
#{materialTypeId}
</foreach>
</delete>
<select id="getSupermarketMaterialTypeChildCountByMaterialTypes" resultType="Integer">
select count(1)
from cook_material_type
where goods_type = 2 and parent_id in
<foreach item="materialTypeId" collection="array" open="(" separator="," close=")">
#{materialTypeId}
</foreach>
</select>
</mapper>