<?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.goafanti.common.dao.ProjectSizeMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.ProjectSize">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="create_id" jdbcType="VARCHAR" property="createId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="pid" jdbcType="VARCHAR" property="pid" />
    <result column="pname" jdbcType="VARCHAR" property="pname" />
    <result column="price" jdbcType="DECIMAL" property="price" />
    <result column="offset" jdbcType="DECIMAL" property="offset" />
    <result column="activity_price" jdbcType="DECIMAL" property="activityPrice" />
    <result column="activity_flag" jdbcType="VARCHAR" property="activityFlag" />
    <result column="member_price" jdbcType="DECIMAL" property="memberPrice" />
    <result column="status" jdbcType="INTEGER" property="status" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    id, create_id, create_time, update_time, pid, pname, price, offset, activity_price, 
    activity_flag, member_price, status
  </sql>
  <select id="selectByExample" parameterType="com.goafanti.common.model.ProjectSizeExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from project_size
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    select 
    <include refid="Base_Column_List" />
    from project_size
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    delete from project_size
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.goafanti.common.model.ProjectSizeExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    delete from project_size
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.ProjectSize">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    insert into project_size (id, create_id, create_time, 
      update_time, pid, pname, 
      price, offset, activity_price, 
      activity_flag, member_price, status
      )
    values (#{id,jdbcType=VARCHAR}, #{createId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{pid,jdbcType=VARCHAR}, #{pname,jdbcType=VARCHAR}, 
      #{price,jdbcType=DECIMAL}, #{offset,jdbcType=DECIMAL}, #{activityPrice,jdbcType=DECIMAL}, 
      #{activityFlag,jdbcType=VARCHAR}, #{memberPrice,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.ProjectSize">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    insert into project_size
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="createId != null">
        create_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="pid != null">
        pid,
      </if>
      <if test="pname != null">
        pname,
      </if>
      <if test="price != null">
        price,
      </if>
      <if test="offset != null">
        offset,
      </if>
      <if test="activityPrice != null">
        activity_price,
      </if>
      <if test="activityFlag != null">
        activity_flag,
      </if>
      <if test="memberPrice != null">
        member_price,
      </if>
      <if test="status != null">
        status,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="createId != null">
        #{createId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="pid != null">
        #{pid,jdbcType=VARCHAR},
      </if>
      <if test="pname != null">
        #{pname,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        #{price,jdbcType=DECIMAL},
      </if>
      <if test="offset != null">
        #{offset,jdbcType=DECIMAL},
      </if>
      <if test="activityPrice != null">
        #{activityPrice,jdbcType=DECIMAL},
      </if>
      <if test="activityFlag != null">
        #{activityFlag,jdbcType=VARCHAR},
      </if>
      <if test="memberPrice != null">
        #{memberPrice,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.goafanti.common.model.ProjectSizeExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    select count(*) from project_size
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    update project_size
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.createId != null">
        create_id = #{record.createId,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.pid != null">
        pid = #{record.pid,jdbcType=VARCHAR},
      </if>
      <if test="record.pname != null">
        pname = #{record.pname,jdbcType=VARCHAR},
      </if>
      <if test="record.price != null">
        price = #{record.price,jdbcType=DECIMAL},
      </if>
      <if test="record.offset != null">
        offset = #{record.offset,jdbcType=DECIMAL},
      </if>
      <if test="record.activityPrice != null">
        activity_price = #{record.activityPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.activityFlag != null">
        activity_flag = #{record.activityFlag,jdbcType=VARCHAR},
      </if>
      <if test="record.memberPrice != null">
        member_price = #{record.memberPrice,jdbcType=DECIMAL},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    update project_size
    set id = #{record.id,jdbcType=VARCHAR},
      create_id = #{record.createId,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      pid = #{record.pid,jdbcType=VARCHAR},
      pname = #{record.pname,jdbcType=VARCHAR},
      price = #{record.price,jdbcType=DECIMAL},
      offset = #{record.offset,jdbcType=DECIMAL},
      activity_price = #{record.activityPrice,jdbcType=DECIMAL},
      activity_flag = #{record.activityFlag,jdbcType=VARCHAR},
      member_price = #{record.memberPrice,jdbcType=DECIMAL},
      status = #{record.status,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.business.bo.ProjectSizeBo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    update project_size
    <set>
      <if test="createId != null">
        create_id = #{createId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="pid != null">
        pid = #{pid,jdbcType=VARCHAR},
      </if>
      <if test="pname != null">
        pname = #{pname,jdbcType=VARCHAR},
      </if>
      <if test="price != null">
        price = #{price,jdbcType=DECIMAL},
      </if>
      <if test="offset != null">
        offset = #{offset,jdbcType=DECIMAL},
      </if>
      <if test="activityPrice != null">
        activity_price = #{activityPrice,jdbcType=DECIMAL},
      </if>
      <if test="activityFlag != null">
        activity_flag = #{activityFlag,jdbcType=VARCHAR},
      </if>
      <if test="memberPrice != null">
        member_price = #{memberPrice,jdbcType=DECIMAL},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ProjectSize">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon Dec 04 15:29:25 CST 2017.
    -->
    update project_size
    set create_id = #{createId,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      pid = #{pid,jdbcType=VARCHAR},
      pname = #{pname,jdbcType=VARCHAR},
      price = #{price,jdbcType=DECIMAL},
      offset = #{offset,jdbcType=DECIMAL},
      activity_price = #{activityPrice,jdbcType=DECIMAL},
      activity_flag = #{activityFlag,jdbcType=VARCHAR},
      member_price = #{memberPrice,jdbcType=DECIMAL},
      status = #{status,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
 	
  <select id="selectByPrimaryBusinessId" resultType="com.goafanti.business.bo.ProjectSizeBo">
    
    select 
  	 p.id, p.create_id as createId, p.create_time as createTime, p.update_time as updateTime, p.pid, p.pname, p.price, p.offset, p.activity_price as activityPrice, 
    p.activity_flag as activityFlag, p.member_price as memberPrice, p.status,b.bname
    from project_size p
    left join business_project b on  p.pid =b.id 
    where p.pid = #{pid,jdbcType=VARCHAR}
  </select>
  
  <select id="selectByBusinessId" parameterType="java.lang.String" resultType="com.goafanti.business.bo.ProjectSizeBo">
    select 
    p.id, p.create_id as createId, p.create_time as createTime, p.update_time as updateTime, p.pid, p.pname, p.price, p.offset, p.activity_price as activityPrice, 
    p.activity_flag as activityFlag, p.member_price as memberPrice, p.status,b.bname
    from project_size p
    left join business_project b on  p.pid =b.id 
    where p.id = #{id,jdbcType=VARCHAR}
  </select>	
  
  <select id="getgetPnamecount" resultType="com.goafanti.business.bo.ProjectSizeBo">
   select 
   p.id, p.create_id as createId, p.create_time as createTime, p.update_time as updateTime, p.pid, p.pname, p.price, p.offset, p.activity_price as activityPrice, 
   p.activity_flag as activityFlag, p.member_price as memberPrice, p.status
    from project_size p
   where p.pname=#{pname,jdbcType=VARCHAR}
  </select>
  <select id="selectPidList" resultType="string">
select  p.pname
from project_size p
where status=0  
and  pid=#{pid,jdbcType=VARCHAR}
  </select>
</mapper>