阿伏兔
2024-08-28 c2e2ce9e6e64d6d88de294afbaa09c3d6c2a2df5
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
<?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.basicSetup.mapper.SysStandardCategoryMapper">
    
    <resultMap type="SysStandardCategory" id="SysStandardCategoryResult">
        <result property="id"    column="id"    />
        <result property="categoryName"    column="category_name"    />
        <result property="categoryCode"    column="category_code"    />
        <result property="dataType"    column="data_type"    />
        <result property="showAlarm"    column="show_alarm"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>
 
    <sql id="selectSysStandardCategoryVo">
        select id, category_name, category_code, data_type, show_alarm, create_by, create_time, update_by, update_time, remark from sys_standard_category
    </sql>
 
    <select id="selectSysStandardCategoryList" parameterType="SysStandardCategory" resultMap="SysStandardCategoryResult">
        <include refid="selectSysStandardCategoryVo"/>
        <where>  
            <if test="categoryName != null  and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
            <if test="categoryCode != null  and categoryCode != ''"> and category_code like concat('%', #{categoryCode}, '%')</if>
            <if test="dataType != null  and dataType != ''"> and data_type like concat('%', #{dataType}, '%')</if>
            <if test="showAlarm != null  and showAlarm != ''"> and show_alarm like concat('%', #{showAlarm}, '%')</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectSysStandardCategoryById" parameterType="String" resultMap="SysStandardCategoryResult">
        <include refid="selectSysStandardCategoryVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSysStandardCategory" parameterType="SysStandardCategory">
        insert into sys_standard_category
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">id,</if>
            <if test="categoryName != null  and categoryName != ''">category_name,</if>
            <if test="categoryCode != null  and categoryCode != ''">category_code,</if>
            <if test="dataType != null  and dataType != ''">data_type,</if>
            <if test="showAlarm != null  and showAlarm != ''">show_alarm,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="remark != null  and remark != ''">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null  and id != ''">#{id},</if>
            <if test="categoryName != null  and categoryName != ''">#{categoryName},</if>
            <if test="categoryCode != null  and categoryCode != ''">#{categoryCode},</if>
            <if test="dataType != null  and dataType != ''">#{dataType},</if>
            <if test="showAlarm != null  and showAlarm != ''">#{showAlarm},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
         </trim>
    </insert>
 
    <update id="updateSysStandardCategory" parameterType="SysStandardCategory">
        update sys_standard_category
        <trim prefix="SET" suffixOverrides=",">
            <if test="categoryName != null  and categoryName != ''">category_name = #{categoryName},</if>
            <if test="categoryCode != null  and categoryCode != ''">category_code = #{categoryCode},</if>
            <if test="dataType != null  and dataType != ''">data_type = #{dataType},</if>
            <if test="showAlarm != null  and showAlarm != ''">show_alarm = #{showAlarm},</if>
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteSysStandardCategoryById" parameterType="String">
        delete from sys_standard_category where id = #{id}
    </delete>
 
    <delete id="deleteSysStandardCategoryByIds" parameterType="String">
        delete from sys_standard_category where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>