sfd
2025-05-26 2a64b537e8e3bce9ce030585a3da17d48379c0ad
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?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="com.aps.core.mapper.ApsGasMaterialUsageMapper">
    <resultMap type="com.aps.core.domain.ApsGasMaterialUsage" id="ApsGasMaterialUsageResult">
        <result property="id"    column="id"    />
        <result property="itemNumber"    column="item_number"    />
        <result property="drawingNo"    column="drawing_no"    />
        <result property="version"    column="version"    />
        <result property="processName"    column="process_name"    />
        <result property="standardAmount"    column="standard_amount"    />
        <result property="orgCode"    column="org_code"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>
 
    <sql id="selectApsGasMaterialUsageVo">
        select id, item_number, drawing_no, version, process_name, standard_amount, org_code, create_by, create_time, del_flag from aps_gas_material_usage
    </sql>
 
    <select id="selectApsGasMaterialUsageList" parameterType="com.aps.core.domain.ApsGasMaterialUsage" resultMap="ApsGasMaterialUsageResult">
        <include refid="selectApsGasMaterialUsageVo"/>
        <where>
            <if test="itemNumber != null  and itemNumber != ''"> and item_number = #{itemNumber}</if>
            <if test="drawingNo != null  and drawingNo != ''"> and drawing_no = #{drawingNo}</if>
            <if test="version != null  and version != ''"> and version = #{version}</if>
            <if test="processName != null  and processName != ''"> and process_name = #{processName}</if>
            <if test="standardAmount != null "> and standard_amount = #{standardAmount}</if>
            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
            and del_flag='0'
        </where>
    </select>
 
    <select id="selectApsGasMaterialUsageById" parameterType="Long" resultMap="ApsGasMaterialUsageResult">
        <include refid="selectApsGasMaterialUsageVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertApsGasMaterialUsage" parameterType="com.aps.core.domain.ApsGasMaterialUsage" useGeneratedKeys="true" keyProperty="id">
        insert into aps_gas_material_usage
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="itemNumber != null">item_number,</if>
            <if test="drawingNo != null">drawing_no,</if>
            <if test="version != null">version,</if>
            <if test="processName != null">process_name,</if>
            <if test="standardAmount != null">standard_amount,</if>
            <if test="orgCode != null">org_code,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="delFlag != null">del_flag,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="itemNumber != null">#{itemNumber},</if>
            <if test="drawingNo != null">#{drawingNo},</if>
            <if test="version != null">#{version},</if>
            <if test="processName != null">#{processName},</if>
            <if test="standardAmount != null">#{standardAmount},</if>
            <if test="orgCode != null">#{orgCode},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="delFlag != null">#{delFlag},</if>
        </trim>
    </insert>
 
    <update id="updateApsGasMaterialUsage" parameterType="com.aps.core.domain.ApsGasMaterialUsage">
        update aps_gas_material_usage
        <trim prefix="SET" suffixOverrides=",">
            <if test="itemNumber != null">item_number = #{itemNumber},</if>
            <if test="drawingNo != null">drawing_no = #{drawingNo},</if>
            <if test="version != null">version = #{version},</if>
            <if test="processName != null">process_name = #{processName},</if>
            <if test="standardAmount != null">standard_amount = #{standardAmount},</if>
            <if test="orgCode != null">org_code = #{orgCode},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteApsGasMaterialUsageById" parameterType="Long">
        delete from aps_gas_material_usage where id = #{id}
    </delete>
 
    <delete id="deleteApsGasMaterialUsageByIds" parameterType="String">
        delete from aps_gas_material_usage where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
 
 
    <!-- 新增批量插入方法 -->
    <insert id="batchInsertGasMaterialUsage" parameterType="java.util.List">
        insert into aps_gas_material_usage (item_number, drawing_no, version
        , process_name, standard_amount, org_code, del_flag, create_by, create_time)
        values
        <foreach collection="list" item="item" separator=",">
         (
                #{item.itemNumber},
                #{item.drawingNo},
                #{item.version},
                #{item.processName},
                #{item.standardAmount},
                #{item.orgCode},
                #{item.delFlag},
                #{item.createBy},
                #{item.createTime}
        )
        </foreach>
    </insert>
 
    <delete id="batchDeleteGasMaterialUsage" >
       delete  from aps_gas_material_usage   where del_flag in ('0','1');
    </delete>
 
</mapper>