<?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.OfficialFeePriceMapper">
  <resultMap id="BaseResultMap" type="com.goafanti.common.model.OfficialFeePrice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="amount" jdbcType="DECIMAL" property="amount" />
    <result column="proportion85" jdbcType="DECIMAL" property="proportion85" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="patent_type" jdbcType="INTEGER" property="patentType" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    id, `type`, amount, proportion85, remarks, create_time, patent_type
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    select 
    <include refid="Base_Column_List" />
    from official_fee_price
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    delete from official_fee_price
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.goafanti.common.model.OfficialFeePrice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    insert into official_fee_price (id, `type`, amount, 
      proportion85, remarks, create_time, 
      patent_type)
    values (#{id,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, 
      #{proportion85,jdbcType=DECIMAL}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
      #{patentType,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.goafanti.common.model.OfficialFeePrice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    insert into official_fee_price
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="type != null">
        `type`,
      </if>
      <if test="amount != null">
        amount,
      </if>
      <if test="proportion85 != null">
        proportion85,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="patentType != null">
        patent_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="amount != null">
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="proportion85 != null">
        #{proportion85,jdbcType=DECIMAL},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="patentType != null">
        #{patentType,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.OfficialFeePrice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    update official_fee_price
    <set>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
      <if test="amount != null">
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="proportion85 != null">
        proportion85 = #{proportion85,jdbcType=DECIMAL},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="patentType != null">
        patent_type = #{patentType,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.OfficialFeePrice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Jul 16 11:30:10 CST 2021.
    -->
    update official_fee_price
    set `type` = #{type,jdbcType=INTEGER},
      amount = #{amount,jdbcType=DECIMAL},
      proportion85 = #{proportion85,jdbcType=DECIMAL},
      remarks = #{remarks,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      patent_type = #{patentType,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  
    <select id="selectBytype" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    
    select 
    <include refid="Base_Column_List" />
    from official_fee_price
    where type = #{type,jdbcType=INTEGER}
    and patent_type= #{patentType,jdbcType=INTEGER}
  </select>
  <select id="countOfficialFeePrice" resultMap="BaseResultMap">
  	select 
<include refid="Base_Column_List" />  	
 from official_fee_price 
  where `type` = #{type} and patent_type = #{patentType}
  </select>
</mapper>