zoukankan      html  css  js  c++  java
  • mybatis 使用@Select 注解,因为字符编码不一致导致mybatis 报错

    使用 mybatis 的@Select 注解,

    @Select({ "<script>select " + ALL_COLUMNS + " from " + TABLE_NAME,
                " where type = 2 and territory_id in "
                        + "<foreach collection='crmTerritoryIds' item='territoryId' index='index' open='(' close=')' "
                        + "separator=','>"
                        + "#{territoryId} </foreach></script>" })
        public List<Area> selectAreaByTerritoryIds(@Param("crmTerritoryIds") List<Long> crmTerritoryIds);

    跑单测提示我

    Parameter 'territoryId' not found

    可是我检查了无数遍语法,语法没有问题。

    最后发现是我的<script></script>的问题。

    我自己敲的是 utf-8的编码,而mybatis 之前代码生成的是 gbk 的编码。。。。这样的错误真不好找。

    我就是自己记一下,给自己提个醒~~~~好坑爹的问题,害的我查了一下午

  • 相关阅读:
    每天进步一小点
    C# 类
    XML JavaScript
    基础XML
    多态,重载,重写
    数据结构
    sql server规范
    .net core 使用TimeZoneInfo类的时间与时间戳转换
    git 重命名文件与文件夹
    IDEA spring boot 开启热加载
  • 原文地址:https://www.cnblogs.com/sonofelice/p/5341984.html
Copyright © 2011-2022 走看看