使用 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 的编码。。。。这样的错误真不好找。

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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
  • 2021-05-24
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
猜你喜欢
  • 2022-12-23
  • 2021-08-18
  • 2023-02-04
  • 2022-12-23
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
相关资源
相似解决方案