<?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.heketai.website.mapper.WebsiteMenuContentMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.heketai.website.entity.WebsiteMenuContent">
        <id column="id" property="id"/>
        <result column="menu_id" property="menuId"/>
        <result column="title" property="title"/>
        <result column="content" property="content"/>
        <result column="number" property="number"/>
        <result column="subhead" property="subhead"/>
        <result column="image" property="image"/>
    </resultMap>


    <insert id="insertMenuContent" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
        insert into website_menu_content
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="menuId != null and menuId != ''">
                menu_id,
            </if>

            <if test="title != null and title != ''">
                title,
            </if>

            <if test="subhead != null and subhead != ''">
                subhead,
            </if>

            <if test="content != null and content != ''">
                content,
            </if>

            <if test="number != null and number != ''">
                `number`,
            </if>

            <if test="image != null and image != ''">
                image,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="menuId != null and menuId != ''">
                #{menuId,jdbcType=INTEGER},
            </if>

            <if test="title != null and title != ''">
                #{title,jdbcType=VARCHAR},
            </if>

            <if test="subhead != null and subhead != ''">
                #{subhead,jdbcType=VARCHAR},
            </if>

            <if test="content != null and content != ''">
                #{content,jdbcType=VARCHAR},
            </if>

            <if test="number != null and number != ''">
                #{number,jdbcType=INTEGER},
            </if>

            <if test="image != null and image != ''">
                #{image,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>

</mapper>
