liulingling.177216
2024-08-26 349f1cfc5fa77fbc636d542df0d8050fddec48c2
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
<?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.dingzhuo.energy.project.EnergyBenchmarking.mapper.EnergyBenchmarkingMapper">
    
    <resultMap type="EnergyBenchmarking" id="EnergyBenchmarkingResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="codeId"    column="code_id"    />
        <result property="unit"    column="unit"    />
        <result property="range"    column="range"    />
        <result property="type"    column="type"    />
        <result property="value"    column="value"    />
        <result property="termValidity"    column="term_validity"    />
        <result property="modelNode"    column="model_node"    />
    </resultMap>
 
    <sql id="selectEnergyBenchmarkingVo">
        select id, name, code_id, unit, range, type, value, term_validity,model_node from energy_benchmarking
    </sql>
 
    <select id="selectEnergyBenchmarkingList" parameterType="EnergyBenchmarking" resultMap="EnergyBenchmarkingResult">
        <include refid="selectEnergyBenchmarkingVo"/>
        <where>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="modelNode != null  and modelNode != ''"> and model_node like concat('%', #{modelNode}, '%')</if>
            <if test="codeId != null  and codeId != ''"> and code_id like concat('%', #{codeId}, '%')</if>
            <if test="unit != null  and unit != ''"> and unit like concat('%', #{unit}, '%')</if>
            <if test="range != null  and range != ''"> and range like concat('%', #{range}, '%')</if>
            <if test="type != null  and type != ''"> and type like concat('%', #{type}, '%')</if>
            <if test="value != null  and value != ''"> and value like concat('%', #{value}, '%')</if>
            <if test="termValidity != null "> and term_validity like concat('%', #{termValidity}, '%')</if>
        </where>
    </select>
    
    <select id="selectEnergyBenchmarkingById" parameterType="String" resultMap="EnergyBenchmarkingResult">
        <include refid="selectEnergyBenchmarkingVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertEnergyBenchmarking" parameterType="EnergyBenchmarking">
        insert into energy_benchmarking
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="name != null  and name != ''">name,</if>
            <if test="codeId != null  and codeId != ''">code_id,</if>
            <if test="unit != null  and unit != ''">unit,</if>
            <if test="range != null  and range != ''">range,</if>
            <if test="type != null  and type != ''">type,</if>
            <if test="value != null  and value != ''">value,</if>
            <if test="termValidity != null ">term_validity,</if>
            <if test="modelNode != null ">model_node,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="name != null  and name != ''">#{name},</if>
            <if test="codeId != null  and codeId != ''">#{codeId},</if>
            <if test="unit != null  and unit != ''">#{unit},</if>
            <if test="range != null  and range != ''">#{range},</if>
            <if test="type != null  and type != ''">#{type},</if>
            <if test="value != null  and value != ''">#{value},</if>
            <if test="termValidity != null ">#{termValidity},</if>
            <if test="modelNode != null ">#{modelNode},</if>
         </trim>
    </insert>
 
    <update id="updateEnergyBenchmarking" parameterType="EnergyBenchmarking">
        update energy_benchmarking
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null  and name != ''">name = #{name},</if>
            <if test="codeId != null  and codeId != ''">code_id = #{codeId},</if>
            <if test="unit != null  and unit != ''">unit = #{unit},</if>
            <if test="range != null  and range != ''">range = #{range},</if>
            <if test="type != null  and type != ''">type = #{type},</if>
            <if test="value != null  and value != ''">value = #{value},</if>
            <if test="termValidity != null ">term_validity = #{termValidity},</if>
            <if test="modelNode != null ">model_node= #{modelNode},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteEnergyBenchmarkingById" parameterType="String">
        delete from energy_benchmarking where id = #{id}
    </delete>
 
    <delete id="deleteEnergyBenchmarkingByIds" parameterType="String">
        delete from energy_benchmarking where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>