自定义生气了 多了单引号怎么处理
ruoyi_nutz> SET IDENTITY_INSERT 'sys_menu' ON
[2022-06-27 16:18:14] [42000][102] Incorrect syntax near 'sys_menu'.
ruoyi_nutz> SET IDENTITY_INSERT sys_menu ON
[2022-06-27 16:19:04] completed in 3 ms
找到了 @改成$
输出sql
'SET IDENTITY_INSERT ON'
Sql sqlOn = Sqls.create("SET IDENTITY_INSERT $table ON");
sqlOn.params().set("table",dao.getEntity(SysMenu.class).getTableName());
dao.execute(sqlOn);
String data = FileUtils.getFileData("db/menu.json");
List<SysMenu> menuList = JSON.parseArray(data, SysMenu.class);
for (SysMenu menu : menuList) {
dao.insert(menu, FieldFilter.create(SysMenu.class, FieldMatcher.create(false)));
}
Sql sqlOff = Sqls.create("SET IDENTITY_INSERT $table OFF");
sqlOff.params().set("table",dao.getEntity(SysMenu.class).getTableName());
dao.execute(sqlOff);