<?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.UserFundInfoMapper">
  <resultMap id="BaseResultMap" type="com.tanpu.fund.entity.generator.UserFundInfo">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="p_fund_id" jdbcType="VARCHAR" property="pFundId" />
    <result column="fund_id" jdbcType="VARCHAR" property="fundId" />
    <result column="buy_fee_ratio" jdbcType="DECIMAL" property="buyFeeRatio" />
    <result column="confirm_share" jdbcType="DECIMAL" property="confirmShare" />
    <result column="confirm_share_date" jdbcType="TIMESTAMP" property="confirmShareDate" />
    <result column="confirm_amount" jdbcType="DECIMAL" property="confirmAmount" />
    <result column="fund_nav_id" jdbcType="VARCHAR" property="fundNavId" />
    <result column="fund_nav" jdbcType="DECIMAL" property="fundNav" />
    <result column="init_weight" jdbcType="DECIMAL" property="initWeight" />
    <result column="cost_amount" jdbcType="DECIMAL" property="costAmount" />
    <result column="market_value" jdbcType="DECIMAL" property="marketValue" />
    <result column="profit_loss" jdbcType="DECIMAL" property="profitLoss" />
    <result column="match_ratio" jdbcType="DECIMAL" property="matchRatio" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="delete_tag" jdbcType="INTEGER" property="deleteTag" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <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">
    <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">
    id, user_id, p_fund_id, fund_id, buy_fee_ratio, confirm_share, confirm_share_date, 
    confirm_amount, fund_nav_id, fund_nav, init_weight, cost_amount, market_value, profit_loss, 
    match_ratio, create_time, create_by, update_time, update_by, delete_tag
  </sql>
  <select id="selectByExample" parameterType="com.tanpu.fund.entity.generator.UserFundInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from user_fund_info
    <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">
    select 
    <include refid="Base_Column_List" />
    from user_fund_info
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from user_fund_info
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.tanpu.fund.entity.generator.UserFundInfoExample">
    delete from user_fund_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tanpu.fund.entity.generator.UserFundInfo">
    insert into user_fund_info (id, user_id, p_fund_id, 
      fund_id, buy_fee_ratio, confirm_share, 
      confirm_share_date, confirm_amount, fund_nav_id, 
      fund_nav, init_weight, cost_amount, 
      market_value, profit_loss, match_ratio, 
      create_time, create_by, update_time, 
      update_by, delete_tag)
    values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{pFundId,jdbcType=VARCHAR}, 
      #{fundId,jdbcType=VARCHAR}, #{buyFeeRatio,jdbcType=DECIMAL}, #{confirmShare,jdbcType=DECIMAL}, 
      #{confirmShareDate,jdbcType=TIMESTAMP}, #{confirmAmount,jdbcType=DECIMAL}, #{fundNavId,jdbcType=VARCHAR}, 
      #{fundNav,jdbcType=DECIMAL}, #{initWeight,jdbcType=DECIMAL}, #{costAmount,jdbcType=DECIMAL}, 
      #{marketValue,jdbcType=DECIMAL}, #{profitLoss,jdbcType=DECIMAL}, #{matchRatio,jdbcType=DECIMAL}, 
      #{createTime,jdbcType=TIMESTAMP}, #{createBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{updateBy,jdbcType=VARCHAR}, #{deleteTag,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.tanpu.fund.entity.generator.UserFundInfo">
    insert into user_fund_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="pFundId != null">
        p_fund_id,
      </if>
      <if test="fundId != null">
        fund_id,
      </if>
      <if test="buyFeeRatio != null">
        buy_fee_ratio,
      </if>
      <if test="confirmShare != null">
        confirm_share,
      </if>
      <if test="confirmShareDate != null">
        confirm_share_date,
      </if>
      <if test="confirmAmount != null">
        confirm_amount,
      </if>
      <if test="fundNavId != null">
        fund_nav_id,
      </if>
      <if test="fundNav != null">
        fund_nav,
      </if>
      <if test="initWeight != null">
        init_weight,
      </if>
      <if test="costAmount != null">
        cost_amount,
      </if>
      <if test="marketValue != null">
        market_value,
      </if>
      <if test="profitLoss != null">
        profit_loss,
      </if>
      <if test="matchRatio != null">
        match_ratio,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="deleteTag != null">
        delete_tag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="pFundId != null">
        #{pFundId,jdbcType=VARCHAR},
      </if>
      <if test="fundId != null">
        #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="buyFeeRatio != null">
        #{buyFeeRatio,jdbcType=DECIMAL},
      </if>
      <if test="confirmShare != null">
        #{confirmShare,jdbcType=DECIMAL},
      </if>
      <if test="confirmShareDate != null">
        #{confirmShareDate,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmAmount != null">
        #{confirmAmount,jdbcType=DECIMAL},
      </if>
      <if test="fundNavId != null">
        #{fundNavId,jdbcType=VARCHAR},
      </if>
      <if test="fundNav != null">
        #{fundNav,jdbcType=DECIMAL},
      </if>
      <if test="initWeight != null">
        #{initWeight,jdbcType=DECIMAL},
      </if>
      <if test="costAmount != null">
        #{costAmount,jdbcType=DECIMAL},
      </if>
      <if test="marketValue != null">
        #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="profitLoss != null">
        #{profitLoss,jdbcType=DECIMAL},
      </if>
      <if test="matchRatio != null">
        #{matchRatio,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="deleteTag != null">
        #{deleteTag,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.tanpu.fund.entity.generator.UserFundInfoExample" resultType="java.lang.Long">
    select count(*) from user_fund_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update user_fund_info
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=VARCHAR},
      </if>
      <if test="record.pFundId != null">
        p_fund_id = #{record.pFundId,jdbcType=VARCHAR},
      </if>
      <if test="record.fundId != null">
        fund_id = #{record.fundId,jdbcType=VARCHAR},
      </if>
      <if test="record.buyFeeRatio != null">
        buy_fee_ratio = #{record.buyFeeRatio,jdbcType=DECIMAL},
      </if>
      <if test="record.confirmShare != null">
        confirm_share = #{record.confirmShare,jdbcType=DECIMAL},
      </if>
      <if test="record.confirmShareDate != null">
        confirm_share_date = #{record.confirmShareDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.confirmAmount != null">
        confirm_amount = #{record.confirmAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.fundNavId != null">
        fund_nav_id = #{record.fundNavId,jdbcType=VARCHAR},
      </if>
      <if test="record.fundNav != null">
        fund_nav = #{record.fundNav,jdbcType=DECIMAL},
      </if>
      <if test="record.initWeight != null">
        init_weight = #{record.initWeight,jdbcType=DECIMAL},
      </if>
      <if test="record.costAmount != null">
        cost_amount = #{record.costAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.marketValue != null">
        market_value = #{record.marketValue,jdbcType=DECIMAL},
      </if>
      <if test="record.profitLoss != null">
        profit_loss = #{record.profitLoss,jdbcType=DECIMAL},
      </if>
      <if test="record.matchRatio != null">
        match_ratio = #{record.matchRatio,jdbcType=DECIMAL},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createBy != null">
        create_by = #{record.createBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateBy != null">
        update_by = #{record.updateBy,jdbcType=VARCHAR},
      </if>
      <if test="record.deleteTag != null">
        delete_tag = #{record.deleteTag,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update user_fund_info
    set id = #{record.id,jdbcType=VARCHAR},
      user_id = #{record.userId,jdbcType=VARCHAR},
      p_fund_id = #{record.pFundId,jdbcType=VARCHAR},
      fund_id = #{record.fundId,jdbcType=VARCHAR},
      buy_fee_ratio = #{record.buyFeeRatio,jdbcType=DECIMAL},
      confirm_share = #{record.confirmShare,jdbcType=DECIMAL},
      confirm_share_date = #{record.confirmShareDate,jdbcType=TIMESTAMP},
      confirm_amount = #{record.confirmAmount,jdbcType=DECIMAL},
      fund_nav_id = #{record.fundNavId,jdbcType=VARCHAR},
      fund_nav = #{record.fundNav,jdbcType=DECIMAL},
      init_weight = #{record.initWeight,jdbcType=DECIMAL},
      cost_amount = #{record.costAmount,jdbcType=DECIMAL},
      market_value = #{record.marketValue,jdbcType=DECIMAL},
      profit_loss = #{record.profitLoss,jdbcType=DECIMAL},
      match_ratio = #{record.matchRatio,jdbcType=DECIMAL},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_by = #{record.createBy,jdbcType=VARCHAR},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_by = #{record.updateBy,jdbcType=VARCHAR},
      delete_tag = #{record.deleteTag,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tanpu.fund.entity.generator.UserFundInfo">
    update user_fund_info
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="pFundId != null">
        p_fund_id = #{pFundId,jdbcType=VARCHAR},
      </if>
      <if test="fundId != null">
        fund_id = #{fundId,jdbcType=VARCHAR},
      </if>
      <if test="buyFeeRatio != null">
        buy_fee_ratio = #{buyFeeRatio,jdbcType=DECIMAL},
      </if>
      <if test="confirmShare != null">
        confirm_share = #{confirmShare,jdbcType=DECIMAL},
      </if>
      <if test="confirmShareDate != null">
        confirm_share_date = #{confirmShareDate,jdbcType=TIMESTAMP},
      </if>
      <if test="confirmAmount != null">
        confirm_amount = #{confirmAmount,jdbcType=DECIMAL},
      </if>
      <if test="fundNavId != null">
        fund_nav_id = #{fundNavId,jdbcType=VARCHAR},
      </if>
      <if test="fundNav != null">
        fund_nav = #{fundNav,jdbcType=DECIMAL},
      </if>
      <if test="initWeight != null">
        init_weight = #{initWeight,jdbcType=DECIMAL},
      </if>
      <if test="costAmount != null">
        cost_amount = #{costAmount,jdbcType=DECIMAL},
      </if>
      <if test="marketValue != null">
        market_value = #{marketValue,jdbcType=DECIMAL},
      </if>
      <if test="profitLoss != null">
        profit_loss = #{profitLoss,jdbcType=DECIMAL},
      </if>
      <if test="matchRatio != null">
        match_ratio = #{matchRatio,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="deleteTag != null">
        delete_tag = #{deleteTag,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tanpu.fund.entity.generator.UserFundInfo">
    update user_fund_info
    set user_id = #{userId,jdbcType=VARCHAR},
      p_fund_id = #{pFundId,jdbcType=VARCHAR},
      fund_id = #{fundId,jdbcType=VARCHAR},
      buy_fee_ratio = #{buyFeeRatio,jdbcType=DECIMAL},
      confirm_share = #{confirmShare,jdbcType=DECIMAL},
      confirm_share_date = #{confirmShareDate,jdbcType=TIMESTAMP},
      confirm_amount = #{confirmAmount,jdbcType=DECIMAL},
      fund_nav_id = #{fundNavId,jdbcType=VARCHAR},
      fund_nav = #{fundNav,jdbcType=DECIMAL},
      init_weight = #{initWeight,jdbcType=DECIMAL},
      cost_amount = #{costAmount,jdbcType=DECIMAL},
      market_value = #{marketValue,jdbcType=DECIMAL},
      profit_loss = #{profitLoss,jdbcType=DECIMAL},
      match_ratio = #{matchRatio,jdbcType=DECIMAL},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_by = #{createBy,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_by = #{updateBy,jdbcType=VARCHAR},
      delete_tag = #{deleteTag,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="com.tanpu.fund.entity.generator.UserFundInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from user_fund_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>