<?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.qunzhixinxi.hnqz.admin.mapper.WmPayOffMapper" >
  <resultMap id="BaseResultMap" type="com.qunzhixinxi.hnqz.admin.entity.WmPayOff" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="score_name" property="scoreName" jdbcType="VARCHAR" />
    <result column="id_number" property="idNumber" jdbcType="VARCHAR" />
    <result column="settle_status" property="settleStatus" jdbcType="VARCHAR" />
    <result column="cause_failure" property="causeFailure" jdbcType="VARCHAR" />
    <result column="cert_status" property="certStatus" jdbcType="VARCHAR" />
    <result column="settle_amount" property="settleAmount" jdbcType="DECIMAL" />
    <result column="discount" property="discount" jdbcType="DECIMAL" />
    <result column="score_id" property="scoreId" jdbcType="BIGINT" />
    <result column="settle_people" property="settlePeople" jdbcType="VARCHAR" />
    <result column="settle_time" property="settleTime" jdbcType="TIMESTAMP" />
    <result column="export1" property="export1" jdbcType="VARCHAR" />
    <result column="export2" property="export2" jdbcType="VARCHAR" />
    <result column="export3" property="export3" jdbcType="VARCHAR" />
	  <result column="statement_no" property="statementNo" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, score_name, id_number, settle_status, cause_failure, cert_status, submitted_value,
    settle_amount, discount, score_id, settle_people, settle_time,
     export1, export2, export3, statement_no
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List" />
    from wm_payoff
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from wm_payoff
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmPayOff" >
    insert into wm_payoff (id, score_name, id_number,
      settle_status, cause_failure, cert_status,
      submitted_value, settle_amount,
      discount, score_id, settle_people,
      settle_time,
      export1, export2, export3,
      statement_no)
    values (#{id,jdbcType=BIGINT}, #{scoreName,jdbcType=VARCHAR}, #{idNumber,jdbcType=VARCHAR},
      #{settleStatus,jdbcType=VARCHAR}, #{causeFailure,jdbcType=VARCHAR}, #{certStatus,jdbcType=VARCHAR},
      #{submittedValue,jdbcType=VARCHAR},  #{settleAmount,jdbcType=DECIMAL},
      #{discount,jdbcType=DECIMAL}, #{scoreId,jdbcType=BIGINT}, #{settlePeople,jdbcType=VARCHAR},
      #{settleTime,jdbcType=TIMESTAMP},
      #{export1,jdbcType=VARCHAR}, #{export2,jdbcType=VARCHAR}, #{export3,jdbcType=VARCHAR},
      #{statementNo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmPayOff" >
    insert into wm_payoff
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="scoreName != null" >
        score_name,
      </if>
      <if test="idNumber != null" >
        id_number,
      </if>
      <if test="settleStatus != null" >
        settle_status,
      </if>
      <if test="causeFailure != null" >
        cause_failure,
      </if>
      <if test="certStatus != null" >
        cert_status,
      </if>
      <if test="submittedValue != null" >
        submitted_value,
      </if>
      <if test="settleAmount != null" >
        settle_amount,
      </if>
      <if test="discount != null" >
        discount,
      </if>
      <if test="scoreId != null" >
        score_id,
      </if>
      <if test="settlePeople != null" >
        settle_people,
      </if>
      <if test="settleTime != null" >
        settle_time,
      </if>
      <if test="export1 != null" >
        export1,
      </if>
      <if test="export2 != null" >
        export2,
      </if>
      <if test="export3 != null" >
        export3,
      </if>
	<if test="statementNo != null and statementNo != '' " >
		statement_no,
	</if>

    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="scoreName != null" >
        #{scoreName,jdbcType=VARCHAR},
      </if>
      <if test="idNumber != null" >
        #{idNumber,jdbcType=VARCHAR},
      </if>
      <if test="settleStatus != null" >
        #{settleStatus,jdbcType=VARCHAR},
      </if>
      <if test="causeFailure != null" >
        #{causeFailure,jdbcType=VARCHAR},
      </if>
      <if test="certStatus != null" >
        #{certStatus,jdbcType=VARCHAR},
      </if>
      <if test="submittedValue != null" >
        #{submittedValue,jdbcType=VARCHAR},
      </if>
      <if test="settleAmount != null" >
        #{settleAmount,jdbcType=DECIMAL},
      </if>
      <if test="discount != null" >
        #{discount,jdbcType=DECIMAL},
      </if>
      <if test="scoreId != null" >
        #{scoreId,jdbcType=BIGINT},
      </if>
      <if test="settlePeople != null" >
        #{settlePeople,jdbcType=VARCHAR},
      </if>
      <if test="settleTime != null" >
        #{settleTime,jdbcType=TIMESTAMP},
      </if>
      <if test="export1 != null" >
        #{export1,jdbcType=VARCHAR},
      </if>
      <if test="export2 != null" >
        #{export2,jdbcType=VARCHAR},
      </if>
      <if test="export3 != null" >
        #{export3,jdbcType=VARCHAR},
      </if>
		<if test="statementNo != null  and statementNo != '' " >
			#{statementNo,jdbcType=VARCHAR},
		</if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmPayOff" >
    update wm_payoff
    <set >
      <if test="scoreName != null" >
        score_name = #{scoreName,jdbcType=VARCHAR},
      </if>
      <if test="idNumber != null" >
        id_number = #{idNumber,jdbcType=VARCHAR},
      </if>
      <if test="settleStatus != null" >
        settle_status = #{settleStatus,jdbcType=VARCHAR},
      </if>
      <if test="causeFailure != null" >
        cause_failure = #{causeFailure,jdbcType=VARCHAR},
      </if>
      <if test="certStatus != null" >
        cert_status = #{certStatus,jdbcType=VARCHAR},
      </if>
      <if test="submittedValue != null" >
        submitted_value = #{submittedValue,jdbcType=VARCHAR},
      </if>
      <if test="settleAmount != null" >
        settle_amount = #{settleAmount,jdbcType=DECIMAL},
      </if>
      <if test="discount != null" >
        discount = #{discount,jdbcType=DECIMAL},
      </if>
      <if test="scoreId != null" >
        score_id = #{scoreId,jdbcType=BIGINT},
      </if>
      <if test="settlePeople != null" >
        settle_people = #{settlePeople,jdbcType=VARCHAR},
      </if>
      <if test="settleTime != null" >
        settle_time = #{settleTime,jdbcType=TIMESTAMP},
      </if>
      <if test="export1 != null" >
        export1 = #{export1,jdbcType=VARCHAR},
      </if>
      <if test="export2 != null" >
        export2 = #{export2,jdbcType=VARCHAR},
      </if>
      <if test="export3 != null" >
        export3 = #{export3,jdbcType=VARCHAR},
      </if>
		<if test="statementNo != null  and statementNo != '' " >
			statement_no = #{statementNo,jdbcType=VARCHAR},
		</if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.qunzhixinxi.hnqz.admin.entity.WmPayOff" >
    update wm_payoff
    set score_name = #{scoreName,jdbcType=VARCHAR},
      id_number = #{idNumber,jdbcType=VARCHAR},
      settle_status = #{settleStatus,jdbcType=VARCHAR},
      cause_failure = #{causeFailure,jdbcType=VARCHAR},
      cert_status = #{certStatus,jdbcType=VARCHAR},
      submitted_value = #{submittedValue,jdbcType=VARCHAR},
      settle_amount = #{settleAmount,jdbcType=DECIMAL},
      discount = #{discount,jdbcType=DECIMAL},
      score_id = #{scoreId,jdbcType=BIGINT},
      settle_people = #{settlePeople,jdbcType=VARCHAR},
      settle_time = #{settleTime,jdbcType=TIMESTAMP},
      export1 = #{export1,jdbcType=VARCHAR},
      export2 = #{export2,jdbcType=VARCHAR},
      export3 = #{export3,jdbcType=VARCHAR},
      statement_no= #{statementNo,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>

	<select id="selectByParam" resultMap="BaseResultMap" >
		select
		<include refid="Base_Column_List" />
		from wm_payoff
		where 1=1

		<if test="query.id != null and query.id != ''">
			and wm_payoff.id= #{query.id,jdbcType=BIGINT}
		</if>
		<if test="query.statementNo != null and query.statementNo != ''">
			and wm_payoff.statement_no= #{query.statementNo,jdbcType=VARCHAR}
		</if>
		<if test="query.scoreId != null and query.scoreId != ''">
			and wm_payoff.score_id= #{query.scoreId,jdbcType=BIGINT}
		</if>
	</select>
</mapper>
