mybatis 存在则更新数据,不存在则插入数据
insert into ups_battery(id, create_by,create_time,update_by,update_time, dept_id,dept_name,user_id,nick_name,order_id, resistance,temperature,volt,machine_code,status,warn_type) values <foreach collection="list" index="index" item="item" separator=","> ( #{item.id}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.deptId}, #{item.deptName}, #{item.userId}, #{item.nickName}, #{item.orderId}, #{item.resistance}, #{item.temperature}, #{item.volt}, #{item.machineCode}, #{item.status}, #{item.warnType} ) </foreach> ON DUPLICATE KEY UPDATE create_by=values(create_by), create_time=values(create_time), update_by=values(update_by), update_time=values(update_time), dept_id=values(dept_id), dept_name=values(dept_name), user_id=values(user_id), nick_name=values(nick_name), order_id=values(order_id), resistance=values(resistance), temperature=values(temperature), volt=values(volt), machine_code=values(machine_code), status=values(status), warn_type=values(warn_type)