Переглянути джерело

code review 编码规范统一

anzhen 3 роки тому
батько
коміт
17167c24d1

+ 4 - 2
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

+ 4 - 6
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> {
 
     default List<UserPostDO> selectIdList(Long id) {
         return selectList(new LambdaQueryWrapperX<UserPostDO>()
-                .eq(UserPostDO::getUserId, id)
-                .select(UserPostDO::getPostId));
-
+                .eq(UserPostDO::getUserId, id));
     }
 
-    default void deleteByUserIdAndPostId(Long userId, Collection<Long> deletePostIds) {
+    default void deleteByUserIdAndPostId(Long userId, Collection<Long> postIds) {
         delete(new LambdaQueryWrapperX<UserPostDO>()
                 .eq(UserPostDO::getUserId, userId)
-                .in(UserPostDO::getPostId, deletePostIds));
+                .in(UserPostDO::getPostId, postIds));
     }
 
-    default List<UserPostDO> selectUserIdByPostIds(Collection<Long> postIds) {
+    default List<UserPostDO> selectListByPostIds(Collection<Long> postIds) {
         return selectList(new LambdaQueryWrapperX<UserPostDO>()
                 .in(UserPostDO::getPostId, postIds));
     }

+ 1 - 2
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<Long> userIdList = userPostMapper.selectUserIdByPostIds(postIds)
+        List<Long> userIdList = userPostMapper.selectListByPostIds(postIds)
                 .stream()
                 .map(UserPostDO::getUserId)
                 .distinct()

+ 1 - 1
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" (