<?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.house365.ws.dao.mapper.MarketingActivityMapper">

    <resultMap id="infoMap" type="com.house365.beans.entity.MarketingActivityEntity">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="status" column="status"/>
        <result property="type" column="type"/>
        <result property="cycle" column="cycle"/>
        <result property="expectExtractCount" column="expect_extract_count"/>
        <result property="projectName" column="project_name"/>
        <result property="mobileType" column="mobile_type"/>
        <result property="applyStartTime" column="apply_start_time"/>
        <result property="applyEndTime" column="apply_end_time"/>
        <result property="applySource" column="apply_source"/>
        <result property="activeType" column="active_type"/>
        <result property="totalPriceLower" column="total_price_lower"/>
        <result property="totalPriceHigher" column="total_price_higher"/>
        <result property="areaLower" column="area_lower"/>
        <result property="areaHigher" column="area_higher"/>
        <result property="returnVisitTimeStart" column="return_visit_time_start"/>
        <result property="returnVisitTimeEnd" column="return_visit_time_end"/>
        <result property="returnVisitStatus" column="return_visit_status"/>
        <result property="returnVisitResult" column="return_visit_result"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="finishTime" column="finish_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="gainCount" column="gain_count"/>
        <result property="overTimeCount" column="over_time_count"/>
        <result property="visitBackCount" column="visit_back_count"/>
        <result property="waitVisitCount" column="wait_visit_count"/>
        <result property="boughtCount" column="bought_count"/>
        <result property="applySourceName" column="apply_source_name"/>
        <result property="activeTypeName" column="active_type_name"/>
        <result property="returnVisitStatusName" column="return_visit_status_name"/>
        <result property="protectCount" column="protectCount"/>
        <result property="createName" column="create_name"/>
        <result property="city" column="city"/>
        <result property="block" column="block"/>
        <result property="blockName" column="blockName"/>
        <result property="district" column="district"/>
        <result property="districtName" column="districtName"/>
        <result property="channel" column="channel"/>
        <result property="channelName" column="channelName"/>
        <result property="actName" column="actName"/>
        <result property="mobile" column="mobile"/>
        <result property="callNum" column="callNum"/>
        <result property="seeProjectName" column="see_project_name"/>
        <result property="seeStartTime" column="see_start_time"/>
        <result property="seeEndTime" column="see_end_time"/>
        <result property="seeCount" column="see_count"/>
        <result property="buildingId" column="projectId"/>
        <result property="browseProjectId" column="seeProjectId"/>
    </resultMap>


    <insert id="addQueryCond" parameterType="com.house365.beans.entity.MarketingActivityEntity">
        insert into   activity_querycond
        (activityName,mobile,mobileType,buildingId,
        buildingName,totalPriceLower,totalPriceHigher,areaLower,areaHigher,block,district,channel,channelName,returnVisitStatus,
        returnVisitResult,browseProject,browseProjectId,seeCount,queryCondStatus,activityId,blockName,districtName,applySourceName)
        values
        (
        #{name},#{mobile},#{mobileType},#{buildingId},
        #{buildingName},#{totalPriceLower},#{totalPriceHigher},#{areaLower},#{areaHigher},#{block},#{district},#{channel},#{channelName},#{returnVisitStatus},
        #{returnVisitResult},#{browseProject}, #{browseProjectId},#{seeCount},#{queryCondStatus},#{activityId},#{blockName},#{districtName},#{applySourceName}
        )

    </insert>

    <select id="getQueryCondByActiveId" resultMap="infoMap" parameterType="map">
          select
          id, name, status, type, cycle, expect_extract_count, project_name, mobile_type, apply_start_time,
        apply_end_time, apply_source, active_type, total_price_lower, total_price_higher, area_lower,
        area_higher, return_visit_time_start, return_visit_time_end, return_visit_status, return_visit_result,
        create_by, create_time, update_by, update_time, gain_count, over_time_count, visit_back_count,
        wait_visit_count, bought_count, apply_source_name, active_type_name, return_visit_status_name,finish_time,protectCount,
        create_name,city,block,blockName,district,districtName,channel,channelName,actName,mobile,callNum,see_project_name,
        see_start_time,see_end_time,see_count,projectId,seeProjectId
          from marketing_activity
          where id=#{id}
          limit 1
    </select>




</mapper>