mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 20:22:12 +08:00
fix issue:
* [issue #662] Fix deadlocks caused by adding data using MySQL's REPLACE method
This commit is contained in:
@@ -4,7 +4,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.health.HealthCheckResultPO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface HealthCheckResultDAO extends BaseMapper<HealthCheckResultPO> {
|
||||
int replace(HealthCheckResultPO healthCheckResultPO);
|
||||
|
||||
int batchReplace(List<HealthCheckResultPO> healthCheckResultPos);
|
||||
}
|
||||
|
||||
@@ -20,4 +20,16 @@
|
||||
VALUES
|
||||
(#{dimension}, #{configName}, #{clusterPhyId}, #{resName}, #{passed})
|
||||
</insert>
|
||||
|
||||
<insert id="batchReplace">
|
||||
insert into ks_km_health_check_result (dimension, config_name, cluster_phy_id, res_name, passed)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.dimension}, #{item.configName}, #{item.clusterPhyId}, #{item.resName}, #{item.passed})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
dimension = dimension, config_name = config_name, cluster_phy_id = cluster_phy_id,
|
||||
res_name = res_name, passed = passed
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user