diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java index 897aeb55..37b380f2 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsController.java @@ -1,14 +1,12 @@ package com.ghy.web.controller.goods; import com.ghy.common.annotation.Log; -import com.ghy.common.constant.UserConstants; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.AjaxResult; import com.ghy.common.core.page.TableDataInfo; import com.ghy.common.enums.BusinessType; import com.ghy.common.utils.ShiroUtils; import com.ghy.common.utils.poi.ExcelUtil; -import com.ghy.goods.domain.DeptGoodsCategory; import com.ghy.goods.domain.Goods; import com.ghy.goods.service.DeptGoodsCategoryService; import com.ghy.goods.service.GoodsService; @@ -87,11 +85,6 @@ public class GoodsController extends BaseController { @PostMapping("/add") @ResponseBody public AjaxResult addSave(@Validated Goods goods) { - if (UserConstants.GOODS_CODE_NOT_UNIQUE.equals(goodsService.checkGoodsNameUnique(goods))) { - return error("新增商品'" + goods.getGoodsName() + "'失败,商品名称已存在"); - } else if (UserConstants.GOODS_CODE_NOT_UNIQUE.equals(goodsService.checkGoodsCodeUnique(goods))) { - return error("新增商品'" + goods.getGoodsName() + "'失败,商品编码已存在"); - } goods.setCreateBy(getLoginName()); goods.setDeptId(getSysUser().getDeptId()); return toAjax(goodsService.insertGoods(goods)); @@ -103,6 +96,8 @@ public class GoodsController extends BaseController { @RequiresPermissions("goods:goods:edit") @GetMapping("/edit/{goodsId}") public String edit(@PathVariable("goodsId") Long goodsId, ModelMap mmap) { + Long parentId = ShiroUtils.getSysUser().getParentId(); + mmap.put("deptGoodsCategories", deptGoodsCategoryService.list(parentId)); mmap.put("goods", goodsService.selectById(goodsId)); return PREFIX + "/edit"; } @@ -115,11 +110,6 @@ public class GoodsController extends BaseController { @PostMapping("/edit") @ResponseBody public AjaxResult editSave(@Validated Goods goods) { - if (UserConstants.GOODS_NAME_NOT_UNIQUE.equals(goodsService.checkGoodsNameUnique(goods))) { - return error("修改商品'" + goods.getGoodsName() + "'失败,商品名称已存在"); - } else if (UserConstants.GOODS_CODE_NOT_UNIQUE.equals(goodsService.checkGoodsCodeUnique(goods))) { - return error("修改商品'" + goods.getGoodsCode() + "'失败,商品编码已存在"); - } goods.setUpdateBy(getLoginName()); return toAjax(goodsService.updateGoods(goods)); } diff --git a/ghy-admin/src/main/resources/templates/goods/goods/add.html b/ghy-admin/src/main/resources/templates/goods/goods/add.html index 47164469..c6d3feb7 100644 --- a/ghy-admin/src/main/resources/templates/goods/goods/add.html +++ b/ghy-admin/src/main/resources/templates/goods/goods/add.html @@ -1,126 +1,124 @@ - +
-