首页>代码>微信小程序活动助手,包括nodejs后台管理系统和java后台接口>/mini-app-active-helper/03/mini-app-active-helper/src/main/java/com/core/server/controller/RoleController.java
package com.core.server.controller;

import com.core.server.entity.BaseRole;
import com.core.server.entity.dto.BaseRoleDto;
import com.core.server.entity.dto.common.PageInfoDto;
import com.core.server.entity.dto.search.BaseRoleSearchDto;
import com.core.server.system.init.AllService;
import com.core.server.system.response.RestResponse;
import com.core.server.system.security.SecurityUtil;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author :qilong sun
 * @date :Created in 2020/2/11 9:49
 * @description:角色控制器
 * @modified By:
 * @version: V1.0$
 */
@RestController
@RequestMapping(value = "/role")
public class RoleController {
    @Autowired
    AllService allService;

    /**
     * 查询所有角色
     * @return
     */
    @PostMapping(value = "/queryAllBaseRole")
    public RestResponse queryAllBaseRole(){
        BaseRoleSearchDto baseRoleSearchDto = new BaseRoleSearchDto();
        PageInfoDto pageInfoDto = baseRoleSearchDto.getPageInfoDto();
        pageInfoDto.setPageSize(50);
        pageInfoDto.setLimit(50);
        PageInfo<BaseRole> pageInfo = allService.baseRoleService.queryBaseRolePageList(baseRoleSearchDto);
        return new RestResponse(pageInfo.getList());
    }

    /**
     * 查询角色分页列表
     * @param baseRoleSearchDto
     * @return
     */
    @PostMapping(value = "/queryBaseRolePageList")
    public RestResponse<PageInfo<BaseRole>> queryBaseRolePageList(@RequestBody BaseRoleSearchDto baseRoleSearchDto){
        PageInfo<BaseRole> pageInfo = allService.baseRoleService.queryBaseRolePageList(baseRoleSearchDto);
        return new RestResponse(pageInfo);
    }

    /**
     * 删除角色
     * @param baseRoleDto
     * @return
     */
    @PostMapping(value = "/deleteBaseRole")
    public RestResponse deleteBaseRole(@RequestBody BaseRoleDto baseRoleDto){
        Integer userId = SecurityUtil.getUserId();
        Boolean result = allService.baseRoleService.deleteBaseRole(userId, baseRoleDto.getId());
        if(null != result && result){
            return new RestResponse(result);
        }else{
            return RestResponse.failure();
        }
    }

    /**
     * 保存角色
     * @param baseRoleDto
     * @return
     */
    @PostMapping(value = "/saveBaseRole")
    public RestResponse saveBaseRole(@RequestBody BaseRoleDto baseRoleDto){
        Integer userId = SecurityUtil.getUserId();
        Boolean result = allService.baseRoleService.saveBaseRole(userId, baseRoleDto);
        if(null != result && result){
            return new RestResponse(result);
        }else{
            return RestResponse.failure();
        }
    }

    /**
     * 查询角色详情
     * @param baseRoleSearchDto
     * @return
     */
    @PostMapping(value = "/queryBaseRoleDto")
    public RestResponse<BaseRoleDto> queryBaseRoleDto(@RequestBody BaseRoleSearchDto baseRoleSearchDto){
        BaseRoleDto baseRoleDto = allService.baseRoleService.queryBaseRoleDto(baseRoleSearchDto.getRoleId());
        return new RestResponse(baseRoleDto);
    }
}
最近下载更多
朤朤朤朤朤朤  LV3 4月14日
1195146710  LV4 1月16日
Lyj 329511  LV4 2023年10月11日
yinyun1985  LV14 2023年8月5日
dzlwindy  LV8 2023年7月13日
fcx2019610048  LV3 2022年12月29日
lironggang  LV38 2022年5月27日
wanglinddad  LV54 2022年2月16日
不停yayaya  LV4 2021年11月17日
peixizhu  LV16 2021年8月24日
最近浏览更多
朤朤朤朤朤朤  LV3 4月14日
可是不知道么  LV23 4月1日
最代码_码鑫源  LV6 3月28日
顾北城  LV12 3月24日
sky丶小十  LV7 3月8日
做你的景天  LV7 2月22日
yanixh  LV1 2月19日
dody02  LV9 1月31日
weiwei_2  LV2 1月30日
BestClever  LV32 1月24日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友