ReceptionHomePageMaterialInfoMapper.xml 4.41 KB
<?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="cn.com.glsx.dj.mindworkplate.mapper.ReceptionHomePageMaterialInfoMapper">
    <resultMap id="BaseResultMap" type="cn.com.glsx.dj.mindworkplate.model.ReceptionHomePageMaterialInfo">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" property="id" jdbcType="INTEGER"/>
        <result column="config_id" property="configId" jdbcType="INTEGER"/>
        <result column="material_type" property="materialType" jdbcType="INTEGER"/>
        <result column="is_show" property="isShow" jdbcType="BIT"/>
        <result column="material_title" property="materialTitle" jdbcType="VARCHAR"/>
        <result column="material_name" property="materialName" jdbcType="VARCHAR"/>
        <result column="home_entrance_type" property="homeEntranceType" jdbcType="INTEGER"/>
        <result column="home_entrance_cover" property="homeEntranceCover" jdbcType="VARCHAR"/>
        <result column="rel_vehicle_series" property="relVehicleSeries" jdbcType="VARCHAR"/>
        <result column="content_pic_url" property="contentPicUrl" jdbcType="VARCHAR"/>
        <result column="image_width" property="imageWidth" jdbcType="INTEGER"/>
        <result column="image_height" property="imageHeight" jdbcType="INTEGER"/>
        <result column="is_long_image" property="longImage" jdbcType="BIT"/>
        <result column="material_sort" property="materialSort" jdbcType="INTEGER"/>
        <result column="created_by" property="createdBy" jdbcType="VARCHAR"/>
        <result column="created_date" property="createdDate" jdbcType="TIMESTAMP"/>
        <result column="updated_by" property="updatedBy" jdbcType="VARCHAR"/>
        <result column="updated_date" property="updatedDate" jdbcType="TIMESTAMP"/>
        <result column="deleted_flag" property="deletedFlag" jdbcType="CHAR"/>
    </resultMap>
    <resultMap id="dtoMap" extends="BaseResultMap"
               type="cn.com.glsx.dj.mindworkplate.dto.ReceptionHomePageMaterialInfoDTO">
    </resultMap>
    <sql id="Base_Column_List">
        <!--
          WARNING - @mbg.generated
        -->
        id, material_type, is_show, material_title, material_name, home_entrance_type, home_entrance_cover,
        rel_vehicle_series, content_pic_url, image_width, image_height, is_long_image, material_sort, created_by, created_date, updated_by,
        updated_date, deleted_flag, config_id
    </sql>
    <insert id="insertMultiLevelInfoAndDetail">
        <foreach collection="list" item="info">
            INSERT INTO reception_home_page_material_info (material_type, is_show, material_title, material_name,
            home_entrance_type, home_entrance_cover, material_sort, config_id, content_pic_url, image_width, image_height, is_long_image) VALUES(
            #{info.materialType}, #{info.isShow}, #{info.materialTitle}, #{info.materialName}, #{info.homeEntranceType},
            #{info.homeEntranceCover}, #{info.materialSort}, #{info.configId}, #{info.contentPicUrl}, #{info.imageWidth}, #{info.imageHeight}, #{info.longImage});
            SET @current_id = LAST_INSERT_ID();
            <if test="info.materialDetailList != null and !info.materialDetailList.isEmpty()">
                <foreach collection="info.materialDetailList" item="detail">
                    INSERT INTO reception_home_page_material_detail (material_info_id, rel_vehicle_series_name,
                    rel_vehicle_series_id, rel_vehicle_model_name, rel_vehicle_model_id, content_pic_url, image_width, image_height, is_long_image) VALUES(
                    @current_id, #{detail.relVehicleSeriesName}, #{detail.relVehicleSeriesId},
                    #{detail.relVehicleModelName},
                    #{detail.relVehicleModelId}, #{detail.contentPicUrl}, #{detail.imageWidth}, #{detail.imageHeight}, #{detail.longImage});
                    <!--                    <if test="child.children != null and !child.children.isEmpty()">-->
                    <!--                        <foreach collection="child.children" item="grandchild" separator=";">-->
                    <!--                            INSERT INTO category (name, parent_id) VALUES (#{grandchild.name}, @child_id);-->
                    <!--                        </foreach>-->
                    <!--                    </if>-->
                </foreach>
            </if>
        </foreach>
    </insert>
</mapper>