From 7c80ded0b2f5c039bb54f5a5c4e5cdd651b11d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=9A=93=E9=9B=AF?= <18868469283@qq.com> Date: Fri, 11 Jan 2019 10:32:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UmsPermissionController.java | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 代码库/mall-admin/src/main/java/com/sock/mall/controller/UmsPermissionController.java diff --git a/代码库/mall-admin/src/main/java/com/sock/mall/controller/UmsPermissionController.java b/代码库/mall-admin/src/main/java/com/sock/mall/controller/UmsPermissionController.java new file mode 100644 index 0000000..1a018c8 --- /dev/null +++ b/代码库/mall-admin/src/main/java/com/sock/mall/controller/UmsPermissionController.java @@ -0,0 +1,72 @@ +package com.macro.mall.controller; + +import com.macro.mall.dto.CommonResult; +import com.macro.mall.dto.UmsPermissionNode; +import com.macro.mall.model.UmsPermission; +import com.macro.mall.service.UmsPermissionService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * ̨ûȨ޹ + */ +@Controller +@Api(tags = "UmsPermissionController", description = "̨ûȨ޹") +@RequestMapping("/permission") +public class UmsPermissionController { + @Autowired + private UmsPermissionService permissionService;//Ȩ޷ + @ApiOperation("Ȩ") + @RequestMapping(value = "/create", method = RequestMethod.POST) + @ResponseBody + public Object create(@RequestBody UmsPermission permission) { + int count = permissionService.create(permission); + if(count>0){ + return new CommonResult().success(count); + } + return new CommonResult().failed(); + } + + @ApiOperation("޸Ȩ") + @RequestMapping(value = "/update/{id}", method = RequestMethod.POST) + @ResponseBody + public Object update(@PathVariable Long id, @RequestBody UmsPermission permission) { + int count = permissionService.update(id,permission); + if(count>0){ + return new CommonResult().success(count); + } + return new CommonResult().failed(); + } + + @ApiOperation("idɾȨ") + @RequestMapping(value = "/delete", method = RequestMethod.POST) + @ResponseBody + public Object delete(@RequestParam("ids") List ids) { + int count = permissionService.delete(ids); + if(count>0){ + return new CommonResult().success(count); + } + return new CommonResult().failed(); + } + + @ApiOperation("Բ㼶ṹȨ") + @RequestMapping(value = "/treeList", method = RequestMethod.GET)//㼶 + @ResponseBody + public Object treeList() { + List permissionNodeList = permissionService.treeList(); + return new CommonResult().success(permissionNodeList); + } + + @ApiOperation("ȡȨб") + @RequestMapping(value = "/list", method = RequestMethod.GET) + @ResponseBody + public Object list() { + List permissionList = permissionService.list(); + return new CommonResult().success(permissionList); + } +} \ No newline at end of file