|  |  |  | 
|---|
|  |  |  | package com.matrix.system.hive.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.matrix.core.exception.GlobleException; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.system.common.bean.SysUsers; | 
|---|
|  |  |  | import com.matrix.system.hive.action.util.QueryUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult addOrModify(ShoppingGoodsCategory shoppingGoodsCategory) { | 
|---|
|  |  |  | if (shoppingGoodsCategory.getId() != null) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 自己不能是自己的父节点 | 
|---|
|  |  |  | if (shoppingGoodsCategory.getParentId() != null && shoppingGoodsCategory.getParentId().equals(shoppingGoodsCategory.getId())) { | 
|---|
|  |  |  | throw new GlobleException("父级不能是自己"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return modify(goodsCategoryService, shoppingGoodsCategory, "商品类型"); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestMapping(value = "/all") | 
|---|
|  |  |  | public @ResponseBody | 
|---|
|  |  |  | AjaxResult all(ShoppingGoodsCategory shoppingGoodsCategory) { | 
|---|
|  |  |  | SysUsers user = getMe(); | 
|---|
|  |  |  | if(shoppingGoodsCategory.getShopId()==null){ | 
|---|
|  |  |  | shoppingGoodsCategory.setShopId(user.getShopId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | shoppingGoodsCategory.setCompanyId(user.getCompanyId()); | 
|---|
|  |  |  | //        SysUsers user = getMe(); | 
|---|
|  |  |  | //        if(shoppingGoodsCategory.getShopId()==null){ | 
|---|
|  |  |  | //            shoppingGoodsCategory.setShopId(user.getShopId()); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        shoppingGoodsCategory.setCompanyId(user.getCompanyId()); | 
|---|
|  |  |  | SysShopInfo zbShop = shopInfoDao.selectZbShop(getMe().getCompanyId()); | 
|---|
|  |  |  | shoppingGoodsCategory.setShopId(zbShop.getId()); | 
|---|
|  |  |  | QueryUtil.setQueryLimitCom(shoppingGoodsCategory); | 
|---|
|  |  |  | return new AjaxResult(AjaxResult.STATUS_SUCCESS, goodsCategoryService.findByModel(shoppingGoodsCategory), 0); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|