<?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.fjs.scenic.mapper.good.TicketRuleMapper">
  <resultMap id="BaseResultMap" type="com.fjs.scenic.entity.good.TicketRule">
    <constructor>
      <arg column="goods_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookAdvanceDay" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookAdvanceTime" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="useAdvanceHour" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="autoCancelTime" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookPersonType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="paymentType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="visitPersonRequiredForQuantity" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="eticketType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="smsTemplet" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="daysAfterUseDateValid" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="validType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="canOverdueRefund" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="canRefund" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="refundApplyTimeBeforeValidEndDay" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="refundCharge" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="refundChargeType" javaType="java.lang.String" jdbcType="VARCHAR" />
    </constructor>
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.fjs.scenic.entity.good.TicketRuleWithBLOBs">
    <constructor>
      <arg column="goods_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookAdvanceDay" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookAdvanceTime" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="useAdvanceHour" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="autoCancelTime" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="bookPersonType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="paymentType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="visitPersonRequiredForQuantity" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="eticketType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="smsTemplet" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="daysAfterUseDateValid" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="validType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="canOverdueRefund" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="canRefund" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="refundApplyTimeBeforeValidEndDay" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="refundCharge" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="refundChargeType" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="refundInfo" javaType="java.lang.String" jdbcType="LONGVARCHAR" />
      <arg column="remind" javaType="java.lang.String" jdbcType="LONGVARCHAR" />
    </constructor>
  </resultMap>
  <sql id="Blob_Column_List">
    refundInfo, remind
  </sql>
  <insert id="insert" parameterType="com.fjs.scenic.entity.good.TicketRuleWithBLOBs">
    insert into ticket_rule (goods_id, bookAdvanceDay, bookAdvanceTime, 
      useAdvanceHour, autoCancelTime, bookPersonType, 
      paymentType, visitPersonRequiredForQuantity, 
      eticketType, smsTemplet, daysAfterUseDateValid, 
      validType, canOverdueRefund, canRefund, 
      refundApplyTimeBeforeValidEndDay, refundCharge, 
      refundChargeType, refundInfo, remind
      )
    values (#{goodsId,jdbcType=INTEGER}, #{bookadvanceday,jdbcType=INTEGER}, #{bookadvancetime,jdbcType=VARCHAR}, 
      #{useadvancehour,jdbcType=INTEGER}, #{autocanceltime,jdbcType=INTEGER}, #{bookpersontype,jdbcType=VARCHAR}, 
      #{paymenttype,jdbcType=VARCHAR}, #{visitpersonrequiredforquantity,jdbcType=INTEGER}, 
      #{etickettype,jdbcType=VARCHAR}, #{smstemplet,jdbcType=VARCHAR}, #{daysafterusedatevalid,jdbcType=INTEGER}, 
      #{validtype,jdbcType=VARCHAR}, #{canoverduerefund,jdbcType=VARCHAR}, #{canrefund,jdbcType=VARCHAR}, 
      #{refundapplytimebeforevalidendday,jdbcType=VARCHAR}, #{refundcharge,jdbcType=INTEGER}, 
      #{refundchargetype,jdbcType=VARCHAR}, #{refundinfo,jdbcType=LONGVARCHAR}, #{remind,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fjs.scenic.entity.good.TicketRuleWithBLOBs">
    insert into ticket_rule
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="goodsId != null">
        goods_id,
      </if>
      <if test="bookadvanceday != null">
        bookAdvanceDay,
      </if>
      <if test="bookadvancetime != null">
        bookAdvanceTime,
      </if>
      <if test="useadvancehour != null">
        useAdvanceHour,
      </if>
      <if test="autocanceltime != null">
        autoCancelTime,
      </if>
      <if test="bookpersontype != null">
        bookPersonType,
      </if>
      <if test="paymenttype != null">
        paymentType,
      </if>
      <if test="visitpersonrequiredforquantity != null">
        visitPersonRequiredForQuantity,
      </if>
      <if test="etickettype != null">
        eticketType,
      </if>
      <if test="smstemplet != null">
        smsTemplet,
      </if>
      <if test="daysafterusedatevalid != null">
        daysAfterUseDateValid,
      </if>
      <if test="validtype != null">
        validType,
      </if>
      <if test="canoverduerefund != null">
        canOverdueRefund,
      </if>
      <if test="canrefund != null">
        canRefund,
      </if>
      <if test="refundapplytimebeforevalidendday != null">
        refundApplyTimeBeforeValidEndDay,
      </if>
      <if test="refundcharge != null">
        refundCharge,
      </if>
      <if test="refundchargetype != null">
        refundChargeType,
      </if>
      <if test="refundinfo != null">
        refundInfo,
      </if>
      <if test="remind != null">
        remind,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="goodsId != null">
        #{goodsId,jdbcType=INTEGER},
      </if>
      <if test="bookadvanceday != null">
        #{bookadvanceday,jdbcType=INTEGER},
      </if>
      <if test="bookadvancetime != null">
        #{bookadvancetime,jdbcType=VARCHAR},
      </if>
      <if test="useadvancehour != null">
        #{useadvancehour,jdbcType=INTEGER},
      </if>
      <if test="autocanceltime != null">
        #{autocanceltime,jdbcType=INTEGER},
      </if>
      <if test="bookpersontype != null">
        #{bookpersontype,jdbcType=VARCHAR},
      </if>
      <if test="paymenttype != null">
        #{paymenttype,jdbcType=VARCHAR},
      </if>
      <if test="visitpersonrequiredforquantity != null">
        #{visitpersonrequiredforquantity,jdbcType=INTEGER},
      </if>
      <if test="etickettype != null">
        #{etickettype,jdbcType=VARCHAR},
      </if>
      <if test="smstemplet != null">
        #{smstemplet,jdbcType=VARCHAR},
      </if>
      <if test="daysafterusedatevalid != null">
        #{daysafterusedatevalid,jdbcType=INTEGER},
      </if>
      <if test="validtype != null">
        #{validtype,jdbcType=VARCHAR},
      </if>
      <if test="canoverduerefund != null">
        #{canoverduerefund,jdbcType=VARCHAR},
      </if>
      <if test="canrefund != null">
        #{canrefund,jdbcType=VARCHAR},
      </if>
      <if test="refundapplytimebeforevalidendday != null">
        #{refundapplytimebeforevalidendday,jdbcType=VARCHAR},
      </if>
      <if test="refundcharge != null">
        #{refundcharge,jdbcType=INTEGER},
      </if>
      <if test="refundchargetype != null">
        #{refundchargetype,jdbcType=VARCHAR},
      </if>
      <if test="refundinfo != null">
        #{refundinfo,jdbcType=LONGVARCHAR},
      </if>
      <if test="remind != null">
        #{remind,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  
  <select id="selectByGoodsId" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select goods_id, bookAdvanceDay, bookAdvanceTime, 
      useAdvanceHour, autoCancelTime, bookPersonType, 
      paymentType, visitPersonRequiredForQuantity, 
      eticketType, smsTemplet, daysAfterUseDateValid, 
      validType, canOverdueRefund, canRefund, 
      refundApplyTimeBeforeValidEndDay, refundCharge, 
      refundChargeType,refundInfo,remind
    from ticket_rule
    where goods_id = #{goodsId,jdbcType=INTEGER}
  </select>
  
  
  <update id="updateByCytGoodsIdSelective" parameterType="com.fjs.scenic.entity.good.TicketRuleWithBLOBs">
    update ticket_rule
    <set>
      <if test="bookadvanceday != null">
        bookAdvanceDay= #{bookadvanceday,jdbcType=INTEGER},
      </if>
      <if test="bookadvancetime != null">
        bookAdvanceTime= #{bookadvancetime,jdbcType=VARCHAR},
      </if>
      <if test="useadvancehour != null">
        useAdvanceHour= #{useadvancehour,jdbcType=INTEGER},
      </if>
      <if test="autocanceltime != null">
        autoCancelTime= #{autocanceltime,jdbcType=INTEGER},
      </if>
      <if test="bookpersontype != null">
        bookPersonType= #{bookpersontype,jdbcType=VARCHAR},
      </if>
      <if test="paymenttype != null">
        paymentType= #{paymenttype,jdbcType=VARCHAR},
      </if>
      <if test="visitpersonrequiredforquantity != null">
        visitPersonRequiredForQuantity= #{visitpersonrequiredforquantity,jdbcType=INTEGER},
      </if>
      <if test="etickettype != null">
        eticketType= #{etickettype,jdbcType=VARCHAR},
      </if>
      <if test="smstemplet != null">
        smsTemplet = #{smstemplet,jdbcType=VARCHAR},
      </if>
      <if test="daysafterusedatevalid != null">
        daysAfterUseDateValid = #{daysafterusedatevalid,jdbcType=INTEGER},
      </if>
      <if test="validtype != null">
        validType = #{validtype,jdbcType=VARCHAR},
      </if>
      <if test="canoverduerefund != null">
        canOverdueRefund = #{canoverduerefund,jdbcType=VARCHAR},
      </if>
      <if test="canrefund != null">
        canRefund = #{canrefund,jdbcType=VARCHAR},
      </if>
      <if test="refundapplytimebeforevalidendday != null">
        refundApplyTimeBeforeValidEndDay= #{refundapplytimebeforevalidendday,jdbcType=VARCHAR},
      </if>
      <if test="refundcharge != null">
        refundCharge = #{refundcharge,jdbcType=INTEGER},
      </if>
      <if test="refundchargetype != null">
        refundChargeType = #{refundchargetype,jdbcType=VARCHAR},
      </if>
      <if test="refundinfo != null">
        refundInfo = #{refundinfo,jdbcType=VARCHAR},
      </if>
      <if test="remind != null">
        remind = #{remind,jdbcType=VARCHAR},
      </if>
    </set>
    where goods_id = #{goodsId,jdbcType=INTEGER}
  </update>
  
</mapper>