From edf2bc6f41c9784e9cdccc9b569a7091a5a5a438 Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期五, 23 九月 2022 16:10:07 +0800 Subject: [PATCH] Merge branch 'zigonggao_dev' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ into huacheng_test --- flower_city/src/main/java/com/dg/core/controller/RoleManagementController.java | 94 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 94 insertions(+), 0 deletions(-) diff --git a/flower_city/src/main/java/com/dg/core/controller/RoleManagementController.java b/flower_city/src/main/java/com/dg/core/controller/RoleManagementController.java new file mode 100644 index 0000000..c724c8d --- /dev/null +++ b/flower_city/src/main/java/com/dg/core/controller/RoleManagementController.java @@ -0,0 +1,94 @@ +package com.dg.core.controller; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.dg.core.ResultData; +import com.dg.core.db.gen.entity.RoleManagementEntity; +import com.dg.core.service.IRoleManagementService; +import com.dg.core.util.TableDataInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Api(tags = {"角色管理接口"}) +@RestController +@RequestMapping("/role") +public class RoleManagementController extends BaseController +{ + + @Autowired + IRoleManagementService iRoleManagementService; + + /** + * 查询角色列表 + * @param pageNum + * @param pageSize + * @return + */ + @ApiOperation("查询角色列表") + @GetMapping("/getList") + public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum, + @RequestParam(value = "pageSize",required = false) Integer pageSize) + { + if(pageNum==null) + { + return getDataTable("分页不能为空"); + } + + if(pageSize==null) + { + return getDataTable("分页条数不能为空"); + } + + Page<RoleManagementEntity> pageParam = new Page<>(pageNum,pageSize); + List<RoleManagementEntity> list = iRoleManagementService.selectConfigList(pageParam,pageSize); + + int num=iRoleManagementService.countNum(); + return getDataTable(list,num); + } + + /** + * 新增角色 + * @param entity + * @return + */ + @ApiOperation("新增角色") + @PostMapping("/add") + public ResultData insertConfig(@RequestBody RoleManagementEntity entity) + { +// entity.setCreateUserId(sysUser.getUserId()+""); + return toAjax(iRoleManagementService.insertConfig(entity)); + } + + /** + * 编辑角色 + * @param entity + * @return + */ + @ApiOperation("编辑角色") + @PostMapping("/update") + public ResultData updateConfig(@RequestBody RoleManagementEntity entity) + { +// entity.setUpdateUserId(sysUser.getUserId()+""); + return toAjax(iRoleManagementService.updateConfig(entity)); + } + + /** + * 删除角色 + * @param Id + * @return + */ + @DeleteMapping("/delete") + public ResultData deleteConfigById(@RequestParam(value = "Id",required = false) String Id) + { + if(StringUtils.isEmpty(Id)) + { + return ResultData.error("Id 不能为空"); + } + return toAjax(iRoleManagementService.deleteConfigById(Id)); + } + +} -- Gitblit v1.7.1