Browse Source

1.经销商人员信息模块接口逻辑修改

纪新园 1 week ago
parent
commit
1c4a971549

+ 9 - 0
blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.java

@@ -35,6 +35,15 @@ public interface RoleMapper extends BaseMapper<Role> {
 	List<RoleVO> tree(String tenantId, String excludeRole);
 
 	/**
+	 * 获取树形节点-经销商
+	 *
+	 * @param tenantId
+	 * @param parentId
+	 * @return
+	 */
+	List<RoleVO> treeDealer(String tenantId, Long parentId);
+
+	/**
 	 * 获取角色名
 	 *
 	 * @param ids

+ 10 - 0
blade-service/blade-system/src/main/java/org/springblade/system/mapper/RoleMapper.xml

@@ -36,6 +36,16 @@
         </if>
     </select>
 
+    <select id="treeDealer" resultMap="treeNodeResultMap">
+        select id, parent_id, role_name as title, id as "value", id as "key" from blade_role where is_deleted = 0
+        <if test="param1!=null">
+            and tenant_id = #{param1}
+        </if>
+        <if test="param2!=null">
+            and parent_id = #{param2}
+        </if>
+    </select>
+
     <select id="getRoleNames" resultType="java.lang.String">
         SELECT
         role_name

+ 13 - 5
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/RoleServiceImpl.java

@@ -59,12 +59,20 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
 
 	@Override
 	public List<RoleVO> tree(String tenantId) {
-		String userRole = AuthUtil.getUserRole();
-		String excludeRole = null;
-		if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMIN) && !CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMINISTRATOR)) {
-			excludeRole = RoleConstant.ADMINISTRATOR;
+		if (AuthUtil.getUserRole().contains("dealer")) {
+			Role role = baseMapper.selectOne(new LambdaQueryWrapper<Role>()
+				.eq(Role::getTenantId,tenantId)
+				.eq(Role::getIsDeleted,0)
+				.eq(Role::getRoleAlias,"dealer"));
+			return ForestNodeMerger.merge(baseMapper.treeDealer(tenantId, role.getId()));
+		}else{
+			String userRole = AuthUtil.getUserRole();
+			String excludeRole = null;
+			if (!CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMIN) && !CollectionUtil.contains(Func.toStrArray(userRole), RoleConstant.ADMINISTRATOR)) {
+				excludeRole = RoleConstant.ADMINISTRATOR;
+			}
+			return ForestNodeMerger.merge(baseMapper.tree(tenantId, excludeRole));
 		}
-		return ForestNodeMerger.merge(baseMapper.tree(tenantId, excludeRole));
 	}
 
 	@Override

+ 3 - 0
blade-service/blade-user/src/main/java/org/springblade/system/user/service/impl/UserServiceImpl.java

@@ -62,6 +62,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, User> implement
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	public boolean submit(User user) {
+		if (AuthUtil.getUserRole().contains("dealer")) {
+			user.setDeptId(AuthUtil.getDeptId());
+		}
 		if (ObjectUtils.isNotNull(user.getDeptId())) {
 			user.setDeptPid(selectTopId(user.getDeptId()));
 		}