id, namespace_id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt MERGE INTO server_node AS target USING ( VALUES ( #{item.namespaceId,jdbcType=VARCHAR}, #{item.groupName,jdbcType=VARCHAR}, #{item.hostId,jdbcType=VARCHAR}, #{item.hostIp,jdbcType=VARCHAR}, #{item.hostPort,jdbcType=INTEGER}, #{item.expireAt,jdbcType=TIMESTAMP}, #{item.nodeType,jdbcType=TINYINT}, #{item.extAttrs,jdbcType=VARCHAR}, #{item.contextPath,jdbcType=VARCHAR}, #{item.createDt,jdbcType=TIMESTAMP} ) ) AS source (namespace_id, group_name, host_id, host_ip, host_port, expire_at, node_type, ext_attrs, context_path, create_dt) ON target.namespace_id = source.namespace_id AND target.group_name = source.group_name AND target.host_id = source.host_id WHEN MATCHED THEN UPDATE SET target.expire_at = source.expire_at, target.update_dt = GETDATE() WHEN NOT MATCHED THEN INSERT (namespace_id, group_name, host_id, host_ip, host_port, expire_at, node_type, ext_attrs, context_path, create_dt, update_dt) VALUES (source.namespace_id, source.group_name, source.host_id, source.host_ip, source.host_port, source.expire_at, source.node_type, source.ext_attrs, source.context_path, source.create_dt, GETDATE()); DELETE FROM server_node WHERE expire_at <= #{endTime,jdbcType=TIMESTAMP}