当前位置:网站首页>[ruoyi] database copy data
[ruoyi] database copy data
2022-07-21 12:04:00 【sayyy】
Preface
- ruoyi 4.6
Copy users
insert into `sys_user` (`dept_id`,`login_name`,`user_name`,`user_type`,`email`,`phonenumber`,`sex`,`avatar`,`password`,`salt`,`status`,`del_flag`,`login_ip`,`login_date`,`pwd_update_date`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `dept_id`,concat(`login_name`,'_copy'),concat(`user_name`,'_copy'),`user_type`,`email`,`phonenumber`,`sex`,`avatar`,`password`,`salt`,`status`,`del_flag`,`login_ip`,`login_date`,`pwd_update_date`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_user`
where `user_id`=1;
Copy menu
Copy the first level menu
insert into `sys_menu` (`menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `menu_name`,0,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_menu`
where `menu_id`=1;
- Copied menu id=
2369
Copy the secondary menu
insert into `sys_menu` (`menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `menu_name`,2369,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_menu`
where `parent_id`=1;
Query the copied menu
select *
from `sys_menu`
where `menu_id`=2369 or `parent_id`=2369;
Copy one at the same time 、 Two level menu
SELECT @sourceId := 1;
insert into `sys_menu` (`menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `menu_name`,0,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_menu`
where `menu_id`=@sourceId;
-- Parent menu ID
SELECT @parentId := LAST_INSERT_ID();
insert into `sys_menu` (`menu_name`,`parent_id`,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`)
select `menu_name`,@parentId,`order_num`,`url`,`target`,`menu_type`,`visible`,`is_refresh`,`perms`,`icon`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`
from `sys_menu`
where `parent_id`=@sourceId;
select *
from `sys_menu`
where `menu_id`=@parentId or `parent_id`=@parentId;
边栏推荐
猜你喜欢
How to take the first-class Constructor Certificate? Teach you hand in hand, and you will understand it after reading this article!
HTB-Lame
海外APP推送(上篇):厂商通道与谷歌FCM通道的差异
event.target
"Fundamentals of program design" Chapter 10 function and program structure 6-11 recursive calculation of P function (15 points)
2021-09-17
c语言初学者对puts()的问题
MySQL realizes master-slave synchronization and master-master synchronization based on binlog
线段树-区间修改树
Unity shader learning (V) mouse moving box
随机推荐
SSM整合注解映射和XML映射两种方式
Node reads out all file paths in a folder (all folders will be traversed here. If there are other operations, just add them.)
力扣每日一题-第40天-643. 字数组最大平均数Ⅰ
Shandong University, Beijing post, Harbin Institute of technology | multimodal dialog systems with dual knowledge enhanced generic trained language model
Leetcode breaks the 9W mark
Intercept the string before and after the specified character
2021-9-22
[problem solving] how to transfer files to win server
SAKO搜索帮助增强(FB02科目搜索帮助)
2021-09-17
学习编程语言的方法、经验和教训
"Fundamentals of program design" Chapter 10 function and program structure 7-1 circular volume calculator (20 points)
Disassembly of Huawei P30 Pro: compact structure, fine workmanship, exposure of core device suppliers!
MySQL查询字符串中有多少个相同字符(查询字符串包含特定个数的相同字符)
jeecg中j-vxe-table和j-popup组件的修改使用
"Fundamentals of program design" Chapter 10 function and program structure 7-1 circular volume calculator (20 points)
创建型模式之单例模式
Unity shader learning (V) mouse moving box
Low code that democratizes software development
Leetcode突破7W大关