<?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.gic.haoban.manage.service.dao.mapper.TabHaobanMaidianLogMapper" >
  <resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabHaobanMaidianLog" >
    <id column="maidian_id" property="maidianId" jdbcType="INTEGER" />
    <result column="staff_id" property="staffId" jdbcType="VARCHAR" />
    <result column="wx_enterprise_id" property="wxEnterpriseId" jdbcType="VARCHAR" />
    <result column="phone_number" property="phoneNumber" jdbcType="VARCHAR" />
    <result column="device_date" property="deviceDate" jdbcType="TIMESTAMP" />
    <result column="options" property="options" jdbcType="VARCHAR" />
    <result column="event" property="event" jdbcType="VARCHAR" />
    <result column="url" property="url" jdbcType="VARCHAR" />
    <result column="context" property="context" jdbcType="VARCHAR" />
    <result column="scene" property="scene" jdbcType="VARCHAR" />
    <result column="platform" property="platform" jdbcType="VARCHAR" />
    <result column="model" property="model" jdbcType="VARCHAR" />
    <result column="brand" property="brand" jdbcType="VARCHAR" />
    <result column="hbversion" property="hbversion" jdbcType="VARCHAR" />
    <result column="system" property="system" jdbcType="VARCHAR" />
    <result column="sdk_version" property="sdkVersion" jdbcType="VARCHAR" />
    <result column="version" property="version" jdbcType="VARCHAR" />
    <result column="system_info" property="systemInfo" jdbcType="VARCHAR" />
    <result column="stay_time" property="stayTime" jdbcType="INTEGER" />
    <result column="track_sign" property="trackSign" jdbcType="VARCHAR" />
    <result column="store_id" property="storeId" jdbcType="VARCHAR" />
    <result column="clerk_id" property="clerkId" jdbcType="VARCHAR" />
    <result column="enterprise_id" property="enterpriseId" jdbcType="VARCHAR" />
    <result column="clerk_code" property="clerkCode" jdbcType="VARCHAR" />
    <result column="store_status" property="storeStatus" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="environment" property="environment" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    maidian_id, staff_id, wx_enterprise_id, phone_number, device_date, options, event, 
    url, context, scene, platform, model, brand, hbversion, system, sdk_version, version, 
    system_info, stay_time, create_time, update_time,track_sign,store_id,store_status,clerk_code,clerk_id,enterprise_id,environment
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tab_haoban_maidian_log
    where maidian_id = #{maidianId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from tab_haoban_maidian_log
    where maidian_id = #{maidianId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaidianLog" >
    insert into tab_haoban_maidian_log (maidian_id, staff_id, wx_enterprise_id, 
      phone_number, device_date, options, 
      event, url, context, 
      scene, platform, model, 
      brand, hbversion, system, 
      sdk_version, version, system_info, 
      stay_time, create_time, update_time,track_sign,store_status,clerk_code,store_id,clerk_id,enterprise_id,environment
      )
    values (#{maidianId,jdbcType=INTEGER}, #{staffId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, 
      #{phoneNumber,jdbcType=VARCHAR}, #{deviceDate,jdbcType=TIMESTAMP}, #{options,jdbcType=VARCHAR}, 
      #{event,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{context,jdbcType=VARCHAR}, 
      #{scene,jdbcType=VARCHAR}, #{platform,jdbcType=VARCHAR}, #{model,jdbcType=VARCHAR}, 
      #{brand,jdbcType=VARCHAR}, #{hbversion,jdbcType=VARCHAR}, #{system,jdbcType=VARCHAR}, 
      #{sdkVersion,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR}, #{systemInfo,jdbcType=VARCHAR}, 
      #{stayTime,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{trackSign},
      #{storeStatus},#{clerkCode},#{storeId},#{clerkId},#{enterpriseId},#{environment}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaidianLog" >
    insert into tab_haoban_maidian_log
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="maidianId != null" >
        maidian_id,
      </if>
      <if test="staffId != null" >
        staff_id,
      </if>
      <if test="wxEnterpriseId != null" >
        wx_enterprise_id,
      </if>
      <if test="phoneNumber != null" >
        phone_number,
      </if>
      <if test="deviceDate != null" >
        device_date,
      </if>
      <if test="options != null" >
        options,
      </if>
      <if test="event != null" >
        event,
      </if>
      <if test="url != null" >
        url,
      </if>
      <if test="context != null" >
        context,
      </if>
      <if test="scene != null" >
        scene,
      </if>
      <if test="platform != null" >
        platform,
      </if>
      <if test="model != null" >
        model,
      </if>
      <if test="brand != null" >
        brand,
      </if>
      <if test="hbversion != null" >
        hbversion,
      </if>
      <if test="system != null" >
        system,
      </if>
      <if test="sdkVersion != null" >
        sdk_version,
      </if>
      <if test="version != null" >
        version,
      </if>
      <if test="systemInfo != null" >
        system_info,
      </if>
      <if test="stayTime != null" >
        stay_time,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="trackSign != null" >
        track_sign,
      </if>
      <if test="clerkId != null" >
        clerk_id,
      </if>
      <if test="enterpriseId != null" >
        enterprise_id,
      </if>
      <if test="environment != null" >
        environment,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="maidianId != null" >
        #{maidianId,jdbcType=INTEGER},
      </if>
      <if test="staffId != null" >
        #{staffId,jdbcType=VARCHAR},
      </if>
      <if test="wxEnterpriseId != null" >
        #{wxEnterpriseId,jdbcType=VARCHAR},
      </if>
      <if test="phoneNumber != null" >
        #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="deviceDate != null" >
        #{deviceDate,jdbcType=TIMESTAMP},
      </if>
      <if test="options != null" >
        #{options,jdbcType=VARCHAR},
      </if>
      <if test="event != null" >
        #{event,jdbcType=VARCHAR},
      </if>
      <if test="url != null" >
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="context != null" >
        #{context,jdbcType=VARCHAR},
      </if>
      <if test="scene != null" >
        #{scene,jdbcType=VARCHAR},
      </if>
      <if test="platform != null" >
        #{platform,jdbcType=VARCHAR},
      </if>
      <if test="model != null" >
        #{model,jdbcType=VARCHAR},
      </if>
      <if test="brand != null" >
        #{brand,jdbcType=VARCHAR},
      </if>
      <if test="hbversion != null" >
        #{hbversion,jdbcType=VARCHAR},
      </if>
      <if test="system != null" >
        #{system,jdbcType=VARCHAR},
      </if>
      <if test="sdkVersion != null" >
        #{sdkVersion,jdbcType=VARCHAR},
      </if>
      <if test="version != null" >
        #{version,jdbcType=VARCHAR},
      </if>
      <if test="systemInfo != null" >
        #{systemInfo,jdbcType=VARCHAR},
      </if>
      <if test="stayTime != null" >
        #{stayTime,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
       <if test="trackSign != null" >
        #{trackSign},
      </if>
      <if test="clerkId != null" >
        #{clerkId},
      </if>
      <if test="enterpriseId != null" >
        #{enterpriseId},
      </if>
       <if test="environment != null" >
        #{environment},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaidianLog" >
    update tab_haoban_maidian_log
    <set >
      <if test="staffId != null" >
        staff_id = #{staffId,jdbcType=VARCHAR},
      </if>
      <if test="wxEnterpriseId != null" >
        wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
      </if>
      <if test="phoneNumber != null" >
        phone_number = #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="deviceDate != null" >
        device_date = #{deviceDate,jdbcType=TIMESTAMP},
      </if>
      <if test="options != null" >
        options = #{options,jdbcType=VARCHAR},
      </if>
      <if test="event != null" >
        event = #{event,jdbcType=VARCHAR},
      </if>
      <if test="url != null" >
        url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="context != null" >
        context = #{context,jdbcType=VARCHAR},
      </if>
      <if test="scene != null" >
        scene = #{scene,jdbcType=VARCHAR},
      </if>
      <if test="platform != null" >
        platform = #{platform,jdbcType=VARCHAR},
      </if>
      <if test="model != null" >
        model = #{model,jdbcType=VARCHAR},
      </if>
      <if test="brand != null" >
        brand = #{brand,jdbcType=VARCHAR},
      </if>
      <if test="hbversion != null" >
        hbversion = #{hbversion,jdbcType=VARCHAR},
      </if>
      <if test="system != null" >
        system = #{system,jdbcType=VARCHAR},
      </if>
      <if test="sdkVersion != null" >
        sdk_version = #{sdkVersion,jdbcType=VARCHAR},
      </if>
      <if test="version != null" >
        version = #{version,jdbcType=VARCHAR},
      </if>
      <if test="systemInfo != null" >
        system_info = #{systemInfo,jdbcType=VARCHAR},
      </if>
      <if test="stayTime != null" >
        stay_time = #{stayTime,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where maidian_id = #{maidianId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabHaobanMaidianLog" >
    update tab_haoban_maidian_log
    set staff_id = #{staffId,jdbcType=VARCHAR},
      wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
      phone_number = #{phoneNumber,jdbcType=VARCHAR},
      device_date = #{deviceDate,jdbcType=TIMESTAMP},
      options = #{options,jdbcType=VARCHAR},
      event = #{event,jdbcType=VARCHAR},
      url = #{url,jdbcType=VARCHAR},
      context = #{context,jdbcType=VARCHAR},
      scene = #{scene,jdbcType=VARCHAR},
      platform = #{platform,jdbcType=VARCHAR},
      model = #{model,jdbcType=VARCHAR},
      brand = #{brand,jdbcType=VARCHAR},
      hbversion = #{hbversion,jdbcType=VARCHAR},
      system = #{system,jdbcType=VARCHAR},
      sdk_version = #{sdkVersion,jdbcType=VARCHAR},
      version = #{version,jdbcType=VARCHAR},
      system_info = #{systemInfo,jdbcType=VARCHAR},
      stay_time = #{stayTime,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where maidian_id = #{maidianId,jdbcType=INTEGER}
  </update>


  <select id="queryList" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from tab_haoban_maidian_log
    where hbversion = #{hbversion}
    and event ='onError' and platform!='devtools'  group by options order by device_date desc
  </select>
</mapper>