<?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>
  <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>

  <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>