<?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.fidms.web.mapper.FlowFieldOutputMapper">
    
    <resultMap type="FlowFieldOutput" id="FlowFieldOutputResult">
        <result property="id"    column="id"    />
        <result property="flowFieldInputID" column="flow_field_input_id" />
        <result property="isStructureGrid"    column="is_structure_grid"    />
        <result property="gridNumber"    column="grid_number"    />
        <result property="iterationSteps" column="iteration_steps" />
        <result property="casOutputFile"    column="cas_output_file"    />
        <result property="casOutputFilePath"    column="cas_output_file_path"    />
        <result property="datOutputFile"    column="dat_output_file"    />
        <result property="datOutputFilePath"    column="dat_output_file_path"    />
        <result property="otherOutputFile"    column="other_output_file"    />
        <result property="otherOutputFilePath"    column="other_output_file_path"    />
        <result property="temperatureImage" column="temperature_image"/>
        <result property="temperatureImagePath" column="temperature_image_path"/>
        <result property="velocityImage" column="velocity_image"/>
        <result property="velocityImagePath" column="velocity_image_path"/>
        <result property="pressureImage" column="pressure_image"/>
        <result property="pressureImagePath" column="pressure_image_path"/>
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectFlowFieldOutputVo">
        select id, flow_field_input_id,is_structure_grid, grid_number, iteration_steps,cas_output_file, cas_output_file_path,dat_output_file, dat_output_file_path,other_output_file, other_output_file_path, temperature_image,temperature_image_path,velocity_image,velocity_image_path,pressure_image,pressure_image_path,create_by, create_time, update_by, update_time from bz_flow_field_output_t
    </sql>

    <select id="selectFlowFieldOutputList" parameterType="FlowFieldOutput" resultMap="FlowFieldOutputResult">
        <include refid="selectFlowFieldOutputVo"/>
        <where>
            <if test="flowFieldInputID != null">and flow_field_input_id=#{flowFieldInputID}</if>
            <if test="gridNumber != null "> and grid_number = #{gridNumber}</if>
            <if test="isStructureGrid != null "> and is_structure_grid = #{isStructureGrid}</if>
            <if test="iterationSteps != null">and iteration_steps = #{iterationSteps}</if>
            <if test="casOutputFile != null  and casOutputFile != ''"> and cas_output_file = #{casOutputFile}</if>
            <if test="casOutputFilePath != null  and casOutputFilePath != ''"> and cas_output_file_path = #{casOutputFilePath}</if>
            <if test="datOutputFile != null  and datOutputFile != ''"> and dat_output_file = #{datOutputFile}</if>
            <if test="datOutputFilePath != null  and datOutputFilePath != ''"> and dat_output_file_path = #{datOutputFilePath}</if>
            <if test="otherOutputFile != null  and otherOutputFile != ''"> and other_output_file = #{otherOutputFile}</if>
            <if test="otherOutputFilePath != null  and otherOutputFilePath != ''"> and other_output_file_path = #{otherOutputFilePath}</if>
            <if test="temperatureImage !=null and temperatureImage != ''"> and  temperature_image = #{temperatureImage}</if>
            <if test="temperatureImagePath != null and temperatureImagePath != ''"> and temperature_image_path = #{temperatureImagePath}</if>
            <if test="velocityImage != null and velocityImage !=''"> and velocity_image = #{velocityIamge}</if>
            <if test="velocityImagePath != null and velocityImagePath !=''"> and velocity_image_path = #{velocityImagePath}</if>
            <if test="pressureImage != null and pressureImage !=''"> and pressure_image = #{pressureImage}</if>
            <if test="pressureImagePath != null and pressureImagePath !=''"> and pressure_image_path = #{pressureImagePath}</if>
        </where>
    </select>
    
    <select id="selectFlowFieldOutputById" parameterType="Long" resultMap="FlowFieldOutputResult">
        <include refid="selectFlowFieldOutputVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertFlowFieldOutput" parameterType="FlowFieldOutput" useGeneratedKeys="true" keyProperty="id">
        insert into bz_flow_field_output_t
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="flowFieldInputID != null">flow_field_input_id,</if>
            <if test="isStructureGrid != null">is_structure_grid,</if>
            <if test="gridNumber != null">grid_number,</if>
            <if test="iterationSteps != null">iteration_steps,</if>
            <if test="casOutputFile != null">cas_output_file,</if>
            <if test="casOutputFilePath != null">cas_output_file_path,</if>
            <if test="datOutputFile != null">dat_output_file,</if>
            <if test="datOutputFilePath != null">dat_output_file_path,</if>
            <if test="otherOutputFile != null">other_output_file,</if>
            <if test="otherOutputFilePath != null">other_output_file_path,</if>
            <if test="temperatureImage != null">temperature_image,</if>
            <if test="temperatureImagePath != null">temperature_image_path,</if>
            <if test="velocityImage != null">velocity_image,</if>
            <if test="velocityImagePath != null">velocity_image_path,</if>
            <if test="pressureImage!= null">pressure_image,</if>
            <if test="pressureImagePath != null">pressure_image_path,</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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="flowFieldInputID != null">#{flowFieldInputID},</if>
            <if test="isStructureGrid != null">#{isStructureGrid},</if>
            <if test="gridNumber != null">#{gridNumber},</if>
            <if test="iterationSteps!=null">#{iterationSteps},</if>
            <if test="casOutputFile != null">#{casOutputFile},</if>
            <if test="casOutputFilePath != null">#{casOutputFilePath},</if>
            <if test="datOutputFile != null">#{datOutputFile},</if>
            <if test="datOutputFilePath != null">#{datOutputFilePath},</if>
            <if test="otherOutputFile != null">#{otherOutputFile},</if>
            <if test="otherOutputFilePath != null">#{otherOutputFilePath},</if>
            <if test="temperatureImage!= null">#{temperatureImage},</if>
            <if test="temperatureImagePath != null">#{temperarueImagePath},</if>
            <if test="velocityImage != null">#{velocityImage},</if>
            <if test="velocityImagePath != null">#{velocityImagePath},</if>
            <if test="pressureImage != null">#{pressureImage},</if>
            <if test="pressureImagePath !=null">#{pressureImagePath},</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>
         </trim>
    </insert>

    <update id="updateFlowFieldOutput" parameterType="FlowFieldOutput">
        update bz_flow_field_output_t
        <trim prefix="SET" suffixOverrides=",">
            <if test="flowFieldInputID != null">flow_field_input_id = #{flowFieldInputID},</if>
            <if test="isStructureGrid != null">is_structure_grid = #{isStructureGrid},</if>
            <if test="gridNumber != null">grid_number = #{gridNumber},</if>
            <if test="iterationSteps != null">iteration_steps=#{iterationSteps},</if>
            <if test="casOutputFile != null">cas_output_file = #{casOutputFile},</if>
            <if test="casOutputFilePath != null">cas_output_file_path = #{casOutputFilePath},</if>
            <if test="datOutputFile != null">dat_output_file = #{datOutputFile},</if>
            <if test="datOutputFilePath != null">dat_output_file_path = #{datOutputFilePath},</if>
            <if test="otherOutputFile != null">other_output_file = #{otherOutputFile},</if>
            <if test="otherOutputFilePath != null">other_output_file_path = #{otherOutputFilePath},</if>
            <if test="temperatureImage!= null">temperature_image = #{temperatureImage},</if>
            <if test="temperatureImagePath !=null">temperature_image_path = #{temperatureImagePath},</if>
            <if test="velocityImage != null">velocity_image =#{velocityImage},</if>
            <if test="velocityImagePath !=null">velocity_image_path =#{velocityImagePath},</if>
            <if test="pressureImage != null">pressure_image = #{pressureImage},</if>
            <if test="pressureImagePath!=null">pressure_image_path = #{pressureImagePath},</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>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteFlowFieldOutputById" parameterType="Long">
        delete from bz_flow_field_output_t where id = #{id}
    </delete>

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

    <select id="getFlowOutputOption" resultType="Map">
        select id from bz_flow_field_output_t order by id desc
    </select>
</mapper>