<?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.liquidnet.service.account.funding.mapper.FinAccountMapper">
  <resultMap id="BaseResultMap" type="com.liquidnet.service.account.funding.entity.FinAccount">
    <result column="FA0" jdbcType="VARCHAR" property="accNo" />
    <result column="FA1" jdbcType="VARCHAR" property="finId" />
    <result column="FA2" jdbcType="VARCHAR" property="accType" />
    <result column="FA3" jdbcType="VARCHAR" property="accCurrency" />
    <result column="FA4" jdbcType="INTEGER" property="accStatus" />
    <result column="FA5" jdbcType="VARCHAR" property="accAlias" />
    <result column="FA6" jdbcType="VARCHAR" property="accGroupId" />
    <result column="FA7" jdbcType="VARCHAR" property="accParent" />
    <result column="FA8" jdbcType="INTEGER" property="accLevel" />
    <result column="FA9" jdbcType="INTEGER" property="accState" />
    <result column="FA10" jdbcType="TIMESTAMP" property="createTime" />
    <result column="FA11" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="FA12" jdbcType="TIMESTAMP" property="closingTime" />
    <result column="FA13" jdbcType="TIMESTAMP" property="checkTime" />
    <result column="FA14" jdbcType="INTEGER" property="checkStatus" />
    <result column="FA15" jdbcType="VARCHAR" property="checkId" />
  </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">
    FA0, FA1, FA2, FA3, FA4, FA5, FA6, FA7,
    FA8, FA9, FA10, FA11, FA12, FA13, FA14,
    FA15
  </sql>
  <select id="selectByExample" parameterType="com.liquidnet.service.account.funding.entity.FinAccountExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from FIN_AC_N01
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from FIN_AC_N01
    where FA0 = #{accNo,jdbcType=VARCHAR}
  </select>
  <insert id="insert" parameterType="com.liquidnet.service.account.funding.entity.FinAccount">
    insert into FIN_AC_N01 (FA0, FA1, FA2,
      FA3, FA4, FA5,
      FA6, FA7, FA8,
      FA9, FA10, FA11,
      FA12, FA13, FA14,
      FA15)
    values (#{accNo,jdbcType=VARCHAR}, #{finId,jdbcType=VARCHAR}, #{accType,jdbcType=VARCHAR}, 
      #{accCurrency,jdbcType=VARCHAR}, #{accStatus,jdbcType=INTEGER}, #{accAlias,jdbcType=VARCHAR}, 
      #{accGroupId,jdbcType=VARCHAR}, #{accParent,jdbcType=VARCHAR}, #{accLevel,jdbcType=INTEGER}, 
      #{accState,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{closingTime,jdbcType=TIMESTAMP}, #{checkTime,jdbcType=TIMESTAMP}, #{checkStatus,jdbcType=INTEGER}, 
      #{checkId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.liquidnet.service.account.funding.entity.FinAccount">
    insert into FIN_AC_N01
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="accNo != null">
        FA0,
      </if>
      <if test="finId != null">
        FA1,
      </if>
      <if test="accType != null">
        FA2,
      </if>
      <if test="accCurrency != null">
        FA3,
      </if>
      <if test="accStatus != null">
        FA4,
      </if>
      <if test="accAlias != null">
        FA5,
      </if>
      <if test="accGroupId != null">
        FA6,
      </if>
      <if test="accParent != null">
        FA7,
      </if>
      <if test="accLevel != null">
        FA8,
      </if>
      <if test="accState != null">
        FA9,
      </if>
      <if test="createTime != null">
        FA10,
      </if>
      <if test="updateTime != null">
        FA11,
      </if>
      <if test="closingTime != null">
        FA12,
      </if>
      <if test="checkTime != null">
        FA13,
      </if>
      <if test="checkStatus != null">
        FA14,
      </if>
      <if test="checkId != null">
        FA15,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="accNo != null">
        #{accNo,jdbcType=VARCHAR},
      </if>
      <if test="finId != null">
        #{finId,jdbcType=VARCHAR},
      </if>
      <if test="accType != null">
        #{accType,jdbcType=VARCHAR},
      </if>
      <if test="accCurrency != null">
        #{accCurrency,jdbcType=VARCHAR},
      </if>
      <if test="accStatus != null">
        #{accStatus,jdbcType=INTEGER},
      </if>
      <if test="accAlias != null">
        #{accAlias,jdbcType=VARCHAR},
      </if>
      <if test="accGroupId != null">
        #{accGroupId,jdbcType=VARCHAR},
      </if>
      <if test="accParent != null">
        #{accParent,jdbcType=VARCHAR},
      </if>
      <if test="accLevel != null">
        #{accLevel,jdbcType=INTEGER},
      </if>
      <if test="accState != null">
        #{accState,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="closingTime != null">
        #{closingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkTime != null">
        #{checkTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkStatus != null">
        #{checkStatus,jdbcType=INTEGER},
      </if>
      <if test="checkId != null">
        #{checkId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.liquidnet.service.account.funding.entity.FinAccountExample" resultType="java.lang.Integer">
    select count(*) from FIN_AC_N01
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update FIN_AC_N01
    <set>
      <if test="record.accNo != null">
        FA0 = #{record.accNo,jdbcType=VARCHAR},
      </if>
      <if test="record.finId != null">
        FA1 = #{record.finId,jdbcType=VARCHAR},
      </if>
      <if test="record.accType != null">
        FA2 = #{record.accType,jdbcType=VARCHAR},
      </if>
      <if test="record.accCurrency != null">
        FA3 = #{record.accCurrency,jdbcType=VARCHAR},
      </if>
      <if test="record.accStatus != null">
        FA4 = #{record.accStatus,jdbcType=INTEGER},
      </if>
      <if test="record.accAlias != null">
        FA5 = #{record.accAlias,jdbcType=VARCHAR},
      </if>
      <if test="record.accGroupId != null">
        FA6 = #{record.accGroupId,jdbcType=VARCHAR},
      </if>
      <if test="record.accParent != null">
        FA7 = #{record.accParent,jdbcType=VARCHAR},
      </if>
      <if test="record.accLevel != null">
        FA8 = #{record.accLevel,jdbcType=INTEGER},
      </if>
      <if test="record.accState != null">
        FA9 = #{record.accState,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null">
        FA10 = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        FA11 = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.closingTime != null">
        FA12 = #{record.closingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.checkTime != null">
        FA13 = #{record.checkTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.checkStatus != null">
        FA14 = #{record.checkStatus,jdbcType=INTEGER},
      </if>
      <if test="record.checkId != null">
        FA15 = #{record.checkId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update FIN_AC_N01
    set FA0 = #{record.accNo,jdbcType=VARCHAR},
      FA1 = #{record.finId,jdbcType=VARCHAR},
      FA2 = #{record.accType,jdbcType=VARCHAR},
      FA3 = #{record.accCurrency,jdbcType=VARCHAR},
      FA4 = #{record.accStatus,jdbcType=INTEGER},
      FA5 = #{record.accAlias,jdbcType=VARCHAR},
      FA6 = #{record.accGroupId,jdbcType=VARCHAR},
      FA7 = #{record.accParent,jdbcType=VARCHAR},
      FA8 = #{record.accLevel,jdbcType=INTEGER},
      FA9 = #{record.accState,jdbcType=INTEGER},
      FA10 = #{record.createTime,jdbcType=TIMESTAMP},
      FA11 = #{record.updateTime,jdbcType=TIMESTAMP},
      FA12 = #{record.closingTime,jdbcType=TIMESTAMP},
      FA13 = #{record.checkTime,jdbcType=TIMESTAMP},
      FA14 = #{record.checkStatus,jdbcType=INTEGER},
      FA15 = #{record.checkId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.liquidnet.service.account.funding.entity.FinAccount" >
    update FIN_AC_N01
    <set >
      <if test="finId != null" >
        FA1 = #{finId,jdbcType=VARCHAR},
      </if>
      <if test="accType != null" >
        FA2 = #{accType,jdbcType=VARCHAR},
      </if>
      <if test="accCurrency != null" >
        FA3 = #{accCurrency,jdbcType=VARCHAR},
      </if>
      <if test="accStatus != null" >
        FA4 = #{accStatus,jdbcType=DECIMAL},
      </if>
      <if test="accAlias != null" >
        FA5 = #{accAlias,jdbcType=VARCHAR},
      </if>
      <if test="accGroupId != null" >
        FA6 = #{accGroupId,jdbcType=VARCHAR},
      </if>
      <if test="accParent != null" >
        FA7 = #{accParent,jdbcType=VARCHAR},
      </if>
      <if test="accLevel != null" >
        FA8 = #{accLevel,jdbcType=DECIMAL},
      </if>
      <if test="accState != null" >
        FA9 = #{accState,jdbcType=DECIMAL},
      </if>
      <if test="createTime != null" >
        FA10 = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        FA11 = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="closingTime != null" >
        FA12 = #{closingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkTime != null" >
        FA13 = #{checkTime,jdbcType=TIMESTAMP},
      </if>
      <if test="checkStatus != null" >
        FA14 = #{checkStatus,jdbcType=DECIMAL},
      </if>
      <if test="checkId != null" >
        FA15 = #{checkId,jdbcType=VARCHAR},
      </if>
    </set>
    where FA0 = #{accNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.liquidnet.service.account.funding.entity.FinAccount" >
    update FIN_AC_N01
    set FA1 = #{finId,jdbcType=VARCHAR},
      FA2 = #{accType,jdbcType=VARCHAR},
      FA3 = #{accCurrency,jdbcType=VARCHAR},
      FA4 = #{accStatus,jdbcType=DECIMAL},
      FA5 = #{accAlias,jdbcType=VARCHAR},
      FA6 = #{accGroupId,jdbcType=VARCHAR},
      FA7 = #{accParent,jdbcType=VARCHAR},
      FA8 = #{accLevel,jdbcType=DECIMAL},
      FA9 = #{accState,jdbcType=DECIMAL},
      FA10 = #{createTime,jdbcType=TIMESTAMP},
      FA11 = #{updateTime,jdbcType=TIMESTAMP},
      FA12 = #{closingTime,jdbcType=TIMESTAMP},
      FA13 = #{checkTime,jdbcType=TIMESTAMP},
      FA14 = #{checkStatus,jdbcType=DECIMAL},
      FA15 = #{checkId,jdbcType=VARCHAR}
    where FA0 = #{accNo,jdbcType=VARCHAR}
  </update>


  <select id="generateSeqNo" resultType="java.lang.Long">
    select _nextval(#{sequenceName,jdbcType=VARCHAR})
  </select>
  <insert id="insertBatch" parameterType="java.util.List">
    INSERT INTO FIN_AC_N01 (FA0, FA1, FA2,
      FA3, FA4, FA5,
      FA6, FA7, FA8,
      FA9, FA10, FA11,
      FA12, FA13, FA14, FA15
      )
    VALUES
    <foreach collection="records" item="obj" index="idx" open="" close="" separator=",">
      (#{obj.accNo,jdbcType=VARCHAR},
      #{obj.finId,jdbcType=VARCHAR},
      #{obj.accType,jdbcType=VARCHAR},
      #{obj.accCurrency,jdbcType=VARCHAR},
      #{obj.accStatus,jdbcType=DECIMAL},
      #{obj.accAlias,jdbcType=VARCHAR},
      #{obj.accGroupId,jdbcType=VARCHAR},
      #{obj.accParent,jdbcType=VARCHAR},
      #{obj.accLevel,jdbcType=VARCHAR},
      #{obj.accState,jdbcType=VARCHAR},
      #{obj.createTime,jdbcType=TIMESTAMP},
      #{obj.updateTime,jdbcType=TIMESTAMP},
      #{obj.closingTime,jdbcType=TIMESTAMP},
      #{obj.checkTime,jdbcType=TIMESTAMP},
      #{obj.checkStatus,jdbcType=DECIMAL},
      #{obj.checkId,jdbcType=VARCHAR})
    </foreach>
  </insert>
  <select id="selectByCombineds" resultMap="BaseResultMap" parameterType="com.liquidnet.service.account.funding.entity.FinAccount">
    SELECT
    <include refid="Base_Column_List" />
    FROM FIN_AC_N01 FA
    /*WHERE CONCAT(FA.FA1, FA.FA4, FA.FA5) IN*/
    WHERE
    <foreach collection="records" index="idx" item="obj" open="" close="" separator="OR">
      (FA.FA1 = #{records[${idx}].finId,jdbcType=VARCHAR} AND FA.FA4 = #{records[${idx}].accType,jdbcType=VARCHAR} AND FA.FA5 = #{records[${idx}].accCurrency,jdbcType=VARCHAR})
    </foreach>
  </select>
</mapper>