BOM
hdy
2024-11-27 3d0e64b5192509aa6e5c66192d75dacd9dcd1044
提交 | 用户 | 时间
9d822f 1 <?xml version="1.0" encoding="UTF-8" ?>
A 2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.billion.main.da.mapper.DaMaterialCollectionMapper">
6     
7     <resultMap type="DaMaterialCollection" id="DaMaterialCollectionResult">
8         <result property="id"    column="id"    />
9         <result property="sfcCode"    column="sfc_code"    />
10         <result property="locationCode"    column="location_code"    />
11         <result property="paramCode"    column="param_code"    />
12         <result property="paramName"    column="param_name"    />
13         <result property="paramValue"    column="param_value"    />
14         <result property="collectTime"    column="collect_time"    />
15     </resultMap>
16
17     <sql id="selectDaMaterialCollectionVo">
18         select id, sfc_code, location_code, param_code, param_name, param_value, collect_time from da_material_collection
19     </sql>
20
21     <select id="selectDaMaterialCollectionList" parameterType="DaMaterialCollection" resultMap="DaMaterialCollectionResult">
22         <include refid="selectDaMaterialCollectionVo"/>
23         <where>  
24             <if test="sfcCode != null  and sfcCode != ''"> and sfc_code = #{sfcCode}</if>
25             <if test="locationCode != null  and locationCode != ''"> and location_code like concat('%', #{locationCode}, '%')</if>
26             <if test="paramCode != null  and paramCode != ''"> and param_code like concat('%', #{paramCode}, '%')</if>
27             <if test="paramName != null  and paramName != ''"> and param_name like concat('%', #{paramName}, '%')</if>
28         </where>
29     </select>
30     
31     <select id="selectDaMaterialCollectionById" parameterType="Long" resultMap="DaMaterialCollectionResult">
32         <include refid="selectDaMaterialCollectionVo"/>
33         where id = #{id}
34     </select>
35
36     <insert id="insertDaMaterialCollection" parameterType="DaMaterialCollection" useGeneratedKeys="true" keyProperty="id">
37         insert into da_material_collection
38         <trim prefix="(" suffix=")" suffixOverrides=",">
39             <if test="sfcCode != null">sfc_code,</if>
40             <if test="locationCode != null">location_code,</if>
41             <if test="paramCode != null">param_code,</if>
42             <if test="paramName != null">param_name,</if>
43             <if test="paramValue != null">param_value,</if>
44             <if test="collectTime != null">collect_time,</if>
45          </trim>
46         <trim prefix="values (" suffix=")" suffixOverrides=",">
47             <if test="sfcCode != null">#{sfcCode},</if>
48             <if test="locationCode != null">#{locationCode},</if>
49             <if test="paramCode != null">#{paramCode},</if>
50             <if test="paramName != null">#{paramName},</if>
51             <if test="paramValue != null">#{paramValue},</if>
52             <if test="collectTime != null">#{collectTime},</if>
53          </trim>
54     </insert>
55
56     <update id="updateDaMaterialCollection" parameterType="DaMaterialCollection">
57         update da_material_collection
58         <trim prefix="SET" suffixOverrides=",">
59             <if test="sfcCode != null">sfc_code = #{sfcCode},</if>
60             <if test="locationCode != null">location_code = #{locationCode},</if>
61             <if test="paramCode != null">param_code = #{paramCode},</if>
62             <if test="paramName != null">param_name = #{paramName},</if>
63             <if test="paramValue != null">param_value = #{paramValue},</if>
64             <if test="collectTime != null">collect_time = #{collectTime},</if>
65         </trim>
66         where id = #{id}
67     </update>
68
69     <delete id="deleteDaMaterialCollectionById" parameterType="Long">
70         delete from da_material_collection where id = #{id}
71     </delete>
72
73     <delete id="deleteDaMaterialCollectionByIds" parameterType="String">
74         delete from da_material_collection where id in 
75         <foreach item="id" collection="array" open="(" separator="," close=")">
76             #{id}
77         </foreach>
78     </delete>
79 </mapper>