代码如下 :
1.mapper.xml 文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="***.RepaymentFlowMapper"><sql id="values"><foreach item="item" collection="zhis" separator="," >#{item, jdbcType=VARCHAR}</foreach></sql><insert id="insertRepaymentFlow" parameterType="Map" >insert into T_REPAYMENT_FLOW (<foreach collection="cloums" item="listItem" separator=",">${listItem}</foreach>)values (<include refid="values"/> )</insert></mapper>
2.mapper 接口
void insertRepaymentFlow(Map<String,List<String>> fieldValues);
3.service 接口
void insertRepaymentFlow(Map<String,List<String>> fieldValues);
4.service 实现类
public void insertRepaymentFlow(Map<String, List<String>> fieldValues) {fieldValues = new HashMap<>();List<String> fileds = new ArrayList<>();fileds.add("REPAYMENT_FLOW_ID");fileds.add("ORDER_NO");fileds.add("BANK_LOAN_NO");fieldValues.put("cloums",fileds);List<String> values = new ArrayList<>();values.add("0002");values.add("0001");values.add("0001");fieldValues.put("zhis",values);repaymentFlowMapper.insertRepaymentFlow(fieldValues);}
参考链接:
https://blog.csdn.net/banjuer/article/details/80707927
https://www.cnblogs.com/wangchuanfu/p/5877169.html
https://www.cnblogs.com/jiangyi666/p/5993632.html
https://blog.csdn.net/weixin_43171019/article/details/84641583