diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsCategoryController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsCategoryController.java index cc6ecd91..8755edb1 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsCategoryController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsCategoryController.java @@ -152,7 +152,7 @@ public class GoodsCategoryController extends BaseController { /** * 商品类别表 */ - @RequiresPermissions("goods:goods:list") +// @RequiresPermissions("goods:goods:list") @PostMapping("/list") @ResponseBody public List list(GoodsCategory category) { diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java index 46cedd5e..43462e0d 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/goods/GoodsDeptCategoryController.java @@ -2,13 +2,12 @@ package com.ghy.web.controller.goods; import com.ghy.common.core.controller.BaseController; import com.ghy.common.core.domain.Ztree; +import com.ghy.goods.domain.GoodsCategory; import com.ghy.goods.service.GoodsCategoryService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; @@ -32,11 +31,21 @@ public class GoodsDeptCategoryController extends BaseController { @RequiresPermissions("goods:deptcategory:add") - @GetMapping("/add") - public String edit(ModelMap mmap) { + @GetMapping("/add/{id}") + public String edit(@PathVariable(name = "id") Long id, ModelMap mmap) { return PREFIX + "/add"; } + /** + * 商品类别表 + */ + @RequiresPermissions("goods:goods:list") + @PostMapping("/list") + @ResponseBody + public List list(GoodsCategory category) { + return goodsCategoryService.selectGoodsCategoryList(category); + } + @GetMapping("/tree") @ResponseBody public List goodsDeptCategoryTree() { diff --git a/ghy-admin/src/main/resources/templates/goods/category/edit.html b/ghy-admin/src/main/resources/templates/goods/category/edit.html deleted file mode 100644 index 93d6466c..00000000 --- a/ghy-admin/src/main/resources/templates/goods/category/edit.html +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - -
-
- - -
- -
-
- - -
-
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
-
- - -
-
-
-
-
- - - - diff --git a/ghy-admin/src/main/resources/templates/goods/deptcategory/add.html b/ghy-admin/src/main/resources/templates/goods/deptcategory/add.html index 697b2635..c6bbd8a8 100644 --- a/ghy-admin/src/main/resources/templates/goods/deptcategory/add.html +++ b/ghy-admin/src/main/resources/templates/goods/deptcategory/add.html @@ -1,14 +1,13 @@ - +
-
+
-
@@ -34,9 +33,33 @@ }; $.tree.init(options); }); - - function edit() { - var menuIds = $.tree.getCheckedNodes(); + + $('input').on('ifChanged', function(obj){ + var type = $(this).val(); + var checked = obj.currentTarget.checked; + if (type == 1) { + if (checked) { + $._tree.expandAll(true); + } else { + $._tree.expandAll(false); + } + } else if (type == "2") { + if (checked) { + $._tree.checkAllNodes(true); + } else { + $._tree.checkAllNodes(false); + } + } else if (type == "3") { + if (checked) { + $._tree.setting.check.chkboxType = { "Y": "ps", "N": "ps" }; + } else { + $._tree.setting.check.chkboxType = { "Y": "", "N": "" }; + } + } + }) + + function add() { + var menuIds = $.tree.getCheckedNodes("goodsCategoryId"); $.ajax({ cache : true, type : "POST", diff --git a/ghy-admin/src/main/resources/templates/goods/deptcategory/deptcategory.html b/ghy-admin/src/main/resources/templates/goods/deptcategory/deptcategory.html index fd93b16b..f5ddcb58 100644 --- a/ghy-admin/src/main/resources/templates/goods/deptcategory/deptcategory.html +++ b/ghy-admin/src/main/resources/templates/goods/deptcategory/deptcategory.html @@ -32,7 +32,7 @@
- + 修改 @@ -50,7 +50,7 @@ var editFlag = [[${@permission.hasPermi('goods:category:edit')}]]; var removeFlag = [[${@permission.hasPermi('goods:category:remove')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]]; - var prefix = ctx + "goods/category" + var prefix = ctx + "goods/deptcategory" $(function() { var options = { @@ -58,6 +58,7 @@ parentCode: "parentCategoryId", uniqueId: "goodsCategoryId", url: prefix + "/list", + addUrl: prefix + "/add/{id}", createUrl: prefix + "/add/{id}", updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove/{id}", diff --git a/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java b/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java index 29dd6dd8..cad7ed66 100644 --- a/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java +++ b/ghy-framework/src/main/java/com/ghy/framework/config/ShiroConfig.java @@ -278,6 +278,7 @@ public class ShiroConfig //部分接口不需要登陆校验 filterChainDefinitionMap.put("/wx/**", "anon"); filterChainDefinitionMap.put("/pay/**", "anon"); + filterChainDefinitionMap.put("/goods/**", "anon"); filterChainDefinitionMap.put("/adapay/**", "anon"); filterChainDefinitionMap.put("/MP_verify_bRFuvYpyQ4WLr0on.txt", "anon"); // 对静态资源设置匿名访问 diff --git a/ghy-goods/src/main/java/com/ghy/goods/service/impl/GoodsCategoryServiceImpl.java b/ghy-goods/src/main/java/com/ghy/goods/service/impl/GoodsCategoryServiceImpl.java index 875b9898..ae939fbe 100644 --- a/ghy-goods/src/main/java/com/ghy/goods/service/impl/GoodsCategoryServiceImpl.java +++ b/ghy-goods/src/main/java/com/ghy/goods/service/impl/GoodsCategoryServiceImpl.java @@ -114,6 +114,7 @@ public class GoodsCategoryServiceImpl implements GoodsCategoryService { ztree.setpId(goodsCategory.getParentCategoryId()); ztree.setName(goodsCategory.getGoodsCategoryName()); ztree.setTitle(goodsCategory.getGoodsCategoryName()); + ztrees.add(ztree); } }