Model
public class FastDFSModel {
private String pathId;
private String modelId;
private String csvpath;
private String resultpath;
private String updatetime;
}
Dao
import org.apache.ibatis.annotations.Param;
void deleteDateById(@Param("list") List deleteList);
mapper
其中parameterType写为list foreach 中的collection写为"list" item 为遍历的每一项,代表着model 在变量中用#{item.pathId}来获取值 此业务为通过id进行删除 其中open="(" separator="," close=")"为拼接的in查询,把id用逗号拼接起来
delete from T_FASTDFS_PATH t where t.path_id in
#{item.pathId,jdbcType=VARCHAR}
控制台打印如下
delete from T_FASTDFS_PATH t where t.path_id in ( ? , ? , ? )
PreparedStatement - ==> Parameters: 2(String), 1(String), 3(String)