在用mybatis进行数据插入的时候遇到了这样的问题,入参里type是有0和1两种,后续还会有45678等等。
按照最初设想,如果type等于1或者3,就将第四个VALUE赋值为39,如果不是就赋值为63。这是打了断点之后的入参集合中的type截图。
于是写了如下的xml。
<insert id="initBossWarehousePermission">
REPLACE into t_staff_warehouse_billtype(owner_type, staffId, warehouseId, billType, stockReport) VALUES
<foreach collection="warehousePoList" item="item"