<?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="io.dataease.base.mapper.PanelShareMapper">
  <resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelShare">
    <id column="share_id" jdbcType="BIGINT" property="shareId" />
    <result column="panel_group_id" jdbcType="VARCHAR" property="panelGroupId" />
    <result column="target_id" jdbcType="BIGINT" property="targetId" />
    <result column="create_time" jdbcType="BIGINT" property="createTime" />
    <result column="type" jdbcType="INTEGER" property="type" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    share_id, panel_group_id, target_id, create_time, `type`
  </sql>
  <select id="selectByExample" parameterType="io.dataease.base.domain.PanelShareExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from panel_share
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from panel_share
    where share_id = #{shareId,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from panel_share
    where share_id = #{shareId,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="io.dataease.base.domain.PanelShareExample">
    delete from panel_share
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="io.dataease.base.domain.PanelShare">
    insert into panel_share (share_id, panel_group_id, target_id, 
      create_time, `type`)
    values (#{shareId,jdbcType=BIGINT}, #{panelGroupId,jdbcType=VARCHAR}, #{targetId,jdbcType=BIGINT}, 
      #{createTime,jdbcType=BIGINT}, #{type,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="io.dataease.base.domain.PanelShare">
    insert into panel_share
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="shareId != null">
        share_id,
      </if>
      <if test="panelGroupId != null">
        panel_group_id,
      </if>
      <if test="targetId != null">
        target_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="type != null">
        `type`,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="shareId != null">
        #{shareId,jdbcType=BIGINT},
      </if>
      <if test="panelGroupId != null">
        #{panelGroupId,jdbcType=VARCHAR},
      </if>
      <if test="targetId != null">
        #{targetId,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="io.dataease.base.domain.PanelShareExample" resultType="java.lang.Long">
    select count(*) from panel_share
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update panel_share
    <set>
      <if test="record.shareId != null">
        share_id = #{record.shareId,jdbcType=BIGINT},
      </if>
      <if test="record.panelGroupId != null">
        panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR},
      </if>
      <if test="record.targetId != null">
        target_id = #{record.targetId,jdbcType=BIGINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=BIGINT},
      </if>
      <if test="record.type != null">
        `type` = #{record.type,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update panel_share
    set share_id = #{record.shareId,jdbcType=BIGINT},
      panel_group_id = #{record.panelGroupId,jdbcType=VARCHAR},
      target_id = #{record.targetId,jdbcType=BIGINT},
      create_time = #{record.createTime,jdbcType=BIGINT},
      `type` = #{record.type,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.PanelShare">
    update panel_share
    <set>
      <if test="panelGroupId != null">
        panel_group_id = #{panelGroupId,jdbcType=VARCHAR},
      </if>
      <if test="targetId != null">
        target_id = #{targetId,jdbcType=BIGINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=BIGINT},
      </if>
      <if test="type != null">
        `type` = #{type,jdbcType=INTEGER},
      </if>
    </set>
    where share_id = #{shareId,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelShare">
    update panel_share
    set panel_group_id = #{panelGroupId,jdbcType=VARCHAR},
      target_id = #{targetId,jdbcType=BIGINT},
      create_time = #{createTime,jdbcType=BIGINT},
      `type` = #{type,jdbcType=INTEGER}
    where share_id = #{shareId,jdbcType=BIGINT}
  </update>
</mapper>