sugar连oracle,生成的sql不正确 返回

SqlSugar 沟通中
30 549

sugar连oracle,生成的sql不正确

热忱回答30

  • fate sta fate sta VIP0
    2023/11/17

    把问题描述清楚

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    用sqlsugar链接oracle生成的语句不正确,

     SELECT "USER_NAME","USER_PASSWORD","EMPLOYEE_NAME","IS_SUPER_ADMIN","LAST_LOGIN_TIME","CREATE_USER","CREATE_TIME","ID",ROW_NUMBER() OVER(ORDER BY sysdate ) AS RowIndex  FROM "WES_CONFIG_USER"  WHERE (( "USER_NAME" = "admin" ) AND ( "IS_SUPER_ADMIN" = false )) AND   ROWNUM = 1 

    不能在oracle上执行

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    升级最新试一下 

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    117版本

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate sta:升级了,还是不行

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    截图SQL

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    用这个打印SQL UtilMethods.GetNativeSql(sql,pars)

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate staSELECT "USER_NAME","USER_PASSWORD","EMPLOYEE_NAME","IS_SUPER_ADMIN","LAST_LOGIN_TIME","CREATE_USER","CREATE_TIME","ID",ROW_NUMBER() OVER(ORDER BY sysdate ) AS RowIndex  FROM "WES_CONFIG_USER"  WHERE (( "USER_NAME" = "admin" ) AND ( "IS_SUPER_ADMIN" = false )) AND   ROWNUM = 1 

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    UtilMethods.GetNativeSql(sql,pars)

    用这个打印

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    你这个不是ORM打印出来的SQL

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate staimage.png

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate sta:现在截图了

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    这个sql没有问题报什么错

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    还有你的代码截图

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    image.png

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    这个我用117版本生成的SQL 

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    https://www.donet5.com/Home/Doc?typeId=2366


    还有问题可以按上面模版写一个可以重现的DEMO

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate sta:生成的sql拿到oracle去执行,肯定报问题,字段名,表名都要小写,生成出来的是大写

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate staimage.png

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate staimage.png

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    你这个表不存在错误

    0 回复
  • fate sta fate sta VIP0
    2023/11/17
     SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
     {
           DbType = DbType.Oracle,
           ConnectionString = "Data Source=localhost/orcl;User ID=system;Password=haha",
           IsAutoCloseConnection = true,
           MoreSettings=new ConnMoreSettings() { 
               IsAutoToUpper=false //禁用自动转成大写表 5.1.3.41-preview04
           }
       });


    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    可以禁用转大写的

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate sta:表是存在的,要小写表名,大写表名它识别不出来

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate staimage.png

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/17

    @fate sta:Id没有转换过来

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    上面代码不是让你禁大写了吗

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    image.png

    0 回复
  • fate sta fate sta VIP0
    2023/11/17

    然后你sugartable里面是什么就是什么样

    0 回复
  • 寒旭 寒旭 VIP0
    2023/11/20

    @fate sta:谢谢!已经解决!

    0 回复