<?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.yd.dal.mapper.customer.trackvideo.AgAclCustomerBehaviorTrackVideoMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="serials_no" jdbcType="VARCHAR" property="serialsNo" />
    <result column="customer_id" jdbcType="BIGINT" property="customerId" />
    <result column="config_level" jdbcType="INTEGER" property="configLevel" />
    <result column="product_id" jdbcType="BIGINT" property="productId" />
    <result column="plan_id" jdbcType="BIGINT" property="planId" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="token" jdbcType="VARCHAR" property="token" />
    <result column="page_type" jdbcType="INTEGER" property="pageType" />
    <result column="page_name" jdbcType="VARCHAR" property="pageName" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="data_oss_path" jdbcType="VARCHAR" property="dataOssPath" />
    <result column="customer_ip" jdbcType="VARCHAR" property="customerIp" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
    <result column="updated_by" jdbcType="BIGINT" property="updatedBy" />
  </resultMap>
  <sql id="Base_Column_List">
    id, serials_no,customer_id,config_level, product_id, plan_id, order_no, token, page_type, page_name, url, data_oss_path, customer_ip,
    is_active, remark, created_at, created_by, updated_at, updated_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from ag_acl_customer_behavior_track_video
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from ag_acl_customer_behavior_track_video
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo" useGeneratedKeys="true">
    insert into ag_acl_customer_behavior_track_video (serials_no,customer_id,config_level, product_id, plan_id, 
      order_no, token, page_type, page_name, url, data_oss_path, customer_ip, 
      is_active, remark, 
      created_at, created_by, updated_at, 
      updated_by)
    values (#{serialsNo,jdbcType=VARCHAR}, #{customerId,jdbcType=BIGINT}, #{configLevel,jdbcType=INTEGER}, #{productId,jdbcType=BIGINT}, #{planId,jdbcType=BIGINT}, 
      #{orderNo,jdbcType=VARCHAR}, #{token,jdbcType=VARCHAR}, #{pageType,jdbcType=INTEGER}, #{pageName,jdbcType=VARCHAR},  #{url,jdbcType=VARCHAR}, 
      #{dataOssPath,jdbcType=VARCHAR}, #{customerIp,jdbcType=VARCHAR},  #{isActive,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, 
      #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, #{updatedAt,jdbcType=TIMESTAMP}, 
      #{updatedBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo" useGeneratedKeys="true">
    insert into ag_acl_customer_behavior_track_video
    <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="serialsNo != null">
        serials_no,
      </if>
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="configLevel != null">
        config_level,
      </if>
      <if test="productId != null">
        product_id,
      </if>
      <if test="planId != null">
        plan_id,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="token != null">
        token,
      </if>
      <if test="pageType != null">
        page_type,
      </if>
      <if test="pageName != null">
        page_name,
      </if>
      <if test="url != null">
        url,
      </if>
      <if test="dataOssPath != null">
        data_oss_path,
      </if>
      <if test="customerIp != null">
        customer_ip,
      </if>
      <if test="isActive != null">
        is_active,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
     <if test="serialsNo != null">
        #{serialsNo,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null">
        #{customerId,jdbcType=BIGINT},
      </if>
      <if test="configLevel != null">
        #{configLevel,jdbcType=INTEGER},
      </if>
      <if test="productId != null">
        #{productId,jdbcType=BIGINT},
      </if>
      <if test="planId != null">
        #{planId,jdbcType=BIGINT},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="token != null">
        #{token,jdbcType=VARCHAR},
      </if>
      <if test="pageType != null">
        #{pageType,jdbcType=INTEGER},
      </if>
      <if test="pageName != null">
        #{pageName,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="dataOssPath != null">
        #{dataOssPath,jdbcType=VARCHAR},
      </if>
      <if test="customerIp != null">
        #{customerIp,jdbcType=VARCHAR},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo">
    update ag_acl_customer_behavior_track_video
    <set>
     <if test="serialsNo != null">
       serials_no =  #{serialsNo,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=BIGINT},
      </if>
      <if test="configLevel != null">
        config_level = #{configLevel,jdbcType=INTEGER},
      </if>
      <if test="productId != null">
        product_id = #{productId,jdbcType=BIGINT},
      </if>
      <if test="planId != null">
        plan_id = #{planId,jdbcType=BIGINT},
      </if>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="token != null">
        token = #{token,jdbcType=VARCHAR},
      </if>
      <if test="pageType != null">
        page_type = #{pageType,jdbcType=INTEGER},
      </if>
      <if test="pageName != null">
        page_name = #{pageName,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="dataOssPath != null">
        data_oss_path = #{dataOssPath,jdbcType=VARCHAR},
      </if>
      <if test="customerIp != null">
        customer_ip = #{customerIp,jdbcType=VARCHAR},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo">
    update ag_acl_customer_behavior_track_video
    set serials_no =  #{serialsNo,jdbcType=VARCHAR},
      serials_id = #{customerId,jdbcType=BIGINT},
      config_level = #{configLevel,jdbcType=INTEGER},
      product_id = #{productId,jdbcType=BIGINT},
      plan_id = #{planId,jdbcType=BIGINT},
      order_no = #{orderNo,jdbcType=VARCHAR},
      token = #{token,jdbcType=VARCHAR},
      page_type = #{pageType,jdbcType=INTEGER},
      page_name = #{pageName,jdbcType=INTEGER},
      url = #{url,jdbcType=INTEGER},
      data_oss_path = #{dataOssPath,jdbcType=VARCHAR},
      customer_ip = #{customerIp,jdbcType=VARCHAR},
      is_active = #{isActive,jdbcType=INTEGER},
      remark = #{remark,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      updated_by = #{updatedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <select id="selectByRecord" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from ag_acl_customer_behavior_track_video t
    where 1=1
    <if test="serialsNo != null">
      and serials_no =  #{serialsNo,jdbcType=VARCHAR}
    </if>
    <if test="customerId != null">
      and customer_id = #{customerId,jdbcType=BIGINT}
    </if>
    <if test="configLevel != null">
      and t.config_level = #{configLevel,jdbcType=BIGINT}
    </if>
    <if test="productId != null">
      and t.product_id = #{productId,jdbcType=BIGINT}
    </if>
    <if test="planId != null">
      and t.plan_id = #{planId,jdbcType=BIGINT}
    </if>
    <if test="orderNo != null">
      and t.order_no = #{orderNo,jdbcType=VARCHAR}
    </if>
    <if test="pageType != null">
      and t.page_type = #{pageType,jdbcType=BIGINT}
    </if>
    <if test="pageName != null">
      and t.page_name = #{pageName,jdbcType=BIGINT}
    </if>
    <if test="url != null">
      and t.url = #{url,jdbcType=VARCHAR}
    </if>
    <if test="token != null">
      and t.token = #{token,jdbcType=VARCHAR}
    </if>
  </select>
  
  <update id="updateBySerialsNo" parameterType="com.yd.dal.entity.customer.trackvideo.AgAclCustomerBehaviorTrackVideo">
    update ag_acl_customer_behavior_track_video
    <set>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=BIGINT},
      </if>
      <if test="configLevel != null">
        config_level = #{configLevel,jdbcType=INTEGER},
      </if>
      <if test="productId != null">
        product_id = #{productId,jdbcType=BIGINT},
      </if>
      <if test="planId != null">
        plan_id = #{planId,jdbcType=BIGINT},
      </if>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=BIGINT},
      </if>
    </set>
    where serials_no = #{serialsNo,jdbcType=VARCHAR} and order_no is null
  </update>
  
</mapper>