<?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.xhpc.file.mapper.XhpcImgMapper">

    <resultMap type="com.xhpc.file.domain.XhpcImg" id="XhpcImgResult">
        <result column="img_id" property="imgId"/>
        <result column="url" property="url"/>
        <result column="status" property="status"/>
        <result column="del_flag" property="delFlag"/>
        <result column="create_time" property="createTime"/>
        <result column="create_by" property="createBy"/>
        <result column="update_time" property="updateTime"/>
        <result column="update_by" property="updateBy"/>
        <result column="remark" property="remark"/>
    </resultMap>

    <insert id="insert" parameterType="com.xhpc.file.domain.XhpcImg" useGeneratedKeys="true"
            keyProperty="imgId">
        INSERT INTO xhpc_img
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="null != url and '' != url">
                url,
            </if>
            <if test="null != status">
                status,
            </if>
            <if test="null != delFlag and '' != delFlag">
                del_flag,
            </if>
            <if test="null != createTime">
                create_time,
            </if>
            <if test="null != createBy and '' != createBy">
                create_by,
            </if>
            <if test="null != updateTime">
                update_time,
            </if>
            <if test="null != updateBy and '' != updateBy">
                update_by,
            </if>
            <if test="null != remark and '' != remark">
                remark
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="null != url and '' != url">
                #{url},
            </if>
            <if test="null != status">
                #{status},
            </if>
            <if test="null != delFlag and '' != delFlag">
                #{delFlag},
            </if>
            <if test="null != createTime">
                #{createTime},
            </if>
            <if test="null != createBy and '' != createBy">
                #{createBy},
            </if>
            <if test="null != updateTime">
                #{updateTime},
            </if>
            <if test="null != updateBy and '' != updateBy">
                #{updateBy},
            </if>
            <if test="null != remark and '' != remark">
                #{remark}
            </if>
        </trim>
    </insert>

    <update id="update" parameterType="com.xhpc.file.domain.XhpcImg">
        UPDATE xhpc_img
        <set>
            <if test="null != url and '' != url">url = #{url},</if>
            <if test="null != status">status = #{status},</if>
            <if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
            <if test="null != createTime">create_time = #{createTime},</if>
            <if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
            <if test="null != updateTime">update_time = #{updateTime},</if>
            <if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
            <if test="null != remark and '' != remark">remark = #{remark}</if>
        </set>
        WHERE img_id = #{imgId}
    </update>


    <select id="info" parameterType="java.lang.Long" resultMap="XhpcImgResult">
        select *
        from xhpc_history_order
        where img_id = #{imgId}
    </select>
</mapper>
