zoukankan      html  css  js  c++  java
  • 记录工作中sharing sphere/mybatis遇到的坑

    首先是如下这段sql,在navicat中执行没有问题,但是程序跑起来会出现映射问题,6个字段只有前2个能够成功映射

       select
            max(t.identification_name_encrypt) identificationName,
            trim(t.identification_num_encrypt) identificationNum ,
            sum(t.amount) amount ,
            t.org_id  orgId,
            max(t.org_name) orgName ,
            t.cal_rule calRule
            from  (
            select
            ia.identification_name_encrypt identificationName ,
            ia.identification_num_encrypt identificationNum ,
            ia.amount amount,
            cc.org_id orgId,
            cc.org_name orgName,
            cc.cal_rule calRule
            from labor_tax_channel_income_amount ia join
            labor_tax_channel_config cc on (ia.source_channel=cc.source_channel)  where cc.is_deleted=0 and ia.is_deleted=0 and period_name=#{periodName}
    

    把trim函数删掉后恢复正常,猜测是mybatis sql解析问题

    还是这段sql,发现在后面加了t.xxx后报错Can not find owner from table,错误来源是sharing sphere,但是在navicat执行依然是没问题的

       select
            max(t.identification_name_encrypt) identificationName,
            trim(t.identification_num_encrypt) identificationNum ,
            sum(t.amount) amount ,
            t.org_id  orgId,
            max(t.org_name) orgName ,
            t.cal_rule calRule
            from  (
            select
            ia.identification_name_encrypt identificationName ,
            ia.identification_num_encrypt identificationNum ,
            ia.amount amount,
            cc.org_id orgId,
            cc.org_name orgName,
            cc.cal_rule calRule
            from labor_tax_channel_income_amount ia join
            labor_tax_channel_config cc on (ia.source_channel=cc.source_channel)  where cc.is_deleted=0 and ia.is_deleted=0 and period_name=#{periodName})
            as t
            group by t.identificationNum,t.calRule,t.orgId
    
    

    上网一搜,发现其他人遇到过同样问题,提了issue,但是没能得到解决https://github.com/baomidou/mybatis-plus/issues/2585

  • 相关阅读:
    iOS,Layer
    iOS 手势冲突
    ECharts
    手动安装Package Control
    webstorm配置svn详解
    js 对象 类型转换
    google 跨域解决办法
    关于内层DIV设置margin-top不起作用的解决方案
    图片与文字在div里实现垂直水平都居中
    css3之3D翻牌效果
  • 原文地址:https://www.cnblogs.com/CodeSpike/p/15153198.html
Copyright © 2011-2022 走看看