xiangpei
2024-04-07 1d14ba39daf0422199c44b5b2ffc67d2364b2be2
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
<?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.ycl.platform.mapper.DefaultPublishMapper">
    
    <resultMap type="com.ycl.platform.domain.entity.DefaultPublish" id="DefaultPublishResult">
        <result property="id"    column="id"    />
        <result property="examineName"    column="examine_name"    />
        <result property="templateId"    column="template_id"    />
        <result property="frequency"    column="frequency"    />
        <result property="alarmScore"    column="alarm_score"    />
        <result property="description"    column="description"    />
        <result property="state"    column="state"    />
        <result property="auditState"    column="audit_state"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectDefaultPublishVo">
        select id, examine_name, template_id, frequency, alarm_score, description, state, audit_state, create_time, update_time from t_default_publish
    </sql>
 
    <select id="selectDefaultPublishList" resultMap="DefaultPublishResult">
        <include refid="selectDefaultPublishVo"/>
        <where>  
            <if test="examineName != null  and examineName != ''"> and examine_name like concat('%', #{examineName}, '%')</if>
            <if test="templateId != null "> and template_id = #{templateId}</if>
            <if test="frequency != null "> and frequency = #{frequency}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="auditState != null "> and audit_state = #{auditState}</if>
        </where>
    </select>
    
    <select id="selectDefaultPublishById" resultMap="DefaultPublishResult">
        <include refid="selectDefaultPublishVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertDefaultPublish"  useGeneratedKeys="true" keyProperty="id">
        insert into t_default_publish
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="examineName != null">examine_name,</if>
            <if test="templateId != null">template_id,</if>
            <if test="frequency != null">frequency,</if>
            <if test="alarmScore != null">alarm_score,</if>
            <if test="description != null">description,</if>
            <if test="state != null">state,</if>
            <if test="auditState != null">audit_state,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="examineName != null">#{examineName},</if>
            <if test="templateId != null">#{templateId},</if>
            <if test="frequency != null">#{frequency},</if>
            <if test="alarmScore != null">#{alarmScore},</if>
            <if test="description != null">#{description},</if>
            <if test="state != null">#{state},</if>
            <if test="auditState != null">#{auditState},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
 
    <update id="updateDefaultPublish" >
        update t_default_publish
        <trim prefix="SET" suffixOverrides=",">
            <if test="examineName != null">examine_name = #{examineName},</if>
            <if test="templateId != null">template_id = #{templateId},</if>
            <if test="frequency != null">frequency = #{frequency},</if>
            <if test="alarmScore != null">alarm_score = #{alarmScore},</if>
            <if test="description != null">description = #{description},</if>
            <if test="state != null">state = #{state},</if>
            <if test="auditState != null">audit_state = #{auditState},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteDefaultPublishById" >
        delete from t_default_publish where id = #{id}
    </delete>
 
    <delete id="deleteDefaultPublishByIds" >
        delete from t_default_publish where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>