Explorar el Código

Merge remote-tracking branch 'origin/dev' into dev

lazhaoqian hace 4 años
padre
commit
1c0b5c0f45
Se han modificado 14 ficheros con 644 adiciones y 0 borrados
  1. 34 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/dto/MessageDTO.java
  2. 109 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/Message.java
  3. 36 0
      blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/MessageVO.java
  4. 15 0
      blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java
  5. 4 0
      blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java
  6. 126 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/controller/MessageController.java
  7. 44 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/mapper/MessageMapper.java
  8. 27 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/mapper/MessageMapper.xml
  9. 46 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/service/IMessageService.java
  10. 118 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/service/impl/MessageServiceImpl.java
  11. 16 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/socket/MessageSocket.java
  12. 22 0
      blade-service/blade-client/src/main/java/org/springblade/client/message/until/MessageTool.java
  13. 35 0
      blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java
  14. 12 0
      blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

+ 34 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/dto/MessageDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.dto;
+
+import org.springblade.client.entity.Message;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MessageDTO extends Message {
+	private static final long serialVersionUID = 1L;
+
+}

+ 109 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/entity/Message.java

@@ -0,0 +1,109 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.entity;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+@Data
+@TableName("blade_message")
+@ApiModel(value = "Message对象", description = "Message对象")
+public class Message implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+    @TableId
+	private Long id;
+	/**
+	* 发起人id
+	*/
+		@ApiModelProperty(value = "发起人id")
+		private Long userId;
+	/**
+	* 发起人名称
+	*/
+		@ApiModelProperty(value = "发起人名称")
+		private String userName;
+	/**
+	* 接收者id
+	*/
+		@ApiModelProperty(value = "接收者id")
+		private Long toUserId;
+	/**
+	* 接收者名称
+	*/
+		@ApiModelProperty(value = "接收者名称")
+		private String toUserName;
+	/**
+	* 消息类型 : 1.普通消息 2.系统消息
+	*/
+		@ApiModelProperty(value = "消息类型 : 1.普通消息 2.系统消息")
+		private Integer messageType;
+	/**
+	* 消息体: 可以为字符串, 可以是json串
+	*/
+		@ApiModelProperty(value = "消息体: 可以为字符串, 可以是json串")
+		private String messageBody;
+	/**
+	* 接收者是否已读: 0 未读 1已读
+	*/
+		@ApiModelProperty(value = "接收者是否已读: 0 未读 1已读")
+		private Integer isRead;
+	/**
+	* 创建人
+	*/
+		@ApiModelProperty(value = "创建人")
+		private Long createUser;
+	/**
+	* 创建部门
+	*/
+		@ApiModelProperty(value = "创建部门")
+		private Long createDept;
+	/**
+	* 创建时间
+	*/
+		@ApiModelProperty(value = "创建时间")
+		private Date createTime;
+	/**
+	* 修改人
+	*/
+		@ApiModelProperty(value = "修改人")
+		private Long updateUser;
+	/**
+	* 是否已删除(0 否 1是)
+	*/
+		@ApiModelProperty(value = "是否已删除(0 否 1是)")
+		private Integer isDeleted;
+
+		@ApiModelProperty(value = "租户id")
+		private String tenantId;
+
+
+}

+ 36 - 0
blade-service-api/blade-client-api/src/main/java/org/springblade/client/vo/MessageVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.vo;
+
+import org.springblade.client.entity.Message;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "MessageVO对象", description = "MessageVO对象")
+public class MessageVO extends Message {
+	private static final long serialVersionUID = 1L;
+
+}

+ 15 - 0
blade-service-api/blade-system-api/src/main/java/org/springblade/system/feign/ISysClient.java

@@ -60,6 +60,21 @@ public interface ISysClient {
 	String PARAM = API_PREFIX + "/param";
 	String PARAM_VALUE = API_PREFIX + "/param-value";
 	String REGION = API_PREFIX + "/region";
+	String LIST_ROLE_ALIAS=API_PREFIX+"/listRoleAlias";
+	String GET_ROLE_ID_BY_ALIAS=API_PREFIX+"/getRoleByAlias";
+
+	/**
+	 * 通过租户id获取全部租户别名
+	 * */
+     @GetMapping(LIST_ROLE_ALIAS)
+	 R<List<Role>> listRoleAlias();
+
+	/**
+	 * 通过角色别名获
+	 * */
+	@GetMapping(GET_ROLE_ID_BY_ALIAS)
+	R<Long> getRoleByAlias(String alias);
+
 
 	/**
 	 * 获取菜单

+ 4 - 0
blade-service-api/blade-user-api/src/main/java/org/springblade/system/user/feign/IUserClient.java

@@ -51,6 +51,10 @@ public interface IUserClient {
 	String REMOVE_USER = API_PREFIX + "/remove-user";
 	String GAIN_USER = API_PREFIX + "/gainUser";
 	String USER_INFO_BY_NAME=API_PREFIX+"/user-info-by-name";
+	String LIST_USER_BY_ROLE_ID=API_PREFIX+"/listUserByRoleId";
+
+	@GetMapping(LIST_USER_BY_ROLE_ID)
+	R<List<User>> listUserByRoleId(@RequestParam("roleId")Long roleId);
 
 	/**
 	 * 获取用户信息

+ 126 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/controller/MessageController.java

@@ -0,0 +1,126 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.message.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.client.entity.Message;
+import org.springblade.client.message.service.IMessageService;
+import org.springblade.client.vo.MessageVO;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/message")
+@Api(value = "", tags = "接口")
+public class MessageController extends BladeController {
+
+	private final IMessageService messageService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入message")
+	public R<Message> detail(Message message) {
+		Message detail = messageService.getOne(Condition.getQueryWrapper(message));
+		return R.data(detail);
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入message")
+	public R<IPage<Message>> list(Message message, Query query) {
+		IPage<Message> pages = messageService.page(Condition.getPage(query), Condition.getQueryWrapper(message));
+		return R.data(pages);
+	}
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入message")
+	public R<IPage<MessageVO>> page(MessageVO message, Query query) {
+		IPage<MessageVO> pages = messageService.selectMessagePage(Condition.getPage(query), message);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入message")
+	public R save(@Valid @RequestBody Message message) {
+		return R.status(messageService.save(message));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入message")
+	public R update(@Valid @RequestBody Message message) {
+		return R.status(messageService.updateById(message));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入message")
+	public R submit(@Valid @RequestBody Message message) {
+		return R.status(messageService.saveOrUpdate(message));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 8)
+	@ApiOperation(value = "删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(messageService.removeByIds(Func.toLongList(ids)));
+	}
+
+
+}

+ 44 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/mapper/MessageMapper.java

@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.message.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.client.entity.Message;
+import org.springblade.client.vo.MessageVO;
+
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+public interface MessageMapper extends BaseMapper<Message> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param message
+	 * @return
+	 */
+	List<MessageVO> selectMessagePage(IPage page, MessageVO message);
+
+}

+ 27 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/mapper/MessageMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.srpingblade.client.mapper.MessageMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="messageResultMap" type="org.srpingblade.client.entity.Message">
+        <id column="id" property="id"/>
+        <result column="user_id" property="userId"/>
+        <result column="user_name" property="userName"/>
+        <result column="to_user_id" property="toUserId"/>
+        <result column="to_user_name" property="toUserName"/>
+        <result column="message_type" property="messageType"/>
+        <result column="message_body" property="messageBody"/>
+        <result column="is_read" property="isRead"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="is_deleted" property="isDeleted"/>
+    </resultMap>
+
+
+    <select id="selectMessagePage" resultMap="messageResultMap">
+        select * from blade_message where is_deleted = 0
+    </select>
+
+</mapper>

+ 46 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/service/IMessageService.java

@@ -0,0 +1,46 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.message.service;
+
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.client.entity.Message;
+import org.springblade.client.vo.MessageVO;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+public interface IMessageService extends IService<Message> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param message
+	 * @return
+	 */
+	IPage<MessageVO> selectMessagePage(IPage<MessageVO> page, MessageVO message);
+
+	//通过用户id推送
+	void pushByUserId(Long userId,String Message,Integer MessageType);
+	//通过用户角色推送
+	void pushByUserRole(String role,String Message,Integer MessageType);
+}

+ 118 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/service/impl/MessageServiceImpl.java

@@ -0,0 +1,118 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.client.message.service.impl;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.client.entity.Message;
+import org.springblade.client.message.mapper.MessageMapper;
+import org.springblade.client.message.service.IMessageService;
+import org.springblade.client.vo.MessageVO;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
+import org.springblade.system.feign.ISysClient;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-12-20
+ */
+@Service
+@AllArgsConstructor
+public class MessageServiceImpl extends ServiceImpl<MessageMapper, Message> implements IMessageService
+{
+	private final IUserClient userClient;
+
+	private final ISysClient sysClient;
+
+	@Override
+	public IPage<MessageVO> selectMessagePage(IPage<MessageVO> page, MessageVO message) {
+		return page.setRecords(baseMapper.selectMessagePage(page, message));
+	}
+
+	@Override
+	public void pushByUserId(Long userId, String Message, Integer MessageType)
+	{
+		Message message=new Message();
+		message.setUserId(AuthUtil.getUserId());
+		message.setUserName(AuthUtil.getUserName());
+		message.setToUserId(userId);
+		message.setMessageType(MessageType);
+		message.setMessageBody(Message);
+		message.setIsRead(0);
+		message.setTenantId(AuthUtil.getTenantId());
+		message.setCreateUser(AuthUtil.getUserId());
+		message.setCreateTime(new Date());
+		message.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+		baseMapper.insert(message);
+	}
+
+	@Override
+	@Transactional
+	public void pushByUserRole(String roleAlias, String Message, Integer MessageType)
+	{
+		//查询角色别名对应的角色id
+		R<Long> roleByAlias = sysClient.getRoleByAlias(roleAlias);
+		if(!roleByAlias.isSuccess())
+		{
+			throw new SecurityException("查询角色信息错误");
+		}
+		//角色id
+		Long roleId = roleByAlias.getData();
+        //查询此角色下全部用户
+		R<List<User>> listR = userClient.listUserByRoleId(roleId);
+		if(!listR.isSuccess())
+		{
+			throw new SecurityException("查询用户列表信息错误");
+		}
+		//查询符合条件的全部用户
+		List<Long> userIds = listR.getData().stream().map(User::getId).collect(Collectors.toList());
+		if(!CollectionUtils.isNotEmpty(userIds))
+		{
+			throw new SecurityException("查询用户id集合信息错误");
+		}
+		//开始推送相关人员
+		userIds.forEach(e->{
+			Message message=new Message();
+			message.setUserId(AuthUtil.getUserId());
+			message.setUserName(AuthUtil.getUserName());
+			message.setToUserId(e);
+			message.setMessageType(MessageType);
+			message.setMessageBody(Message);
+			message.setIsRead(0);
+			message.setTenantId(AuthUtil.getTenantId());
+			message.setCreateUser(AuthUtil.getUserId());
+			message.setCreateTime(new Date());
+			message.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
+			baseMapper.insert(message);
+		});
+
+
+
+	}
+
+}

+ 16 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/socket/MessageSocket.java

@@ -0,0 +1,16 @@
+package org.springblade.client.message.socket;
+
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/socket/message")
+@Api(value = "消息socket接口", tags = "消息socket接口")
+public class MessageSocket
+{
+
+}

+ 22 - 0
blade-service/blade-client/src/main/java/org/springblade/client/message/until/MessageTool.java

@@ -0,0 +1,22 @@
+package org.springblade.client.message.until;
+
+import lombok.AllArgsConstructor;
+import org.springblade.client.message.service.IMessageService;
+import org.springframework.stereotype.Component;
+
+/**
+ * 消息工具类
+ * */
+@Component
+@AllArgsConstructor
+public class MessageTool
+{
+    private final IMessageService messageService;
+
+	//指定人推送消息
+
+	//推动角色推送消息
+
+
+
+}

+ 35 - 0
blade-service/blade-system/src/main/java/org/springblade/system/feign/SysClient.java

@@ -16,7 +16,9 @@
  */
 package org.springblade.system.feign;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
 import org.springblade.system.entity.*;
@@ -53,6 +55,39 @@ public class SysClient implements ISysClient {
 	private final IRegionService regionService;
 
 	@Override
+	@GetMapping(LIST_ROLE_ALIAS)
+	public R<List<Role>> listRoleAlias()
+	{
+		LambdaQueryWrapper<Role> roleLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		roleLambdaQueryWrapper
+			.eq(Role::getIsDeleted,0)
+			.eq(Role::getTenantId, AuthUtil.getTenantId());
+		List<Role> roleList = roleService.list(roleLambdaQueryWrapper);
+		return R.data(roleList);
+	}
+
+	@Override
+	@GetMapping(GET_ROLE_ID_BY_ALIAS)
+	public R<Long> getRoleByAlias(String alias)
+	{
+		try {
+			LambdaQueryWrapper<Role> roleLambdaQueryWrapper=new LambdaQueryWrapper<>();
+			roleLambdaQueryWrapper
+				.eq(Role::getRoleAlias,alias)
+				.eq(Role::getIsDeleted,0)
+				.eq(Role::getTenantId,AuthUtil.getTenantId());
+			Role role = roleService.getOne(roleLambdaQueryWrapper);
+			if(role == null)
+			{
+				throw new SecurityException("暂未查到符合的角色");
+			}
+			return  R.data(role.getId());
+		} catch (Exception e) {
+			throw new SecurityException("查询角色错误:"+e.getMessage());
+		}
+	}
+
+	@Override
 	@GetMapping(MENU)
 	public R<Menu> getMenu(Long id) {
 		return R.data(menuService.getById(id));

+ 12 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/feign/UserClient.java

@@ -19,6 +19,7 @@ package org.springblade.system.user.feign;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.AllArgsConstructor;
+import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tenant.annotation.NonDS;
 import org.springblade.core.tool.api.R;
@@ -49,6 +50,17 @@ public class UserClient implements IUserClient {
 	private final IUserService service;
 
 	@Override
+	@GetMapping(LIST_USER_BY_ROLE_ID)
+	public R<List<User>> listUserByRoleId(Long roleId) {
+		LambdaQueryWrapper<User> userLambdaQueryWrapper=new LambdaQueryWrapper<>();
+		userLambdaQueryWrapper
+			.eq(User::getIsDeleted,0)
+			.eq(User::getRoleId,roleId)
+			.eq(User::getTenantId, AuthUtil.getTenantId());
+		return R.data(service.list(userLambdaQueryWrapper));
+	}
+
+	@Override
 	@GetMapping(USER_INFO_BY_NAME)
 	public List<User> userInfoByName(String userName,String tenantId)
 	{