Commit ea8f532f5ab8d37f693b5b2cb7c52d4fbaa46e9b

Authored by YunaiV
2 parents cc35749d 6d10f136

Merge branch 'master-jdk17' of https://github.com/YunaiV/ruoyi-vue-pro into feature/ai

sql/postgresql/ruoyi-vue-pro.sql
... ... @@ -33,7 +33,7 @@ INSERT INTO dual VALUES (1);
33 33 DROP TABLE IF EXISTS infra_api_access_log;
34 34 CREATE TABLE infra_api_access_log
35 35 (
36   - id int8 NOT NULL,
  36 + id int8 NOT NULL DEFAULT NEXTVAL('infra_api_access_log_seq'),
37 37 trace_id varchar(64) NOT NULL DEFAULT '',
38 38 user_id int8 NOT NULL DEFAULT 0,
39 39 user_type int2 NOT NULL DEFAULT 0,
... ... @@ -102,7 +102,7 @@ CREATE SEQUENCE infra_api_access_log_seq
102 102 DROP TABLE IF EXISTS infra_api_error_log;
103 103 CREATE TABLE infra_api_error_log
104 104 (
105   - id int8 NOT NULL,
  105 + id int8 NOT NULL DEFAULT NEXTVAL('infra_api_error_log_seq'),
106 106 trace_id varchar(64) NOT NULL,
107 107 user_id int8 NOT NULL DEFAULT 0,
108 108 user_type int2 NOT NULL DEFAULT 0,
... ... @@ -175,7 +175,7 @@ CREATE SEQUENCE infra_api_error_log_seq
175 175 DROP TABLE IF EXISTS infra_codegen_column;
176 176 CREATE TABLE infra_codegen_column
177 177 (
178   - id int8 NOT NULL,
  178 + id int8 NOT NULL default nextval('infra_codegen_column_seq'),
179 179 table_id int8 NOT NULL,
180 180 column_name varchar(200) NOT NULL,
181 181 data_type varchar(100) NOT NULL,
... ... @@ -238,7 +238,7 @@ CREATE SEQUENCE infra_codegen_column_seq
238 238 DROP TABLE IF EXISTS infra_codegen_table;
239 239 CREATE TABLE infra_codegen_table
240 240 (
241   - id int8 NOT NULL,
  241 + id int8 NOT NULL default nextval('infra_codegen_table_seq'),
242 242 data_source_config_id int8 NOT NULL,
243 243 scene int2 NOT NULL DEFAULT 1,
244 244 table_name varchar(200) NOT NULL DEFAULT '',
... ... @@ -303,7 +303,7 @@ CREATE SEQUENCE infra_codegen_table_seq
303 303 DROP TABLE IF EXISTS infra_config;
304 304 CREATE TABLE infra_config
305 305 (
306   - id int8 NOT NULL,
  306 + id int8 NOT NULL default nextval('infra_config_seq'),
307 307 category varchar(50) NOT NULL,
308 308 type int2 NOT NULL,
309 309 name varchar(100) NOT NULL DEFAULT '',
... ... @@ -362,7 +362,7 @@ CREATE SEQUENCE infra_config_seq
362 362 DROP TABLE IF EXISTS infra_data_source_config;
363 363 CREATE TABLE infra_data_source_config
364 364 (
365   - id int8 NOT NULL,
  365 + id int8 NOT NULL default nextval('infra_data_source_config_seq'),
366 366 name varchar(100) NOT NULL DEFAULT '',
367 367 url varchar(1024) NOT NULL,
368 368 username varchar(255) NOT NULL,
... ... @@ -399,7 +399,7 @@ CREATE SEQUENCE infra_data_source_config_seq
399 399 DROP TABLE IF EXISTS infra_file;
400 400 CREATE TABLE infra_file
401 401 (
402   - id int8 NOT NULL,
  402 + id int8 NOT NULL default nextval('infra_file_seq'),
403 403 config_id int8 NULL DEFAULT NULL,
404 404 name varchar(256) NULL DEFAULT NULL,
405 405 path varchar(512) NOT NULL,
... ... @@ -440,7 +440,7 @@ CREATE SEQUENCE infra_file_seq
440 440 DROP TABLE IF EXISTS infra_file_config;
441 441 CREATE TABLE infra_file_config
442 442 (
443   - id int8 NOT NULL,
  443 + id int8 NOT NULL default nextval('infra_file_config_seq'),
444 444 name varchar(63) NOT NULL,
445 445 storage int2 NOT NULL,
446 446 remark varchar(255) NULL DEFAULT NULL,
... ... @@ -496,7 +496,7 @@ CREATE SEQUENCE infra_file_config_seq
496 496 DROP TABLE IF EXISTS infra_file_content;
497 497 CREATE TABLE infra_file_content
498 498 (
499   - id int8 NOT NULL,
  499 + id int8 NOT NULL default nextval('infra_file_content_seq'),
500 500 config_id int8 NOT NULL,
501 501 path varchar(512) NOT NULL,
502 502 content bytea NOT NULL,
... ... @@ -531,7 +531,7 @@ CREATE SEQUENCE infra_file_content_seq
531 531 DROP TABLE IF EXISTS infra_job;
532 532 CREATE TABLE infra_job
533 533 (
534   - id int8 NOT NULL,
  534 + id int8 NOT NULL default nextval('infra_job_seq'),
535 535 name varchar(32) NOT NULL,
536 536 status int2 NOT NULL,
537 537 handler_name varchar(64) NOT NULL,
... ... @@ -597,7 +597,7 @@ CREATE SEQUENCE infra_job_seq
597 597 DROP TABLE IF EXISTS infra_job_log;
598 598 CREATE TABLE infra_job_log
599 599 (
600   - id int8 NOT NULL,
  600 + id int8 NOT NULL default nextval('infra_job_log_seq'),
601 601 job_id int8 NOT NULL,
602 602 handler_name varchar(64) NOT NULL,
603 603 handler_param varchar(255) NULL DEFAULT NULL,
... ... @@ -644,7 +644,7 @@ CREATE SEQUENCE infra_job_log_seq
644 644 DROP TABLE IF EXISTS system_dept;
645 645 CREATE TABLE system_dept
646 646 (
647   - id int8 NOT NULL,
  647 + id int8 NOT NULL default nextval('system_dept_seq'),
648 648 name varchar(30) NOT NULL DEFAULT '',
649 649 parent_id int8 NOT NULL DEFAULT 0,
650 650 sort int4 NOT NULL DEFAULT 0,
... ... @@ -711,7 +711,7 @@ CREATE SEQUENCE system_dept_seq
711 711 DROP TABLE IF EXISTS system_dict_data;
712 712 CREATE TABLE system_dict_data
713 713 (
714   - id int8 NOT NULL,
  714 + id int8 NOT NULL default nextval('system_dict_data_seq'),
715 715 sort int4 NOT NULL DEFAULT 0,
716 716 label varchar(100) NOT NULL DEFAULT '',
717 717 value varchar(100) NOT NULL DEFAULT '',
... ... @@ -1367,7 +1367,7 @@ CREATE SEQUENCE system_dict_data_seq
1367 1367 DROP TABLE IF EXISTS system_dict_type;
1368 1368 CREATE TABLE system_dict_type
1369 1369 (
1370   - id int8 NOT NULL,
  1370 + id int8 NOT NULL default nextval('system_dict_type_seq'),
1371 1371 name varchar(100) NOT NULL DEFAULT '',
1372 1372 type varchar(100) NOT NULL DEFAULT '',
1373 1373 status int2 NOT NULL DEFAULT 0,
... ... @@ -1521,7 +1521,7 @@ CREATE SEQUENCE system_dict_type_seq
1521 1521 DROP TABLE IF EXISTS system_login_log;
1522 1522 CREATE TABLE system_login_log
1523 1523 (
1524   - id int8 NOT NULL,
  1524 + id int8 NOT NULL default nextval('system_login_log_seq'),
1525 1525 log_type int8 NOT NULL,
1526 1526 trace_id varchar(64) NOT NULL DEFAULT '',
1527 1527 user_id int8 NOT NULL DEFAULT 0,
... ... @@ -1568,7 +1568,7 @@ CREATE SEQUENCE system_login_log_seq
1568 1568 DROP TABLE IF EXISTS system_mail_account;
1569 1569 CREATE TABLE system_mail_account
1570 1570 (
1571   - id int8 NOT NULL,
  1571 + id int8 NOT NULL default nextval('system_mail_account_seq'),
1572 1572 mail varchar(255) NOT NULL,
1573 1573 username varchar(255) NOT NULL,
1574 1574 password varchar(255) NOT NULL,
... ... @@ -1623,7 +1623,7 @@ CREATE SEQUENCE system_mail_account_seq
1623 1623 DROP TABLE IF EXISTS system_mail_log;
1624 1624 CREATE TABLE system_mail_log
1625 1625 (
1626   - id int8 NOT NULL,
  1626 + id int8 NOT NULL default nextval('system_mail_log_seq'),
1627 1627 user_id int8 NULL DEFAULT NULL,
1628 1628 user_type int2 NULL DEFAULT NULL,
1629 1629 to_mail varchar(255) NOT NULL,
... ... @@ -1682,7 +1682,7 @@ CREATE SEQUENCE system_mail_log_seq
1682 1682 DROP TABLE IF EXISTS system_mail_template;
1683 1683 CREATE TABLE system_mail_template
1684 1684 (
1685   - id int8 NOT NULL,
  1685 + id int8 NOT NULL default nextval('system_mail_template_seq'),
1686 1686 name varchar(63) NOT NULL,
1687 1687 code varchar(63) NOT NULL,
1688 1688 account_id int8 NOT NULL,
... ... @@ -1740,7 +1740,7 @@ CREATE SEQUENCE system_mail_template_seq
1740 1740 DROP TABLE IF EXISTS system_menu;
1741 1741 CREATE TABLE system_menu
1742 1742 (
1743   - id int8 NOT NULL,
  1743 + id int8 NOT NULL default nextval('system_menu_seq'),
1744 1744 name varchar(50) NOT NULL,
1745 1745 permission varchar(100) NOT NULL DEFAULT '',
1746 1746 type int2 NOT NULL,
... ... @@ -2714,7 +2714,7 @@ CREATE SEQUENCE system_menu_seq
2714 2714 DROP TABLE IF EXISTS system_notice;
2715 2715 CREATE TABLE system_notice
2716 2716 (
2717   - id int8 NOT NULL,
  2717 + id int8 NOT NULL default nextval('system_notice_seq'),
2718 2718 title varchar(50) NOT NULL,
2719 2719 content text NOT NULL,
2720 2720 type int2 NOT NULL,
... ... @@ -2764,7 +2764,7 @@ CREATE SEQUENCE system_notice_seq
2764 2764 DROP TABLE IF EXISTS system_notify_message;
2765 2765 CREATE TABLE system_notify_message
2766 2766 (
2767   - id int8 NOT NULL,
  2767 + id int8 NOT NULL default nextval('system_notify_message_seq'),
2768 2768 user_id int8 NOT NULL,
2769 2769 user_type int2 NOT NULL,
2770 2770 template_id int8 NOT NULL,
... ... @@ -2832,7 +2832,7 @@ CREATE SEQUENCE system_notify_message_seq
2832 2832 DROP TABLE IF EXISTS system_notify_template;
2833 2833 CREATE TABLE system_notify_template
2834 2834 (
2835   - id int8 NOT NULL,
  2835 + id int8 NOT NULL default nextval('system_notify_template_seq'),
2836 2836 name varchar(63) NOT NULL,
2837 2837 code varchar(64) NOT NULL,
2838 2838 nickname varchar(255) NOT NULL,
... ... @@ -2877,7 +2877,7 @@ CREATE SEQUENCE system_notify_template_seq
2877 2877 DROP TABLE IF EXISTS system_oauth2_access_token;
2878 2878 CREATE TABLE system_oauth2_access_token
2879 2879 (
2880   - id int8 NOT NULL,
  2880 + id int8 NOT NULL default nextval('system_oauth2_access_token_seq'),
2881 2881 user_id int8 NOT NULL,
2882 2882 user_type int2 NOT NULL,
2883 2883 user_info varchar(512) NOT NULL,
... ... @@ -2927,7 +2927,7 @@ CREATE SEQUENCE system_oauth2_access_token_seq
2927 2927 DROP TABLE IF EXISTS system_oauth2_approve;
2928 2928 CREATE TABLE system_oauth2_approve
2929 2929 (
2930   - id int8 NOT NULL,
  2930 + id int8 NOT NULL default nextval('system_oauth2_approve_seq'),
2931 2931 user_id int8 NOT NULL,
2932 2932 user_type int2 NOT NULL,
2933 2933 client_id varchar(255) NOT NULL,
... ... @@ -2970,7 +2970,7 @@ CREATE SEQUENCE system_oauth2_approve_seq
2970 2970 DROP TABLE IF EXISTS system_oauth2_client;
2971 2971 CREATE TABLE system_oauth2_client
2972 2972 (
2973   - id int8 NOT NULL,
  2973 + id int8 NOT NULL default nextval('system_oauth2_client_seq'),
2974 2974 client_id varchar(255) NOT NULL,
2975 2975 secret varchar(255) NOT NULL,
2976 2976 name varchar(255) NOT NULL,
... ... @@ -3041,7 +3041,7 @@ CREATE SEQUENCE system_oauth2_client_seq
3041 3041 DROP TABLE IF EXISTS system_oauth2_code;
3042 3042 CREATE TABLE system_oauth2_code
3043 3043 (
3044   - id int8 NOT NULL,
  3044 + id int8 NOT NULL default nextval('system_oauth2_code_seq'),
3045 3045 user_id int8 NOT NULL,
3046 3046 user_type int2 NOT NULL,
3047 3047 code varchar(32) NOT NULL,
... ... @@ -3088,7 +3088,7 @@ CREATE SEQUENCE system_oauth2_code_seq
3088 3088 DROP TABLE IF EXISTS system_oauth2_refresh_token;
3089 3089 CREATE TABLE system_oauth2_refresh_token
3090 3090 (
3091   - id int8 NOT NULL,
  3091 + id int8 NOT NULL default nextval('system_oauth2_refresh_token_seq'),
3092 3092 user_id int8 NOT NULL,
3093 3093 refresh_token varchar(32) NOT NULL,
3094 3094 user_type int2 NOT NULL,
... ... @@ -3131,7 +3131,7 @@ CREATE SEQUENCE system_oauth2_refresh_token_seq
3131 3131 DROP TABLE IF EXISTS system_operate_log;
3132 3132 CREATE TABLE system_operate_log
3133 3133 (
3134   - id int8 NOT NULL,
  3134 + id int8 NOT NULL default nextval('system_operate_log_seq'),
3135 3135 trace_id varchar(64) NOT NULL DEFAULT '',
3136 3136 user_id int8 NOT NULL,
3137 3137 user_type int2 NOT NULL DEFAULT 0,
... ... @@ -3188,7 +3188,7 @@ CREATE SEQUENCE system_operate_log_seq
3188 3188 DROP TABLE IF EXISTS system_post;
3189 3189 CREATE TABLE system_post
3190 3190 (
3191   - id int8 NOT NULL,
  3191 + id int8 NOT NULL default nextval('system_post_seq'),
3192 3192 code varchar(64) NOT NULL,
3193 3193 name varchar(50) NOT NULL,
3194 3194 sort int4 NOT NULL,
... ... @@ -3241,7 +3241,7 @@ CREATE SEQUENCE system_post_seq
3241 3241 DROP TABLE IF EXISTS system_role;
3242 3242 CREATE TABLE system_role
3243 3243 (
3244   - id int8 NOT NULL,
  3244 + id int8 NOT NULL default nextval('system_role_seq'),
3245 3245 name varchar(30) NOT NULL,
3246 3246 code varchar(100) NOT NULL,
3247 3247 sort int4 NOT NULL,
... ... @@ -3304,7 +3304,7 @@ CREATE SEQUENCE system_role_seq
3304 3304 DROP TABLE IF EXISTS system_role_menu;
3305 3305 CREATE TABLE system_role_menu
3306 3306 (
3307   - id int8 NOT NULL,
  3307 + id int8 NOT NULL default nextval('system_role_menu_seq'),
3308 3308 role_id int8 NOT NULL,
3309 3309 menu_id int8 NOT NULL,
3310 3310 creator varchar(64) NULL DEFAULT '',
... ... @@ -4210,7 +4210,7 @@ CREATE SEQUENCE system_role_menu_seq
4210 4210 DROP TABLE IF EXISTS system_sms_channel;
4211 4211 CREATE TABLE system_sms_channel
4212 4212 (
4213   - id int8 NOT NULL,
  4213 + id int8 NOT NULL default nextval('system_sms_channel_seq'),
4214 4214 signature varchar(12) NOT NULL,
4215 4215 code varchar(63) NOT NULL,
4216 4216 status int2 NOT NULL,
... ... @@ -4264,7 +4264,7 @@ CREATE SEQUENCE system_sms_channel_seq
4264 4264 DROP TABLE IF EXISTS system_sms_code;
4265 4265 CREATE TABLE system_sms_code
4266 4266 (
4267   - id int8 NOT NULL,
  4267 + id int8 NOT NULL default nextval('system_sms_code_seq'),
4268 4268 mobile varchar(11) NOT NULL,
4269 4269 code varchar(6) NOT NULL,
4270 4270 create_ip varchar(15) NOT NULL,
... ... @@ -4313,7 +4313,7 @@ CREATE SEQUENCE system_sms_code_seq
4313 4313 DROP TABLE IF EXISTS system_sms_log;
4314 4314 CREATE TABLE system_sms_log
4315 4315 (
4316   - id int8 NOT NULL,
  4316 + id int8 NOT NULL default nextval('system_sms_log_seq'),
4317 4317 channel_id int8 NOT NULL,
4318 4318 channel_code varchar(63) NOT NULL,
4319 4319 template_id int8 NOT NULL,
... ... @@ -4384,7 +4384,7 @@ CREATE SEQUENCE system_sms_log_seq
4384 4384 DROP TABLE IF EXISTS system_sms_template;
4385 4385 CREATE TABLE system_sms_template
4386 4386 (
4387   - id int8 NOT NULL,
  4387 + id int8 NOT NULL default nextval('system_sms_template_seq'),
4388 4388 type int2 NOT NULL,
4389 4389 status int2 NOT NULL,
4390 4390 code varchar(63) NOT NULL,
... ... @@ -4456,7 +4456,7 @@ CREATE SEQUENCE system_sms_template_seq
4456 4456 DROP TABLE IF EXISTS system_social_client;
4457 4457 CREATE TABLE system_social_client
4458 4458 (
4459   - id int8 NOT NULL,
  4459 + id int8 NOT NULL default nextval('system_social_client_seq'),
4460 4460 name varchar(255) NOT NULL,
4461 4461 social_type int2 NOT NULL,
4462 4462 user_type int2 NOT NULL,
... ... @@ -4514,7 +4514,7 @@ CREATE SEQUENCE system_social_client_seq
4514 4514 DROP TABLE IF EXISTS system_social_user;
4515 4515 CREATE TABLE system_social_user
4516 4516 (
4517   - id int8 NOT NULL,
  4517 + id int8 NOT NULL default nextval('system_social_user_seq'),
4518 4518 type int2 NOT NULL,
4519 4519 openid varchar(32) NOT NULL,
4520 4520 token varchar(256) NULL DEFAULT NULL,
... ... @@ -4563,7 +4563,7 @@ CREATE SEQUENCE system_social_user_seq
4563 4563 DROP TABLE IF EXISTS system_social_user_bind;
4564 4564 CREATE TABLE system_social_user_bind
4565 4565 (
4566   - id int8 NOT NULL,
  4566 + id int8 NOT NULL default nextval('system_social_user_bind_seq'),
4567 4567 user_id int8 NOT NULL,
4568 4568 user_type int2 NOT NULL,
4569 4569 social_type int2 NOT NULL,
... ... @@ -4602,7 +4602,7 @@ CREATE SEQUENCE system_social_user_bind_seq
4602 4602 DROP TABLE IF EXISTS system_tenant;
4603 4603 CREATE TABLE system_tenant
4604 4604 (
4605   - id int8 NOT NULL,
  4605 + id int8 NOT NULL default nextval('system_tenant_seq'),
4606 4606 name varchar(30) NOT NULL,
4607 4607 contact_user_id int8 NULL DEFAULT NULL,
4608 4608 contact_name varchar(30) NOT NULL,
... ... @@ -4660,7 +4660,7 @@ CREATE SEQUENCE system_tenant_seq
4660 4660 DROP TABLE IF EXISTS system_tenant_package;
4661 4661 CREATE TABLE system_tenant_package
4662 4662 (
4663   - id int8 NOT NULL,
  4663 + id int8 NOT NULL default nextval('system_tenant_package_seq'),
4664 4664 name varchar(30) NOT NULL,
4665 4665 status int2 NOT NULL DEFAULT 0,
4666 4666 remark varchar(256) NULL DEFAULT '',
... ... @@ -4707,7 +4707,7 @@ CREATE SEQUENCE system_tenant_package_seq
4707 4707 DROP TABLE IF EXISTS system_user_post;
4708 4708 CREATE TABLE system_user_post
4709 4709 (
4710   - id int8 NOT NULL,
  4710 + id int8 NOT NULL default nextval('system_user_post_seq'),
4711 4711 user_id int8 NOT NULL DEFAULT 0,
4712 4712 post_id int8 NOT NULL DEFAULT 0,
4713 4713 creator varchar(64) NULL DEFAULT '',
... ... @@ -4759,7 +4759,7 @@ CREATE SEQUENCE system_user_post_seq
4759 4759 DROP TABLE IF EXISTS system_user_role;
4760 4760 CREATE TABLE system_user_role
4761 4761 (
4762   - id int8 NOT NULL,
  4762 + id int8 NOT NULL default nextval('system_user_role_seq'),
4763 4763 user_id int8 NOT NULL,
4764 4764 role_id int8 NOT NULL,
4765 4765 creator varchar(64) NULL DEFAULT '',
... ... @@ -4819,7 +4819,7 @@ CREATE SEQUENCE system_user_role_seq
4819 4819 DROP TABLE IF EXISTS system_users;
4820 4820 CREATE TABLE system_users
4821 4821 (
4822   - id int8 NOT NULL,
  4822 + id int8 NOT NULL default nextval('system_users_seq'),
4823 4823 username varchar(30) NOT NULL,
4824 4824 password varchar(100) NOT NULL DEFAULT '',
4825 4825 nickname varchar(30) NOT NULL,
... ... @@ -4902,7 +4902,7 @@ CREATE SEQUENCE system_users_seq
4902 4902 DROP TABLE IF EXISTS yudao_demo01_contact;
4903 4903 CREATE TABLE yudao_demo01_contact
4904 4904 (
4905   - id int8 NOT NULL,
  4905 + id int8 NOT NULL default nextval('yudao_demo01_contact_seq'),
4906 4906 name varchar(100) NOT NULL DEFAULT '',
4907 4907 sex int2 NOT NULL,
4908 4908 birthday timestamp NOT NULL,
... ... @@ -4952,7 +4952,7 @@ CREATE SEQUENCE yudao_demo01_contact_seq
4952 4952 DROP TABLE IF EXISTS yudao_demo02_category;
4953 4953 CREATE TABLE yudao_demo02_category
4954 4954 (
4955   - id int8 NOT NULL,
  4955 + id int8 NOT NULL default nextval('yudao_demo02_category_seq'),
4956 4956 name varchar(100) NOT NULL DEFAULT '',
4957 4957 parent_id int8 NOT NULL,
4958 4958 creator varchar(64) NULL DEFAULT '',
... ... @@ -5001,7 +5001,7 @@ CREATE SEQUENCE yudao_demo02_category_seq
5001 5001 DROP TABLE IF EXISTS yudao_demo03_course;
5002 5002 CREATE TABLE yudao_demo03_course
5003 5003 (
5004   - id int8 NOT NULL,
  5004 + id int8 NOT NULL default nextval('yudao_demo03_course_seq'),
5005 5005 student_id int8 NOT NULL,
5006 5006 name varchar(100) NOT NULL DEFAULT '',
5007 5007 score int2 NOT NULL,
... ... @@ -5063,7 +5063,7 @@ CREATE SEQUENCE yudao_demo03_course_seq
5063 5063 DROP TABLE IF EXISTS yudao_demo03_grade;
5064 5064 CREATE TABLE yudao_demo03_grade
5065 5065 (
5066   - id int8 NOT NULL,
  5066 + id int8 NOT NULL default nextval('yudao_demo03_grade_seq'),
5067 5067 student_id int8 NOT NULL,
5068 5068 name varchar(100) NOT NULL DEFAULT '',
5069 5069 teacher varchar(255) NOT NULL,
... ... @@ -5111,7 +5111,7 @@ CREATE SEQUENCE yudao_demo03_grade_seq
5111 5111 DROP TABLE IF EXISTS yudao_demo03_student;
5112 5112 CREATE TABLE yudao_demo03_student
5113 5113 (
5114   - id int8 NOT NULL,
  5114 + id int8 NOT NULL default nextval('yudao_demo03_student_seq'),
5115 5115 name varchar(100) NOT NULL DEFAULT '',
5116 5116 sex int2 NOT NULL,
5117 5117 birthday timestamp NOT NULL,
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/enums/model/AiPlatformEnum.java
... ... @@ -40,6 +40,7 @@ public enum AiPlatformEnum implements ArrayValuable<String> {
40 40 STABLE_DIFFUSION("StableDiffusion", "StableDiffusion"), // Stability AI
41 41 MIDJOURNEY("Midjourney", "Midjourney"), // Midjourney
42 42 SUNO("Suno", "Suno"), // Suno AI
  43 + GROK("Grok","Grok"), // Grok
43 44  
44 45 ;
45 46  
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/AiAutoConfiguration.java
... ... @@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.model.AiModelFactoryImpl;
7 7 import cn.iocoder.yudao.module.ai.framework.ai.core.model.baichuan.BaiChuanChatModel;
8 8 import cn.iocoder.yudao.module.ai.framework.ai.core.model.doubao.DouBaoChatModel;
9 9 import cn.iocoder.yudao.module.ai.framework.ai.core.model.gemini.GeminiChatModel;
  10 +import cn.iocoder.yudao.module.ai.framework.ai.core.model.grok.GrokChatModel;
10 11 import cn.iocoder.yudao.module.ai.framework.ai.core.model.hunyuan.HunYuanChatModel;
11 12 import cn.iocoder.yudao.module.ai.framework.ai.core.model.midjourney.api.MidjourneyApi;
12 13 import cn.iocoder.yudao.module.ai.framework.ai.core.model.siliconflow.SiliconFlowApiConstants;
... ... @@ -17,6 +18,7 @@ import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.AiWebSearchClient;
17 18 import cn.iocoder.yudao.module.ai.framework.ai.core.webserch.bocha.AiBoChaWebSearchClient;
18 19 import cn.iocoder.yudao.module.ai.tool.method.PersonService;
19 20 import lombok.extern.slf4j.Slf4j;
  21 +import org.springframework.ai.chat.model.ChatModel;
20 22 import org.springframework.ai.deepseek.DeepSeekChatModel;
21 23 import org.springframework.ai.deepseek.DeepSeekChatOptions;
22 24 import org.springframework.ai.deepseek.api.DeepSeekApi;
... ... @@ -40,6 +42,7 @@ import org.springframework.context.annotation.Bean;
40 42 import org.springframework.context.annotation.Configuration;
41 43  
42 44 import java.util.List;
  45 +import java.util.Optional;
43 46  
44 47 /**
45 48 * 芋道 AI 自动配置
... ... @@ -286,4 +289,25 @@ public class AiAutoConfiguration {
286 289 return List.of(ToolCallbacks.from(personService));
287 290 }
288 291  
  292 + public ChatModel buildGrokChatClient(YudaoAiProperties.Grok properties) {
  293 + if (StrUtil.isEmpty(properties.getModel())) {
  294 + properties.setModel(GrokChatModel.MODEL_DEFAULT);
  295 + }
  296 + OpenAiChatModel openAiChatModel = OpenAiChatModel.builder()
  297 + .openAiApi(OpenAiApi.builder()
  298 + .baseUrl(Optional.ofNullable(properties.getBaseUrl())
  299 + .orElse(GrokChatModel.BASE_URL))
  300 + .completionsPath(GrokChatModel.COMPLETE_PATH)
  301 + .apiKey(properties.getApiKey())
  302 + .build())
  303 + .defaultOptions(OpenAiChatOptions.builder()
  304 + .model(properties.getModel())
  305 + .temperature(properties.getTemperature())
  306 + .maxTokens(properties.getMaxTokens())
  307 + .topP(properties.getTopP())
  308 + .build())
  309 + .toolCallingManager(getToolCallingManager())
  310 + .build();
  311 + return new DouBaoChatModel(openAiChatModel);
  312 + }
289 313 }
290 314 \ No newline at end of file
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/config/YudaoAiProperties.java
... ... @@ -161,6 +161,20 @@ public class YudaoAiProperties {
161 161 }
162 162  
163 163 @Data
  164 + public static class Grok {
  165 +
  166 + private String enable;
  167 + private String apiKey;
  168 + private String baseUrl;
  169 +
  170 + private String model;
  171 + private Double temperature;
  172 + private Integer maxTokens;
  173 + private Double topP;
  174 +
  175 + }
  176 +
  177 + @Data
164 178 public static class WebSearch {
165 179  
166 180 private boolean enable;
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/AiModelFactoryImpl.java
... ... @@ -178,6 +178,8 @@ public class AiModelFactoryImpl implements AiModelFactory {
178 178 return buildGeminiChatModel(apiKey);
179 179 case OLLAMA:
180 180 return buildOllamaChatModel(url);
  181 + case GROK:
  182 + return buildGrokChatModel(apiKey,url);
181 183 default:
182 184 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
183 185 }
... ... @@ -405,6 +407,12 @@ public class AiModelFactoryImpl implements AiModelFactory {
405 407 .build();
406 408 }
407 409  
  410 + private ChatModel buildGrokChatModel(String apiKey,String url) {
  411 + YudaoAiProperties.Grok properties = new YudaoAiProperties.Grok()
  412 + .setBaseUrl(url)
  413 + .setApiKey(apiKey);
  414 + return new AiAutoConfiguration().buildGrokChatClient(properties);
  415 + }
408 416 /**
409 417 * 可参考 {@link AiAutoConfiguration#douBaoChatClient(YudaoAiProperties)}
410 418 */
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/framework/ai/core/model/grok/GrokChatModel.java 0 → 100644
  1 +package cn.iocoder.yudao.module.ai.framework.ai.core.model.grok;
  2 +
  3 +import lombok.RequiredArgsConstructor;
  4 +import lombok.extern.slf4j.Slf4j;
  5 +import org.springframework.ai.chat.model.ChatModel;
  6 +import org.springframework.ai.chat.model.ChatResponse;
  7 +import org.springframework.ai.chat.prompt.ChatOptions;
  8 +import org.springframework.ai.chat.prompt.Prompt;
  9 +import reactor.core.publisher.Flux;
  10 +
  11 +/**
  12 + * Grok {@link ChatModel} 实现类
  13 + *
  14 + *
  15 + */
  16 +@Slf4j
  17 +@RequiredArgsConstructor
  18 +public class GrokChatModel implements ChatModel {
  19 +
  20 + public static final String BASE_URL = "https://api.x.ai";
  21 + public static final String COMPLETE_PATH = "/v1/chat/completions";
  22 + public static final String MODEL_DEFAULT = "grok-4-fast-reasoning";
  23 +
  24 + /**
  25 + * 兼容 OpenAI 接口,进行复用
  26 + */
  27 + private final ChatModel openAiChatModel;
  28 +
  29 + @Override
  30 + public ChatResponse call(Prompt prompt) {
  31 + return openAiChatModel.call(prompt);
  32 + }
  33 +
  34 + @Override
  35 + public Flux<ChatResponse> stream(Prompt prompt) {
  36 + return openAiChatModel.stream(prompt);
  37 + }
  38 +
  39 + @Override
  40 + public ChatOptions getDefaultOptions() {
  41 + return openAiChatModel.getDefaultOptions();
  42 + }
  43 +
  44 +}
... ...
yudao-module-ai/src/main/java/cn/iocoder/yudao/module/ai/util/AiUtils.java
... ... @@ -79,6 +79,9 @@ public class AiUtils {
79 79 case OLLAMA:
80 80 return OllamaChatOptions.builder().model(model).temperature(temperature).numPredict(maxTokens)
81 81 .toolCallbacks(toolCallbacks).toolContext(toolContext).build();
  82 + case GROK:
  83 + return OpenAiChatOptions.builder().model(model).temperature(temperature).maxTokens(maxTokens)
  84 + .toolCallbacks(toolCallbacks).toolContext(toolContext).build();
82 85 default:
83 86 throw new IllegalArgumentException(StrUtil.format("未知平台({})", platform));
84 87 }
... ...