You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
关于单引、双引号。
MySQL 可以使用单引号(’)或者双引号(")表示值,但是 PG 只能用单引号(’)表示值,PG 的双引号(")是表示系统标识符的,比如表名或者字段名。MySQL可以使用反单引号(`)表示系统标识符,比如表名、字段名,PG 也是不支持的。
jeecg-boot平台代码中,mapper文件中有一些 select语句在给输出字段起别名时,用单引号导致了对PostgreSql不兼容(查询抛出异常了)
建议mapper文件中,字段用双引号(单引号修改为双引号),需要修改的文件如下
截图&代码:
兼容Postgresql,需要修改的表:
1、org/jeecg/modules/ngalain/mapper/xml/NgAlainMapper.xml
修改前select ${key} as ‘label’,${value} as ‘value from ${table}
修改后 select ${key} as "label",${value} as "value" from ${table}
2、org/jeecg/modules/system/mapper/xml/SysCategoryMapper.xml
修改前:
select code,
name as "title",
id as 'key',
(case has_child when '1' then 0 else 1 end) as isLeaf,
pid as parentId
from sys_category
where pid = #{pid}
修改后
select code,
name as "title",
id as “key”,
(case has_child when '1' then 0 else 1 end) as isLeaf,
pid as parentId
from sys_category
where pid = #{pid}
版本号:2.0.2
问题描述:
关于单引、双引号。
MySQL 可以使用单引号(’)或者双引号(")表示值,但是 PG 只能用单引号(’)表示值,PG 的双引号(")是表示系统标识符的,比如表名或者字段名。MySQL可以使用反单引号(`)表示系统标识符,比如表名、字段名,PG 也是不支持的。
jeecg-boot平台代码中,mapper文件中有一些 select语句在给输出字段起别名时,用单引号导致了对PostgreSql不兼容(查询抛出异常了)
建议mapper文件中,字段用双引号(单引号修改为双引号),需要修改的文件如下
截图&代码:
兼容Postgresql,需要修改的表:
1、org/jeecg/modules/ngalain/mapper/xml/NgAlainMapper.xml
修改前select ${key} as ‘label’,${value} as ‘value from ${table}
修改后 select ${key} as "label",${value} as "value" from ${table}
2、org/jeecg/modules/system/mapper/xml/SysCategoryMapper.xml
修改前:
select code,
name as "title",
id as 'key',
(case has_child when '1' then 0 else 1 end) as isLeaf,
pid as parentId
from sys_category
where pid = #{pid}
修改后
select code,
name as "title",
id as “key”,
(case has_child when '1' then 0 else 1 end) as isLeaf,
pid as parentId
from sys_category
where pid = #{pid}
3、org/jeecg/modules/system/mapper/xml/SysDictMapper.xml
select查询语句中, 字段别名的单引号改为双引号,有多处修改,逐一修改
The text was updated successfully, but these errors were encountered: