<?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.tanpu.fund.mapper.generator.IfaImportedFundNavMapper">
  <resultMap id="BaseResultMap" type="com.tanpu.fund.entity.generator.IfaImportedFundNav">
    <!--@mbg.generated-->
    <!--@Table ifa_imported_fund_nav-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="fund_id" jdbcType="VARCHAR" property="fundId" />
    <result column="price_date" jdbcType="DATE" property="priceDate" />
    <result column="nav" jdbcType="DECIMAL" property="nav" />
    <result column="cumulative_nav" jdbcType="DECIMAL" property="cumulativeNav" />
    <result column="delete_tag" jdbcType="INTEGER" property="deleteTag" />
    <result column="org_id" jdbcType="VARCHAR" property="orgId" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--@mbg.generated-->
    <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">
    <!--@mbg.generated-->
    <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">
    <!--@mbg.generated-->
    id, fund_id, price_date, nav, cumulative_nav, delete_tag, org_id
  </sql>
  <select id="selectByExample" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNavExample" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from ifa_imported_fund_nav
    <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.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ifa_imported_fund_nav
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ifa_imported_fund_nav
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNavExample">
    <!--@mbg.generated-->
    delete from ifa_imported_fund_nav
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ifa_imported_fund_nav (fund_id, price_date, nav, 
      cumulative_nav, delete_tag, org_id
      )
    values (#{fundId,jdbcType=VARCHAR}, #{priceDate,jdbcType=DATE}, #{nav,jdbcType=DECIMAL}, 
      #{cumulativeNav,jdbcType=DECIMAL}, #{deleteTag,jdbcType=INTEGER}, #{orgId,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ifa_imported_fund_nav
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        fund_id,
      </if>
      <if test="priceDate != null">
        price_date,
      </if>
      <if test="nav != null">
        nav,
      </if>
      <if test="cumulativeNav != null">
        cumulative_nav,
      </if>
      <if test="deleteTag != null">
        delete_tag,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="fundId != null">
        #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="priceDate != null">
        #{priceDate,jdbcType=DATE},
      </if>
      <if test="nav != null">
        #{nav,jdbcType=DECIMAL},
      </if>
      <if test="cumulativeNav != null">
        #{cumulativeNav,jdbcType=DECIMAL},
      </if>
      <if test="deleteTag != null">
        #{deleteTag,jdbcType=INTEGER},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNavExample" resultType="java.lang.Long">
    <!--@mbg.generated-->
    select count(*) from ifa_imported_fund_nav
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.fundId != null">
        fund_id = #{record.fundId,jdbcType=VARCHAR},
      </if>
      <if test="record.priceDate != null">
        price_date = #{record.priceDate,jdbcType=DATE},
      </if>
      <if test="record.nav != null">
        nav = #{record.nav,jdbcType=DECIMAL},
      </if>
      <if test="record.cumulativeNav != null">
        cumulative_nav = #{record.cumulativeNav,jdbcType=DECIMAL},
      </if>
      <if test="record.deleteTag != null">
        delete_tag = #{record.deleteTag,jdbcType=INTEGER},
      </if>
      <if test="record.orgId != null">
        org_id = #{record.orgId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    set id = #{record.id,jdbcType=BIGINT},
      fund_id = #{record.fundId,jdbcType=VARCHAR},
      price_date = #{record.priceDate,jdbcType=DATE},
      nav = #{record.nav,jdbcType=DECIMAL},
      cumulative_nav = #{record.cumulativeNav,jdbcType=DECIMAL},
      delete_tag = #{record.deleteTag,jdbcType=INTEGER},
      org_id = #{record.orgId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    <set>
      <if test="fundId != null">
        fund_id = #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="priceDate != null">
        price_date = #{priceDate,jdbcType=DATE},
      </if>
      <if test="nav != null">
        nav = #{nav,jdbcType=DECIMAL},
      </if>
      <if test="cumulativeNav != null">
        cumulative_nav = #{cumulativeNav,jdbcType=DECIMAL},
      </if>
      <if test="deleteTag != null">
        delete_tag = #{deleteTag,jdbcType=INTEGER},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    set fund_id = #{fundId,jdbcType=VARCHAR},
      price_date = #{priceDate,jdbcType=DATE},
      nav = #{nav,jdbcType=DECIMAL},
      cumulative_nav = #{cumulativeNav,jdbcType=DECIMAL},
      delete_tag = #{deleteTag,jdbcType=INTEGER},
      org_id = #{orgId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="fund_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.fundId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="price_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.priceDate,jdbcType=DATE}
        </foreach>
      </trim>
      <trim prefix="nav = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.nav,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="cumulative_nav = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.cumulativeNav,jdbcType=DECIMAL}
        </foreach>
      </trim>
      <trim prefix="delete_tag = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.deleteTag,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="org_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.orgId,jdbcType=VARCHAR}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ifa_imported_fund_nav
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="fund_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.fundId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.fundId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="price_date = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.priceDate != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.priceDate,jdbcType=DATE}
          </if>
        </foreach>
      </trim>
      <trim prefix="nav = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.nav != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.nav,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="cumulative_nav = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.cumulativeNav != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.cumulativeNav,jdbcType=DECIMAL}
          </if>
        </foreach>
      </trim>
      <trim prefix="delete_tag = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.deleteTag != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.deleteTag,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="org_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.orgId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.orgId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ifa_imported_fund_nav
    (fund_id, price_date, nav, cumulative_nav, delete_tag, org_id)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.fundId,jdbcType=VARCHAR}, #{item.priceDate,jdbcType=DATE}, #{item.nav,jdbcType=DECIMAL}, 
        #{item.cumulativeNav,jdbcType=DECIMAL}, #{item.deleteTag,jdbcType=INTEGER}, #{item.orgId,jdbcType=VARCHAR}
        )
    </foreach>
  </insert>
  <insert id="insertOrUpdate" keyColumn="id" keyProperty="id" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ifa_imported_fund_nav
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      fund_id,
      price_date,
      nav,
      cumulative_nav,
      delete_tag,
      org_id,
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      #{fundId,jdbcType=VARCHAR},
      #{priceDate,jdbcType=DATE},
      #{nav,jdbcType=DECIMAL},
      #{cumulativeNav,jdbcType=DECIMAL},
      #{deleteTag,jdbcType=INTEGER},
      #{orgId,jdbcType=VARCHAR},
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=BIGINT},
      </if>
      fund_id = #{fundId,jdbcType=VARCHAR},
      price_date = #{priceDate,jdbcType=DATE},
      nav = #{nav,jdbcType=DECIMAL},
      cumulative_nav = #{cumulativeNav,jdbcType=DECIMAL},
      delete_tag = #{deleteTag,jdbcType=INTEGER},
      org_id = #{orgId,jdbcType=VARCHAR},
    </trim>
  </insert>
  <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id" parameterType="com.tanpu.fund.entity.generator.IfaImportedFundNav" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ifa_imported_fund_nav
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="fundId != null">
        fund_id,
      </if>
      <if test="priceDate != null">
        price_date,
      </if>
      <if test="nav != null">
        nav,
      </if>
      <if test="cumulativeNav != null">
        cumulative_nav,
      </if>
      <if test="deleteTag != null">
        delete_tag,
      </if>
      <if test="orgId != null">
        org_id,
      </if>
    </trim>
    values
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="fundId != null">
        #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="priceDate != null">
        #{priceDate,jdbcType=DATE},
      </if>
      <if test="nav != null">
        #{nav,jdbcType=DECIMAL},
      </if>
      <if test="cumulativeNav != null">
        #{cumulativeNav,jdbcType=DECIMAL},
      </if>
      <if test="deleteTag != null">
        #{deleteTag,jdbcType=INTEGER},
      </if>
      <if test="orgId != null">
        #{orgId,jdbcType=VARCHAR},
      </if>
    </trim>
    on duplicate key update 
    <trim suffixOverrides=",">
      <if test="id != null">
        id = #{id,jdbcType=BIGINT},
      </if>
      <if test="fundId != null">
        fund_id = #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="priceDate != null">
        price_date = #{priceDate,jdbcType=DATE},
      </if>
      <if test="nav != null">
        nav = #{nav,jdbcType=DECIMAL},
      </if>
      <if test="cumulativeNav != null">
        cumulative_nav = #{cumulativeNav,jdbcType=DECIMAL},
      </if>
      <if test="deleteTag != null">
        delete_tag = #{deleteTag,jdbcType=INTEGER},
      </if>
      <if test="orgId != null">
        org_id = #{orgId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
</mapper>