|
本帖最后由 liuhui 于 2018-6-27 11:47 编辑
系统版本:BeX5 3.8;PostgreSQL 10.4
目前我的情况是系统库基于PostgreSQL,BeX5能运行起来,少量查询不正常,但所有的保存都会失败。
1、查询失败问题,打开系统的“组织权限—》组织管理”
会执行下面这个SQL, LEFT JOIN SA_Code SA_OrgLevel ON ( SA_OPOrg.SLEVEL = SA_OrgLevel.SCODE )这一句报错,因为SA_Code.SCODE是varchar而SA_OPOrg.SLEVEL是int
PG不支持跨类型的判断,需要先转换。
- SELECT
- SA_OPOrg.sID AS SA_OPOrg,
- '' AS dptName,
- SA_OrgLevel.SNAME AS levelName,
- '' AS ognName,
- SA_OPPerson.SCODE AS personCode,
- SA_OPPerson.sID AS personID,
- SA_OPPerson.SIDCARD AS personIDCard,
- SA_OPPerson.SLOGINNAME AS personLoginName,
- SA_OPPerson.SMAINORGID AS personMainOrgID,
- SA_OPPerson.SNAME AS personName,
- SA_OPPerson.SNUMB AS personNumb,
- SA_OPPerson.SPASSWORD AS personPassword,
- SA_OPPerson.SSEX AS personSex,
- SA_OPPerson.SVALIDSTATE AS personValidState,
- SA_OPPerson.VERSION AS personVersion,
- '' AS posName,
- SA_OPOrg.SADDRESS AS sAddress,
- SA_OPOrg.SCODE AS sCode,
- SA_OPOrg.SDESCRIPTION AS sDescription,
- SA_OPOrg.SFCODE AS sFCode,
- SA_OPOrg.sFID AS sFID,
- SA_OPOrg.sFName AS sFName,
- SA_OPOrg.SFAX AS sFax,
- SA_OPOrg.SLEVEL AS sLevel,
- SA_OPOrg.SLONGNAME AS sLongName,
- SA_OPOrg.SNAME AS sName,
- SA_OPOrg.SNODEKIND AS sNodeKind,
- SA_OPOrg.SORGKINDID AS sOrgKindID,
- SA_OPOrg.sParent AS sParent,
- SA_OPOrg.SPERSONID AS sPersonID,
- SA_OPOrg.SPHONE AS sPhone,
- SA_OPOrg.SSEQUENCE AS sSequence,
- SA_OPOrg.SVALIDSTATE AS sValidState,
- SA_OPOrg.SWXDEPTID AS sWxDeptID,
- SA_OPOrg.SZIP AS sZip,
- SA_OPOrg.VERSION AS version
- FROM
- SA_OPOrg SA_OPOrg
- LEFT JOIN SA_OPPerson SA_OPPerson ON SA_OPOrg.SPERSONID = SA_OPPerson.sID
- LEFT JOIN SA_Code SA_OrgLevel ON ( SA_OPOrg.SLEVEL = SA_OrgLevel.SCODE )
- AND ( SA_OrgLevel.sType = 'orgLevel' )
- WHERE
- ( SA_OPOrg.sParent IS NULL )
- AND ( SA_OPOrg.SVALIDSTATE = 1 )
- ORDER BY
- SA_OPOrg.SSEQUENCE ASC
复制代码 2、insert保存,全部都会失败
我分析了下,是执行的insert语句X5会在字段前加上了表名,而pgsql不支持这个语法。
例如下面是新增一个角色执行的SQL,去掉其中所有的字段前缀“SA_OPRole.”,则会成功,否则失败。
- INSERT INTO SA_OPRole (
- SA_OPRole.sID,
- SA_OPRole.VERSION,
- SA_OPRole.SNAME,
- SA_OPRole.SCODE,
- SA_OPRole.SCATALOG,
- SA_OPRole.SROLEKIND,
- SA_OPRole.SDESCRIPTION,
- SA_OPRole.SSEQUENCE,
- SA_OPRole.SVALIDSTATE,
- SA_OPRole.sParentRolesNames
- )
- VALUES
- (
- '7B4D772596BF4587A A8E6C56D5171A3B',
- 0,
- 'test1',
- 'test1',
- NULL,
- 'fun',
- NULL,
- NULL,
- 1,
- ''
- )
复制代码
3、重构查询、保存核心方法:
由于BizData.save()等方法是X5的内置的jar中,未找到源码,我改不了
综上,请问是不是目前BeX5还不支持PostgreSQL,或者是平台有什么参数需要修改一下,让它适配PostgreSQL?
我参照如下文档,集成postgreSQL
http://bbs.wex5.com/forum.php?mo ... hlight=product-name
http://bbs.wex5.com/forum.php?mo ... ighlight=postgresql
|
|