修改批量插入数据时,使用mybatis 自带的saveBatch方法保存

This commit is contained in:
duwenyuan 2025-06-03 18:12:15 +08:00
parent b38c4abb0d
commit 95118bcc8e
4 changed files with 3 additions and 30 deletions

View File

@ -41,7 +41,7 @@ public class GardsCalibration implements Serializable {
/**
* 拟合方程ID号统一定义
*/
@TableField(value = "FUNCTION")
@TableField(value = "\"FUNCTION\"")
private Integer function;
/**
* 拟合方程描述

View File

@ -2,6 +2,7 @@ package org.jeecg.modules.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.base.entity.rnauto.GardsCalibration;
@ -11,6 +12,4 @@ public interface GardsCalibrationMapper extends BaseMapper<GardsCalibration> {
@InterceptorIgnore(tenantLine = "true")
public int create(@Param("calibration") GardsCalibration calibration);
@InterceptorIgnore(tenantLine = "true")
public int createBatch(@Param("calibrations") List<GardsCalibration> calibration);
}

View File

@ -31,32 +31,6 @@
#{calibration.moddate})
</insert>
<insert id="createBatch" parameterType="org.jeecg.modules.base.entity.rnauto.GardsCalibration">
insert into RNAUTO.GARDS_CALIBRATION(
SAMPLE_ID,
IDANALYSIS,
SAMPLE_TYPE,
CALTYPE,
FUNCTION,
FUNCTIONDEF,
STARTOFRANGE,
ENDOFRANGE,
COEFF_STRING,
moddate)
values
<foreach collection="calibrations" separator="," item="calibration">
(#{calibration.sampleId},
#{calibration.idAnalysis},
#{calibration.sampleType},
#{calibration.calType},
#{calibration.function},
#{calibration.functionDef},
#{calibration.startOfRange},
#{calibration.endOfRange},
#{calibration.coeffString},
#{calibration.moddate})
</foreach>
</insert>
</mapper>

View File

@ -48,7 +48,7 @@ public class GardsCalibrationServiceImpl extends ServiceImpl<GardsCalibrationMap
@Override
public void createBatch(List<GardsCalibration> calibrations) {
this.baseMapper.createBatch(calibrations);
this.saveBatch(calibrations);
}
/**