<?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.AclPractitionerFileSharingMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.customer.AclPractitionerFileSharing">
    <!--@mbg.generated-->
    <!--@Table ag_acl_practitioner_file_sharing-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="md_drop_option_id" jdbcType="VARCHAR" property="mdDropOptionId" />
    <result column="file_content" jdbcType="LONGVARCHAR" property="fileContent" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <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" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="digest" jdbcType="VARCHAR" property="digest" />
    <result column="author" jdbcType="VARCHAR" property="author" />
    <result column="cover_url" jdbcType="VARCHAR" property="coverUrl" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, md_drop_option_id, file_content, is_active, created_at, created_by, updated_at, 
    updated_by, title, digest, author, cover_url
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select 
    <include refid="Base_Column_List" />
    from ag_acl_practitioner_file_sharing
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--@mbg.generated-->
    delete from ag_acl_practitioner_file_sharing
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerFileSharing" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_file_sharing (md_drop_option_id, file_content, 
      is_active, created_at, created_by, 
      updated_at, updated_by, title, 
      digest, author, cover_url
      )
    values (#{mdDropOptionId,jdbcType=VARCHAR}, #{fileContent,jdbcType=LONGVARCHAR}, 
      #{isActive,jdbcType=INTEGER}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, 
      #{updatedAt,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, 
      #{digest,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, #{coverUrl,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.customer.AclPractitionerFileSharing" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_file_sharing
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mdDropOptionId != null">
        md_drop_option_id,
      </if>
      <if test="fileContent != null">
        file_content,
      </if>
      <if test="isActive != null">
        is_active,
      </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>
      <if test="title != null">
        title,
      </if>
      <if test="digest != null">
        digest,
      </if>
      <if test="author != null">
        author,
      </if>
      <if test="coverUrl != null">
        cover_url,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mdDropOptionId != null">
        #{mdDropOptionId,jdbcType=VARCHAR},
      </if>
      <if test="fileContent != null">
        #{fileContent,jdbcType=LONGVARCHAR},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </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>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="digest != null">
        #{digest,jdbcType=VARCHAR},
      </if>
      <if test="author != null">
        #{author,jdbcType=VARCHAR},
      </if>
      <if test="coverUrl != null">
        #{coverUrl,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.customer.AclPractitionerFileSharing">
    <!--@mbg.generated-->
    update ag_acl_practitioner_file_sharing
    <set>
      <if test="mdDropOptionId != null">
        md_drop_option_id = #{mdDropOptionId,jdbcType=VARCHAR},
      </if>
      <if test="fileContent != null">
        file_content = #{fileContent,jdbcType=LONGVARCHAR},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </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>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="digest != null">
        digest = #{digest,jdbcType=VARCHAR},
      </if>
      <if test="author != null">
        author = #{author,jdbcType=VARCHAR},
      </if>
      <if test="coverUrl != null">
        cover_url = #{coverUrl,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.customer.AclPractitionerFileSharing">
    <!--@mbg.generated-->
    update ag_acl_practitioner_file_sharing
    set md_drop_option_id = #{mdDropOptionId,jdbcType=VARCHAR},
      file_content = #{fileContent,jdbcType=LONGVARCHAR},
      is_active = #{isActive,jdbcType=INTEGER},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      updated_by = #{updatedBy,jdbcType=BIGINT},
      title = #{title,jdbcType=VARCHAR},
      digest = #{digest,jdbcType=VARCHAR},
      author = #{author,jdbcType=VARCHAR},
      cover_url = #{coverUrl,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_practitioner_file_sharing
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="md_drop_option_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.mdDropOptionId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="file_content = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.fileContent,jdbcType=LONGVARCHAR}
        </foreach>
      </trim>
      <trim prefix="is_active = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.isActive,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="updated_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
        </foreach>
      </trim>
      <trim prefix="updated_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
        </foreach>
      </trim>
      <trim prefix="title = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.title,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="digest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.digest,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="author = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.author,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="cover_url = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.coverUrl,jdbcType=VARCHAR}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update ag_acl_practitioner_file_sharing
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="md_drop_option_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.mdDropOptionId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.mdDropOptionId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="file_content = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.fileContent != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.fileContent,jdbcType=LONGVARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="is_active = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.isActive != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.isActive,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdAt != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdAt,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="created_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.createdBy != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.createdBy,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="updated_at = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.updatedAt != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.updatedAt,jdbcType=TIMESTAMP}
          </if>
        </foreach>
      </trim>
      <trim prefix="updated_by = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.updatedBy != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.updatedBy,jdbcType=BIGINT}
          </if>
        </foreach>
      </trim>
      <trim prefix="title = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.title != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.title,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="digest = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.digest != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.digest,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="author = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.author != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.author,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="cover_url = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.coverUrl != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.coverUrl,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ag_acl_practitioner_file_sharing
    (md_drop_option_id, file_content, is_active, created_at, created_by, updated_at, 
      updated_by, title, digest, author, cover_url)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.mdDropOptionId,jdbcType=VARCHAR}, #{item.fileContent,jdbcType=LONGVARCHAR}, 
        #{item.isActive,jdbcType=INTEGER}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=BIGINT}, 
        #{item.updatedAt,jdbcType=TIMESTAMP}, #{item.updatedBy,jdbcType=BIGINT}, #{item.title,jdbcType=VARCHAR}, 
        #{item.digest,jdbcType=VARCHAR}, #{item.author,jdbcType=VARCHAR}, #{item.coverUrl,jdbcType=VARCHAR}
        )
    </foreach>
  </insert>
</mapper>