Commit 17167c24d17647c0facb070b3cc741a34629ab43
1 parent
47447ded
code review 编码规范统一
Showing
4 changed files
with
10 additions
and
11 deletions
sql/ruoyi-vue-pro.sql
| @@ -2430,8 +2430,10 @@ CREATE TABLE `system_user_post` ( | @@ -2430,8 +2430,10 @@ CREATE TABLE `system_user_post` ( | ||
| 2430 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', | 2430 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 2431 | `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', | 2431 | `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', |
| 2432 | PRIMARY KEY (`id`) USING BTREE | 2432 | PRIMARY KEY (`id`) USING BTREE |
| 2433 | -) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='部门表'; | ||
| 2434 | - | 2433 | +) ENGINE=InnoDB AUTO_INCREMENT=112 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户岗位表'; |
| 2434 | +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); | ||
| 2435 | +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); | ||
| 2436 | +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); | ||
| 2435 | 2437 | ||
| 2436 | -- ---------------------------- | 2438 | -- ---------------------------- |
| 2437 | -- Table structure for system_dept | 2439 | -- Table structure for system_dept |
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<UserPostDO> { | @@ -14,18 +14,16 @@ public interface UserPostMapper extends BaseMapperX<UserPostDO> { | ||
| 14 | 14 | ||
| 15 | default List<UserPostDO> selectIdList(Long id) { | 15 | default List<UserPostDO> selectIdList(Long id) { |
| 16 | return selectList(new LambdaQueryWrapperX<UserPostDO>() | 16 | return selectList(new LambdaQueryWrapperX<UserPostDO>() |
| 17 | - .eq(UserPostDO::getUserId, id) | ||
| 18 | - .select(UserPostDO::getPostId)); | ||
| 19 | - | 17 | + .eq(UserPostDO::getUserId, id)); |
| 20 | } | 18 | } |
| 21 | 19 | ||
| 22 | - default void deleteByUserIdAndPostId(Long userId, Collection<Long> deletePostIds) { | 20 | + default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) { |
| 23 | delete(new LambdaQueryWrapperX<UserPostDO>() | 21 | delete(new LambdaQueryWrapperX<UserPostDO>() |
| 24 | .eq(UserPostDO::getUserId, userId) | 22 | .eq(UserPostDO::getUserId, userId) |
| 25 | - .in(UserPostDO::getPostId, deletePostIds)); | 23 | + .in(UserPostDO::getPostId, postIds)); |
| 26 | } | 24 | } |
| 27 | 25 | ||
| 28 | - default List<UserPostDO> selectUserIdByPostIds(Collection<Long> postIds) { | 26 | + default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) { |
| 29 | return selectList(new LambdaQueryWrapperX<UserPostDO>() | 27 | return selectList(new LambdaQueryWrapperX<UserPostDO>() |
| 30 | .in(UserPostDO::getPostId, postIds)); | 28 | .in(UserPostDO::getPostId, postIds)); |
| 31 | } | 29 | } |
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; | @@ -27,7 +27,6 @@ import cn.iocoder.yudao.module.system.service.dept.DeptService; | ||
| 27 | import cn.iocoder.yudao.module.system.service.dept.PostService; | 27 | import cn.iocoder.yudao.module.system.service.dept.PostService; |
| 28 | import cn.iocoder.yudao.module.system.service.permission.PermissionService; | 28 | import cn.iocoder.yudao.module.system.service.permission.PermissionService; |
| 29 | import cn.iocoder.yudao.module.system.service.tenant.TenantService; | 29 | import cn.iocoder.yudao.module.system.service.tenant.TenantService; |
| 30 | -import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||
| 31 | import com.google.common.annotations.VisibleForTesting; | 30 | import com.google.common.annotations.VisibleForTesting; |
| 32 | import lombok.extern.slf4j.Slf4j; | 31 | import lombok.extern.slf4j.Slf4j; |
| 33 | import org.springframework.beans.factory.annotation.Value; | 32 | import org.springframework.beans.factory.annotation.Value; |
| @@ -266,7 +265,7 @@ public class AdminUserServiceImpl implements AdminUserService { | @@ -266,7 +265,7 @@ public class AdminUserServiceImpl implements AdminUserService { | ||
| 266 | if (CollUtil.isEmpty(postIds)) { | 265 | if (CollUtil.isEmpty(postIds)) { |
| 267 | return Collections.emptyList(); | 266 | return Collections.emptyList(); |
| 268 | } | 267 | } |
| 269 | - List<Long> userIdList = userPostMapper.selectUserIdByPostIds(postIds) | 268 | + List<Long> userIdList = userPostMapper.selectListByPostIds(postIds) |
| 270 | .stream() | 269 | .stream() |
| 271 | .map(UserPostDO::getUserId) | 270 | .map(UserPostDO::getUserId) |
| 272 | .distinct() | 271 | .distinct() |
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`( | @@ -156,7 +156,7 @@ CREATE TABLE IF NOT EXISTS `system_user_post`( | ||
| 156 | "deleted" bit NOT NULL DEFAULT FALSE, | 156 | "deleted" bit NOT NULL DEFAULT FALSE, |
| 157 | "tenant_id" bigint not null default '0', | 157 | "tenant_id" bigint not null default '0', |
| 158 | PRIMARY KEY (`id`) | 158 | PRIMARY KEY (`id`) |
| 159 | -) COMMENT ='部门表'; | 159 | +) COMMENT ='用户岗位表'; |
| 160 | 160 | ||
| 161 | 161 | ||
| 162 | CREATE TABLE IF NOT EXISTS "system_notice" ( | 162 | CREATE TABLE IF NOT EXISTS "system_notice" ( |