广丰卷烟厂数采质量分析系统
baoshiwei
13 小时以前 d143af7023cfd4a0ced6f0ecf04ae3b3a06fd1dc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.qa.md.mapper.CalibrationRecordMapper">
 
    <resultMap type="org.dromara.qa.md.domain.CalibrationRecord" id="CalibrationRecordResult">
        <id property="id" column="id"/>
        <result property="targetType" column="target_type"/>
        <result property="targetId" column="target_id"/>
        <result property="targetCode" column="target_code"/>
        <result property="targetName" column="target_name"/>
        <result property="calibDate" column="calib_date"/>
        <result property="calibCycleDays" column="calib_cycle_days"/>
        <result property="standardWeight" column="standard_weight"/>
        <result property="actualWeight" column="actual_weight"/>
        <result property="deviation" column="deviation"/>
        <result property="deviationPct" column="deviation_pct"/>
        <result property="prevCalibDate" column="prev_calib_date"/>
        <result property="nextCalibDate" column="next_calib_date"/>
        <result property="batchId" column="batch_id"/>
        <result property="note" column="note"/>
        <result property="operator" column="operator"/>
        <result property="createTime" column="create_time"/>
    </resultMap>
 
    <sql id="selectCalibrationRecordVo">
        select id, target_type, target_id, target_code, target_name, calib_date, calib_cycle_days, standard_weight, actual_weight, deviation, deviation_pct, prev_calib_date, next_calib_date, batch_id, note, operator, create_time from qm_calibration_record
    </sql>
 
    <select id="selectCalibrationRecordList" parameterType="org.dromara.qa.md.domain.CalibrationRecord" resultMap="CalibrationRecordResult">
        <include refid="selectCalibrationRecordVo"/>
        <where>
            <if test="targetType != null and targetType != ''">
                and target_type = #{targetType}
            </if>
            <if test="targetId != null">
                and target_id = #{targetId}
            </if>
            <if test="calibDate != null">
                and calib_date = #{calibDate}
            </if>
            <if test="batchId != null and batchId != ''">
                and batch_id = #{batchId}
            </if>
        </where>
        order by calib_date desc
    </select>
 
    <select id="selectByTargetId" resultMap="CalibrationRecordResult">
        <include refid="selectCalibrationRecordVo"/>
        where target_type = #{targetType} and target_id = #{targetId}
        order by calib_date desc
    </select>
 
    <insert id="batchInsert" parameterType="java.util.List">
        insert into qm_calibration_record (target_type, target_id, target_code, target_name, calib_date, calib_cycle_days, standard_weight, actual_weight, deviation, deviation_pct, prev_calib_date, next_calib_date, batch_id, note, operator, create_time)
        values
        <foreach collection="list" item="item" separator=",">
            (#{item.targetType}, #{item.targetId}, #{item.targetCode}, #{item.targetName}, #{item.calibDate}, #{item.calibCycleDays}, #{item.standardWeight}, #{item.actualWeight}, #{item.deviation}, #{item.deviationPct}, #{item.prevCalibDate}, #{item.nextCalibDate}, #{item.batchId}, #{item.note}, #{item.operator}, #{item.createTime})
        </foreach>
    </insert>
 
</mapper>