diff --git a/sql/ruoyi-vue-pro.sql b/sql/ruoyi-vue-pro.sql index cee359d62..1276115db 100644 --- a/sql/ruoyi-vue-pro.sql +++ b/sql/ruoyi-vue-pro.sql @@ -2430,8 +2430,10 @@ CREATE TABLE `system_user_post` ( `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', PRIMARY KEY (`id`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='部门表'; - +) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户岗位表'; +insert into system_user_post (user_id, post_id, creator, create_time, updater, update_time, deleted, tenant_id) value (1,1,'admin',current_timestamp,'admin',current_timestamp,false,1); +insert into system_user_post (user_id, post_id, creator, create_time, updater, update_time, deleted, tenant_id) value (100,1,'admin',current_timestamp,'admin',current_timestamp,false,1); +insert into system_user_post (user_id, post_id, creator, create_time, updater, update_time, deleted, tenant_id) value (114,3,'admin',current_timestamp,'admin',current_timestamp,false,1); -- ---------------------------- -- Table structure for system_dept diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java index f91ce2ef6..cf8112485 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/UserPostMapper.java @@ -14,18 +14,16 @@ public interface UserPostMapper extends BaseMapperX { default List selectIdList(Long id) { return selectList(new LambdaQueryWrapperX() - .eq(UserPostDO::getUserId, id) - .select(UserPostDO::getPostId)); - + .eq(UserPostDO::getUserId, id)); } - default void deleteByUserIdAndPostId(Long userId, Collection deletePostIds) { + default void deleteByUserIdAndPostId(Long userId, Collection postIds) { delete(new LambdaQueryWrapperX() .eq(UserPostDO::getUserId, userId) - .in(UserPostDO::getPostId, deletePostIds)); + .in(UserPostDO::getPostId, postIds)); } - default List selectUserIdByPostIds(Collection postIds) { + default List selectListByPostIds(Collection postIds) { return selectList(new LambdaQueryWrapperX() .in(UserPostDO::getPostId, postIds)); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index 5be5ff16f..b90d5cf73 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -27,7 +27,6 @@ import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.tenant.TenantService; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -266,7 +265,7 @@ public class AdminUserServiceImpl implements AdminUserService { if (CollUtil.isEmpty(postIds)) { return Collections.emptyList(); } - List userIdList = userPostMapper.selectUserIdByPostIds(postIds) + List userIdList = userPostMapper.selectListByPostIds(postIds) .stream() .map(UserPostDO::getUserId) .distinct() diff --git a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql index cef6b1424..a3097b3ec 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql +++ b/yudao-module-system/yudao-module-system-impl/src/test/resources/sql/create_tables.sql @@ -156,7 +156,7 @@ CREATE TABLE IF NOT EXISTS `system_user_post`( "deleted" bit NOT NULL DEFAULT FALSE, "tenant_id" bigint not null default '0', PRIMARY KEY (`id`) -) COMMENT ='部门表'; +) COMMENT ='用户岗位表'; CREATE TABLE IF NOT EXISTS "system_notice" (