<?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.usky.rule.mapper.RuleEngineLogMapper">
    <resultMap id="Base" type="com.usky.rule.domain.RuleEngineLog">
        <id column="id" property="id"/>
        <result column="project_id" property="projectId"/>
        <result column="rule_engine_id" property="ruleEngineId"/>
        <result column="rule_engine_name" property="ruleEngineName"/>
        <result column="auto_trigger" property="autoTrigger"/>
        <result column="trigger_type" property="triggerType"/>
        <result column="action" property="action"/>
        <result column="detail" property="detail"/>
        <result column="content" property="content"/>
        <result column="time" property="time"/>
        <result column="updated_by" property="updatedBy"/>
        <result column="update_time" property="updateTime"/>
        <result column="created_by" property="createdBy"/>
        <result column="create_time" property="createTime"/>
        <result column="tenant_id" property="tenantId"/>
    </resultMap>

    <insert id="insert" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO rule_engine_log (project_id, rule_engine_id, rule_engine_name, auto_trigger, trigger_type, action, detail, content, time, created_by, create_time, updated_by, update_time, tenant_id)
        VALUES (#{projectId}, #{ruleEngineId}, #{ruleEngineName}, #{autoTrigger}, #{triggerType}, #{action}, #{detail}, #{content}, #{time}, #{createdBy}, NOW(), #{updatedBy}, NOW(), #{tenantId})
    </insert>
    <update id="updateById">
        UPDATE rule_engine_log SET content=#{content}, detail=#{detail}, updated_by=#{updatedBy}, update_time=NOW() WHERE id=#{id}
    </update>
    <delete id="deleteById">DELETE FROM rule_engine_log WHERE id=#{id}</delete>
    <select id="selectById" resultMap="Base">SELECT * FROM rule_engine_log WHERE id=#{id}</select>
</mapper>
