<?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.AclCustomerObjectShareMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclCustomerObjectShare">
    <!--@mbg.generated-->
    <!--@Table ag_acl_customer_object_share-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="item_type" jdbcType="INTEGER" property="itemType" />
    <result column="item_id" jdbcType="BIGINT" property="itemId" />
    <result column="practitioner_id" jdbcType="BIGINT" property="practitionerId" />
    <result column="share_code" jdbcType="VARCHAR" property="shareCode" />
    <result column="customer_id" jdbcType="BIGINT" property="customerId" />
    <result column="os" jdbcType="INTEGER" property="os" />
    <result column="channel" jdbcType="INTEGER" property="channel" />
    <result column="url" jdbcType="LONGVARCHAR" property="url" />
    <result column="json_params" jdbcType="LONGVARCHAR" property="jsonParams" />
    <result column="json_params_coverage_info" jdbcType="LONGVARCHAR" property="jsonParamsCoverageInfo" />
    <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">
    <!--@mbg.generated-->
    id, item_type, item_id, practitioner_id, share_code, customer_id, os, channel, url, 
    json_params, json_params_coverage_info, created_at, created_by, updated_at, updated_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ag_acl_customer_object_share
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ag_acl_customer_object_share
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclCustomerObjectShare" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer_object_share (item_type, item_id, practitioner_id, 
      share_code, customer_id, os, 
      channel, url, json_params, 
      json_params_coverage_info, created_at, 
      created_by, updated_at, updated_by
      )
    values (#{itemType,jdbcType=INTEGER}, #{itemId,jdbcType=BIGINT}, #{practitionerId,jdbcType=BIGINT}, 
      #{shareCode,jdbcType=VARCHAR}, #{customerId,jdbcType=BIGINT}, #{os,jdbcType=INTEGER}, 
      #{channel,jdbcType=INTEGER}, #{url,jdbcType=LONGVARCHAR}, #{jsonParams,jdbcType=LONGVARCHAR}, 
      #{jsonParamsCoverageInfo,jdbcType=LONGVARCHAR}, #{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.AclCustomerObjectShare" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_customer_object_share
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="itemType != null">
        item_type,
      </if>
      <if test="itemId != null">
        item_id,
      </if>
      <if test="practitionerId != null">
        practitioner_id,
      </if>
      <if test="shareCode != null">
        share_code,
      </if>
      <if test="customerId != null">
        customer_id,
      </if>
      <if test="os != null">
        os,
      </if>
      <if test="channel != null">
        channel,
      </if>
      <if test="url != null">
        url,
      </if>
      <if test="jsonParams != null">
        json_params,
      </if>
      <if test="jsonParamsCoverageInfo != null">
        json_params_coverage_info,
      </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="itemType != null">
        #{itemType,jdbcType=INTEGER},
      </if>
      <if test="itemId != null">
        #{itemId,jdbcType=BIGINT},
      </if>
      <if test="practitionerId != null">
        #{practitionerId,jdbcType=BIGINT},
      </if>
      <if test="shareCode != null">
        #{shareCode,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null">
        #{customerId,jdbcType=BIGINT},
      </if>
      <if test="os != null">
        #{os,jdbcType=INTEGER},
      </if>
      <if test="channel != null">
        #{channel,jdbcType=INTEGER},
      </if>
      <if test="url != null">
        #{url,jdbcType=LONGVARCHAR},
      </if>
      <if test="jsonParams != null">
        #{jsonParams,jdbcType=LONGVARCHAR},
      </if>
      <if test="jsonParamsCoverageInfo != null">
        #{jsonParamsCoverageInfo,jdbcType=LONGVARCHAR},
      </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.AclCustomerObjectShare">
    <!--@mbg.generated-->
    update ag_acl_customer_object_share
    <set>
      <if test="itemType != null">
        item_type = #{itemType,jdbcType=INTEGER},
      </if>
      <if test="itemId != null">
        item_id = #{itemId,jdbcType=BIGINT},
      </if>
      <if test="practitionerId != null">
        practitioner_id = #{practitionerId,jdbcType=BIGINT},
      </if>
      <if test="shareCode != null">
        share_code = #{shareCode,jdbcType=VARCHAR},
      </if>
      <if test="customerId != null">
        customer_id = #{customerId,jdbcType=BIGINT},
      </if>
      <if test="os != null">
        os = #{os,jdbcType=INTEGER},
      </if>
      <if test="channel != null">
        channel = #{channel,jdbcType=INTEGER},
      </if>
      <if test="url != null">
        url = #{url,jdbcType=LONGVARCHAR},
      </if>
      <if test="jsonParams != null">
        json_params = #{jsonParams,jdbcType=LONGVARCHAR},
      </if>
      <if test="jsonParamsCoverageInfo != null">
        json_params_coverage_info = #{jsonParamsCoverageInfo,jdbcType=LONGVARCHAR},
      </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.AclCustomerObjectShare">
    <!--@mbg.generated-->
    update ag_acl_customer_object_share
    set item_type = #{itemType,jdbcType=INTEGER},
      item_id = #{itemId,jdbcType=BIGINT},
      practitioner_id = #{practitionerId,jdbcType=BIGINT},
      share_code = #{shareCode,jdbcType=VARCHAR},
      customer_id = #{customerId,jdbcType=BIGINT},
      os = #{os,jdbcType=INTEGER},
      channel = #{channel,jdbcType=INTEGER},
      url = #{url,jdbcType=LONGVARCHAR},
      json_params = #{jsonParams,jdbcType=LONGVARCHAR},
      json_params_coverage_info = #{jsonParamsCoverageInfo,jdbcType=LONGVARCHAR},
      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="findIdByShareCode" resultType="java.lang.Long">
      select
        id
      from ag_acl_customer_object_share
      where share_code = #{shareCode,jdbcType=VARCHAR}
    </select>
</mapper>