|
@@ -2,8 +2,20 @@ package com.etotem.cfc.mapper;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
|
import com.etotem.cfc.entity.IndicatorValue;
|
|
import com.etotem.cfc.entity.IndicatorValue;
|
|
|
-import org.apache.ibatis.annotations.Mapper;
|
|
|
|
|
|
|
+import org.apache.ibatis.annotations.Insert;
|
|
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
|
|
|
|
|
-@Mapper
|
|
|
|
|
public interface IndicatorValueMapper extends BaseMapper<IndicatorValue> {
|
|
public interface IndicatorValueMapper extends BaseMapper<IndicatorValue> {
|
|
|
|
|
+
|
|
|
|
|
+ /** 幂等写:同 (source_type, source_id, definition_id) 覆盖更新(uk_source_definition) */
|
|
|
|
|
+ @Insert("INSERT INTO indicator_values " +
|
|
|
|
|
+ "(source_type, source_id, definition_id, value, numeric_value, remark, " +
|
|
|
|
|
+ " subject_id, family_id, report_id, report_date, unit, status, recorded_at) " +
|
|
|
|
|
+ "VALUES (#{v.sourceType}, #{v.sourceId}, #{v.definitionId}, #{v.value}, #{v.numericValue}, #{v.remark}, " +
|
|
|
|
|
+ " #{v.subjectId}, #{v.familyId}, #{v.reportId}, #{v.reportDate}, #{v.unit}, #{v.status}, NOW()) " +
|
|
|
|
|
+ "ON DUPLICATE KEY UPDATE " +
|
|
|
|
|
+ " value = VALUES(value), numeric_value = VALUES(numeric_value), remark = VALUES(remark), " +
|
|
|
|
|
+ " subject_id = VALUES(subject_id), family_id = VALUES(family_id), report_id = VALUES(report_id), " +
|
|
|
|
|
+ " report_date = VALUES(report_date), unit = VALUES(unit), status = VALUES(status), recorded_at = NOW()")
|
|
|
|
|
+ int upsertMapping(@Param("v") IndicatorValue v);
|
|
|
}
|
|
}
|