<?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.countrygarden.bi.main.dao.phoenix.PhoenixSalesProjectMapper">
    <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.phoenix.PhoenixSalesProject">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="areaid" jdbcType="VARCHAR" property="areaid"/>
        <result column="areaname" jdbcType="VARCHAR" property="areaname"/>
        <result column="province" jdbcType="VARCHAR" property="province"/>
        <result column="city" jdbcType="VARCHAR" property="city"/>
        <result column="region" jdbcType="VARCHAR" property="region"/>
    </resultMap>

    <insert id="persistence" useGeneratedKeys="true">
        REPLACE INTO phoenix_sales_project
        (areaid, areaname, province, city, region)
        VALUES
        <foreach collection="projects" index="index" item="item" separator=",">
            (#{item.areaid}, #{item.areaname}, #{item.province}, #{item.city}, #{item.region})
        </foreach>
    </insert>

    <delete id="truncate">
    TRUNCATE phoenix_sales_project
  </delete>

    <select id="search" resultMap="BaseResultMap">
    SELECT * FROM phoenix_sales_project
  </select>
</mapper>