• java 使用mybatis plus 后执行时,字段名称都分离了,如下:


    1. 用mybatis plus ,连oracle ,程序执行时报错:
    2. 原本SQL是:select xtwldm,xtwlmc from xtm14的不知怎么,字段名称都分离了,都带下划线了?
    3. JDBC Connection [oracle.jdbc.driver.T4CConnection@2ea50632] will not be managed by Spring
    4. ==> Preparing: SELECT x_t_w_l_d_m,x_t_w_l_m_c FROM xtm14
    5. ==> Parameters:
    6. Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5ebffb44]
    7. org.springframework.jdbc.BadSqlGrammarException:
    8. ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
    9. ### The error may exist in com/erdos/dao/Xtm14Dao.java (best guess)
    10. ### The error may involve defaultParameterMap
    11. ### The error occurred while setting parameters
    12. ### SQL: SELECT x_t_w_l_d_m,x_t_w_l_m_c FROM xtm14
    13. ### Cause: java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
    14. ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: "X_T_W_L_M_C": 标识符无效
    15. 部分代码Xtm14Dao.java:
    16. package com.xxxx.dao;
    17. import com.baomidou.mybatisplus.core.mapper.BaseMapper;
    18. import com.xxxx.domain.xtm14;
    19. import org.apache.ibatis.annotations.Mapper;
    20. import org.apache.ibatis.annotations.Select;
    21. import java.util.List;
    22. @Mapper
    23. public interface Xtm14Dao extends BaseMapper {
    24. @Select(" select XTWLDM,XTWLMC from xtm14 ")
    25. public List GetYhjList();
    26. }

    只需要在application.yml里面增加下面的即可:

    mybatis-plus:
      configuration:
    #    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
        map-underscore-to-camel-case: false
  • 相关阅读:
    贪吃蛇(C语言版)链表实现
    电气工程的标准是什么
    c语言中各类指针的总结
    STM32 大小端与字节对齐使用记录
    LintCode 1394 · Goat Latin (字符串处理题)
    【C++笔记】C++三大特性之多态的概念、定义及使用
    如何找回这个辅助窗口
    opencv dots_image_kernel
    阿里云冯诗淳:ACK容器服务生产及可观测体系的建设与实践
    matlab矩阵的输入
  • 原文地址:https://blog.csdn.net/handsome1234/article/details/126454016