sprintboot+mybatis+@Mapper中in的使用方法

错误的使用方法:

 @Select("select goods_sn from ${tableName} where goods_sn in (#{skuStr})")
 public List<String> selectForAlgorithm(@Param("skuStr") String skuStr,@Param("tableName") String tableName);

正确的使用方法:

 @SelectProvider(type = DWebsiteProvider.class,method="selectForAlgorithm")
 public List<String> selectForAlgorithm(@Param("skuStr") String skuStr,@Param("tableName") String tableName);

之后在DWebsiteProvider类中添加如下方法:

  public String selectForAlgorithm(String skuStr,String tableName){
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("select goods_sn from "+tableName+" where goods_sn in ("+skuStr+");");
        return stringBuilder.toString();
    }

 

sprintboot+mybatis+@Mapper中in的使用方法

上一篇:Android报错:java.lang.OutOfMemoryError: Failed to allocate a 74126220 byte allocation with 4190480 free bytes and 61MB until OOM


下一篇:详解C++引用——带你走进引用的世界