Sfoglia il codice sorgente

1.修改第一次添加用户报错的bug

hellohaidie 5 mesi fa
parent
commit
9ba5b0cfa0

+ 7 - 0
src/main/java/com/lqkj/link/module/authority/repository/UserInfoRepository.java

@@ -38,6 +38,13 @@ public interface UserInfoRepository extends JpaRepository<UserInfo, Integer> {
38 38
     @Transactional
39 39
     @Modifying
40 40
     @Query(nativeQuery = true,
41
+        value = "select setval('user_info_user_id_seq', 3)"
42
+    )
43
+    void initUserIdSeq();
44
+
45
+    @Transactional
46
+    @Modifying
47
+    @Query(nativeQuery = true,
41 48
         value = "insert into user_role values (1, 1)"
42 49
     )
43 50
     void initSuperAdminRole();

+ 1 - 0
src/main/java/com/lqkj/link/module/authority/service/UserInfoService.java

@@ -32,6 +32,7 @@ public class UserInfoService {
32 32
     public void initSuperUser() {
33 33
         if (!userInfoRepository.existsById(1)) {
34 34
             userInfoRepository.initSuperAdmin();
35
+            userInfoRepository.initUserIdSeq();
35 36
             userInfoRepository.initSuperAdminRole();
36 37
         }
37 38
     }