forked from gzzfw/backEnd/gz-dyh

liyj
2024-09-10 47fa44a60a9dffee1e122a72b61badc36726b300
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java
@@ -2,8 +2,14 @@
import cn.huge.base.common.utils.ReturnFailUtils;
import cn.huge.base.common.utils.ReturnSucUtils;
import cn.huge.base.config.CurrentUser;
import cn.huge.module.ctrole.domain.bo.CtRoleBO;
import cn.huge.module.ctrole.domain.po.CtRole;
import cn.huge.module.ctrole.service.CtRoleService;
import cn.huge.module.ctrole.service.CtRolefunService;
import cn.huge.module.ctuser.service.CtUserService;
import cn.huge.module.rsoper.domain.dto.RsRoleDTO;
import cn.huge.module.rsoper.service.RsRoleService;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -26,7 +32,7 @@
 */
@Slf4j
@RestController
@RequestMapping("/api/web/cRole")
@RequestMapping("/api/web/ctRole")
public class CtRoleWebController {
    @Autowired(required = false)
@@ -34,6 +40,10 @@
    @Autowired
    private CtRoleService service;
    @Autowired
    private CtUserService ctUserService;
    @Autowired
    private RsRoleService rsRoleService;
    /**
    * 获取请求URL参数
@@ -66,7 +76,7 @@
        if (StringUtils.isNotBlank(roleType)){
            terms.put("roleType", roleType);
        }
        // 删除状态,0:已删除,1:未删除
        // 删除状态,0:未删除,1:已删除
        String deleteStatus = request.getParameter("deleteStatus");
        if (StringUtils.isNotBlank(deleteStatus)){
            terms.put("deleteStatus", deleteStatus);
@@ -129,21 +139,6 @@
    }
    /**
    * 根据编号查询单个
    * @url {ctx}/api/web/cRole/getById
    * @param id 主键编号
    * @return Object
    */
    @GetMapping("/getById")
    public Object getById(@RequestParam(value = "id") String id) {
        try {
            return ReturnSucUtils.getRepInfo(service.getById(id));
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
    * 根据主键单个
    * @url {ctx}/api/web/cRole/deleteById
    * @param id 主键编号
@@ -175,4 +170,21 @@
        }
    }
    /**
     * 根据编号查询单个角色下属权限
     * @url {ctx}/api/web/ctRole/getById
     * @param id 主键编号
     * @return Object
     * @throws Exception
     */
    @GetMapping("/getById")
    public Object getById(@RequestParam(value = "id") String id, @CurrentUser String userId) {
        try {
            RsRoleDTO rsRoleDTO = rsRoleService.webGetRoleMenu(id, userId);
            return ReturnSucUtils.getRepInfo(rsRoleDTO);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
}