<?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="cn.superdesk.uniorder.dao.mapper.invoice.customer.fundrestream.InvoiceBankStatementMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatement">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="main_name" jdbcType="VARCHAR" property="mainName" />
    <result column="bank_name" jdbcType="VARCHAR" property="bankName" />
    <result column="count" jdbcType="DECIMAL" property="count" />
    <result column="no_check_count" jdbcType="DECIMAL" property="noCheckCount" />
    <result column="enable" jdbcType="TINYINT" property="enable" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="payee" jdbcType="VARCHAR" property="payee" />
    <result column="payee_account" jdbcType="VARCHAR" property="payeeAccount" />
    <result column="pay_time" jdbcType="DATE" property="payTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </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, main_name, bank_name, count, no_check_count, enable, status, payee, payee_account, 
    pay_time, remark, create_time
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatementExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from invoice_bank_statement
    <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">
    select 
    <include refid="Base_Column_List" />
    from invoice_bank_statement
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from invoice_bank_statement
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatementExample">
    delete from invoice_bank_statement
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatement">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into invoice_bank_statement (main_name, bank_name, count, 
      no_check_count, enable, status, 
      payee, payee_account, pay_time, 
      remark, create_time)
    values (#{mainName,jdbcType=VARCHAR}, #{bankName,jdbcType=VARCHAR}, #{count,jdbcType=DECIMAL}, 
      #{noCheckCount,jdbcType=DECIMAL}, #{enable,jdbcType=TINYINT}, #{status,jdbcType=TINYINT}, 
      #{payee,jdbcType=VARCHAR}, #{payeeAccount,jdbcType=VARCHAR}, #{payTime,jdbcType=DATE}, 
      #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatement">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into invoice_bank_statement
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mainName != null">
        main_name,
      </if>
      <if test="bankName != null">
        bank_name,
      </if>
      <if test="count != null">
        count,
      </if>
      <if test="noCheckCount != null">
        no_check_count,
      </if>
      <if test="enable != null">
        enable,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="payee != null">
        payee,
      </if>
      <if test="payeeAccount != null">
        payee_account,
      </if>
      <if test="payTime != null">
        pay_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mainName != null">
        #{mainName,jdbcType=VARCHAR},
      </if>
      <if test="bankName != null">
        #{bankName,jdbcType=VARCHAR},
      </if>
      <if test="count != null">
        #{count,jdbcType=DECIMAL},
      </if>
      <if test="noCheckCount != null">
        #{noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="enable != null">
        #{enable,jdbcType=TINYINT},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="payee != null">
        #{payee,jdbcType=VARCHAR},
      </if>
      <if test="payeeAccount != null">
        #{payeeAccount,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        #{payTime,jdbcType=DATE},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatementExample" resultType="java.lang.Long">
    select count(*) from invoice_bank_statement
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update invoice_bank_statement
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.mainName != null">
        main_name = #{record.mainName,jdbcType=VARCHAR},
      </if>
      <if test="record.bankName != null">
        bank_name = #{record.bankName,jdbcType=VARCHAR},
      </if>
      <if test="record.count != null">
        count = #{record.count,jdbcType=DECIMAL},
      </if>
      <if test="record.noCheckCount != null">
        no_check_count = #{record.noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="record.enable != null">
        enable = #{record.enable,jdbcType=TINYINT},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=TINYINT},
      </if>
      <if test="record.payee != null">
        payee = #{record.payee,jdbcType=VARCHAR},
      </if>
      <if test="record.payeeAccount != null">
        payee_account = #{record.payeeAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.payTime != null">
        pay_time = #{record.payTime,jdbcType=DATE},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update invoice_bank_statement
    set id = #{record.id,jdbcType=BIGINT},
      main_name = #{record.mainName,jdbcType=VARCHAR},
      bank_name = #{record.bankName,jdbcType=VARCHAR},
      count = #{record.count,jdbcType=DECIMAL},
      no_check_count = #{record.noCheckCount,jdbcType=DECIMAL},
      enable = #{record.enable,jdbcType=TINYINT},
      status = #{record.status,jdbcType=TINYINT},
      payee = #{record.payee,jdbcType=VARCHAR},
      payee_account = #{record.payeeAccount,jdbcType=VARCHAR},
      pay_time = #{record.payTime,jdbcType=DATE},
      remark = #{record.remark,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatement">
    update invoice_bank_statement
    <set>
      <if test="mainName != null">
        main_name = #{mainName,jdbcType=VARCHAR},
      </if>
      <if test="bankName != null">
        bank_name = #{bankName,jdbcType=VARCHAR},
      </if>
      <if test="count != null">
        count = #{count,jdbcType=DECIMAL},
      </if>
      <if test="noCheckCount != null">
        no_check_count = #{noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="enable != null">
        enable = #{enable,jdbcType=TINYINT},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=TINYINT},
      </if>
      <if test="payee != null">
        payee = #{payee,jdbcType=VARCHAR},
      </if>
      <if test="payeeAccount != null">
        payee_account = #{payeeAccount,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        pay_time = #{payTime,jdbcType=DATE},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.invoice.customer.fundrestream.InvoiceBankStatement">
    update invoice_bank_statement
    set main_name = #{mainName,jdbcType=VARCHAR},
      bank_name = #{bankName,jdbcType=VARCHAR},
      count = #{count,jdbcType=DECIMAL},
      no_check_count = #{noCheckCount,jdbcType=DECIMAL},
      enable = #{enable,jdbcType=TINYINT},
      status = #{status,jdbcType=TINYINT},
      payee = #{payee,jdbcType=VARCHAR},
      payee_account = #{payeeAccount,jdbcType=VARCHAR},
      pay_time = #{payTime,jdbcType=DATE},
      remark = #{remark,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>