<?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.test.test.mapper.UiSceneStepsReportMapper">

    <resultMap type="UiSceneStepsReport" id="UiSceneStepsReportResult">
        <result property="id" column="id"/>
        <result property="reportId" column="report_id"/>
        <result property="name" column="name"/>
        <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="logInfo" column="log_info"/>
        <result property="executionFlag" column="execution_flag"/>
        <result property="take" column="take"/>
        <result property="screenshot" column="screenshot"/>
        <result property="assertionJson" column="assertion_json"/>
        <result property="extractionDataJson" column="extraction_data_json"/>
        <result property="orderNumber" column="order_number"/>
    </resultMap>

    <sql id="selectUiSceneStepsReportVo">
        select id,
               report_id,
               name,
               create_by,
               create_time,
               update_by,
               update_time,
               log_info,
               execution_flag,
               take,
               screenshot,
               assertion_json,
               extraction_data_json,
               order_number
        from ui_scene_steps_report
    </sql>

    <select id="selectUiSceneStepsReportList" parameterType="UiSceneStepsReport" resultMap="UiSceneStepsReportResult">
        <include refid="selectUiSceneStepsReportVo"/>
        <where>
            <if test="reportId != null ">and report_id = #{reportId}</if>
            <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if>
            <if test="logInfo != null  and logInfo != ''">and log_info = #{logInfo}</if>
            <if test="executionFlag != null  and executionFlag != ''">and execution_flag = #{executionFlag}</if>
            <if test="take != null  and take != ''">and take = #{take}</if>
            <if test="screenshot != null  and screenshot != ''">and screenshot = #{screenshot}</if>
            <if test="assertionJson != null  and assertionJson != ''">and assertion_json = #{assertionJson}</if>
            <if test="extractionDataJson != null  and extractionDataJson != ''">and extraction_data_json =
                #{extractionDataJson}
            </if>
            <if test="orderNumber != null ">and order_number = #{orderNumber}</if>
        </where>
        order by order_number asc
    </select>

    <select id="selectUiSceneStepsReportById" parameterType="Long" resultMap="UiSceneStepsReportResult">
        <include refid="selectUiSceneStepsReportVo"/>
        where id = #{id}
    </select>

    <insert id="insertUiSceneStepsReport" parameterType="UiSceneStepsReport" useGeneratedKeys="true" keyProperty="id">
        insert into ui_scene_steps_report
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="reportId != null">report_id,</if>
            <if test="name != null">name,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="logInfo != null">log_info,</if>
            <if test="executionFlag != null">execution_flag,</if>
            <if test="take != null">take,</if>
            <if test="screenshot != null">screenshot,</if>
            <if test="assertionJson != null">assertion_json,</if>
            <if test="extractionDataJson != null">extraction_data_json,</if>
            <if test="orderNumber != null">order_number,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="reportId != null">#{reportId},</if>
            <if test="name != null">#{name},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="logInfo != null">#{logInfo},</if>
            <if test="executionFlag != null">#{executionFlag},</if>
            <if test="take != null">#{take},</if>
            <if test="screenshot != null">#{screenshot},</if>
            <if test="assertionJson != null">#{assertionJson},</if>
            <if test="extractionDataJson != null">#{extractionDataJson},</if>
            <if test="orderNumber != null">#{orderNumber},</if>
        </trim>
    </insert>

    <update id="updateUiSceneStepsReport" parameterType="UiSceneStepsReport">
        update ui_scene_steps_report
        <trim prefix="SET" suffixOverrides=",">
            <if test="reportId != null">report_id = #{reportId},</if>
            <if test="name != null">name = #{name},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="logInfo != null">log_info = #{logInfo},</if>
            <if test="executionFlag != null">execution_flag = #{executionFlag},</if>
            <if test="take != null">take = #{take},</if>
            <if test="screenshot != null">screenshot = #{screenshot},</if>
            <if test="assertionJson != null">assertion_json = #{assertionJson},</if>
            <if test="extractionDataJson != null">extraction_data_json = #{extractionDataJson},</if>
            <if test="orderNumber != null">order_number = #{orderNumber},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteUiSceneStepsReportById" parameterType="Long">
        delete
        from ui_scene_steps_report
        where id = #{id}
    </delete>

    <delete id="deleteUiSceneStepsReportByIds" parameterType="String">
        delete from ui_scene_steps_report where report_id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>