<?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.lightinit.hsdataplatform.mapper.DataCatelogItemMapper">
  <resultMap id="BaseResultMap" type="com.lightinit.hsdataplatform.entity.DataCatelogItem">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="data_catelog_id" jdbcType="BIGINT" property="dataCatelogId" />
    <result column="item_name" jdbcType="VARCHAR" property="itemName" />
    <result column="item_type" jdbcType="VARCHAR" property="itemType" />
    <result column="item_length" jdbcType="VARCHAR" property="itemLength" />
    <result column="share_type" jdbcType="VARCHAR" property="shareType" />
    <result column="share_condition" jdbcType="VARCHAR" property="shareCondition" />
    <result column="share_method_category" jdbcType="VARCHAR" property="shareMethodCategory" />
    <result column="share_method_type" jdbcType="VARCHAR" property="shareMethodType" />
    <result column="is_open" jdbcType="TINYINT" property="isOpen" />
    <result column="open_condition" jdbcType="VARCHAR" property="openCondition" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="BIGINT" property="createdBy" />
    <result column="deleted_at" jdbcType="TIMESTAMP" property="deletedAt" />
    <result column="deleted_by" jdbcType="BIGINT" property="deletedBy" />
  </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">
    id, data_catelog_id, item_name, item_type, item_length, share_type, share_condition, 
    share_method_category, share_method_type, is_open, open_condition, created_at, created_by, 
    deleted_at, deleted_by
  </sql>
  <select id="selectByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItemExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from data_catelog_item
    <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 data_catelog_item
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from data_catelog_item
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItemExample">
    delete from data_catelog_item
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItem">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into data_catelog_item (data_catelog_id, item_name, item_type, 
      item_length, share_type, share_condition, 
      share_method_category, share_method_type, is_open, 
      open_condition, created_at, created_by, 
      deleted_at, deleted_by)
    values (#{dataCatelogId,jdbcType=BIGINT}, #{itemName,jdbcType=VARCHAR}, #{itemType,jdbcType=VARCHAR}, 
      #{itemLength,jdbcType=VARCHAR}, #{shareType,jdbcType=VARCHAR}, #{shareCondition,jdbcType=VARCHAR}, 
      #{shareMethodCategory,jdbcType=VARCHAR}, #{shareMethodType,jdbcType=VARCHAR}, #{isOpen,jdbcType=TINYINT}, 
      #{openCondition,jdbcType=VARCHAR}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=BIGINT}, 
      #{deletedAt,jdbcType=TIMESTAMP}, #{deletedBy,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItem">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into data_catelog_item
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dataCatelogId != null">
        data_catelog_id,
      </if>
      <if test="itemName != null">
        item_name,
      </if>
      <if test="itemType != null">
        item_type,
      </if>
      <if test="itemLength != null">
        item_length,
      </if>
      <if test="shareType != null">
        share_type,
      </if>
      <if test="shareCondition != null">
        share_condition,
      </if>
      <if test="shareMethodCategory != null">
        share_method_category,
      </if>
      <if test="shareMethodType != null">
        share_method_type,
      </if>
      <if test="isOpen != null">
        is_open,
      </if>
      <if test="openCondition != null">
        open_condition,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="deletedAt != null">
        deleted_at,
      </if>
      <if test="deletedBy != null">
        deleted_by,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dataCatelogId != null">
        #{dataCatelogId,jdbcType=BIGINT},
      </if>
      <if test="itemName != null">
        #{itemName,jdbcType=VARCHAR},
      </if>
      <if test="itemType != null">
        #{itemType,jdbcType=VARCHAR},
      </if>
      <if test="itemLength != null">
        #{itemLength,jdbcType=VARCHAR},
      </if>
      <if test="shareType != null">
        #{shareType,jdbcType=VARCHAR},
      </if>
      <if test="shareCondition != null">
        #{shareCondition,jdbcType=VARCHAR},
      </if>
      <if test="shareMethodCategory != null">
        #{shareMethodCategory,jdbcType=VARCHAR},
      </if>
      <if test="shareMethodType != null">
        #{shareMethodType,jdbcType=VARCHAR},
      </if>
      <if test="isOpen != null">
        #{isOpen,jdbcType=TINYINT},
      </if>
      <if test="openCondition != null">
        #{openCondition,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        #{deletedBy,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItemExample" resultType="java.lang.Long">
    select count(*) from data_catelog_item
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update data_catelog_item
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.dataCatelogId != null">
        data_catelog_id = #{record.dataCatelogId,jdbcType=BIGINT},
      </if>
      <if test="record.itemName != null">
        item_name = #{record.itemName,jdbcType=VARCHAR},
      </if>
      <if test="record.itemType != null">
        item_type = #{record.itemType,jdbcType=VARCHAR},
      </if>
      <if test="record.itemLength != null">
        item_length = #{record.itemLength,jdbcType=VARCHAR},
      </if>
      <if test="record.shareType != null">
        share_type = #{record.shareType,jdbcType=VARCHAR},
      </if>
      <if test="record.shareCondition != null">
        share_condition = #{record.shareCondition,jdbcType=VARCHAR},
      </if>
      <if test="record.shareMethodCategory != null">
        share_method_category = #{record.shareMethodCategory,jdbcType=VARCHAR},
      </if>
      <if test="record.shareMethodType != null">
        share_method_type = #{record.shareMethodType,jdbcType=VARCHAR},
      </if>
      <if test="record.isOpen != null">
        is_open = #{record.isOpen,jdbcType=TINYINT},
      </if>
      <if test="record.openCondition != null">
        open_condition = #{record.openCondition,jdbcType=VARCHAR},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=BIGINT},
      </if>
      <if test="record.deletedAt != null">
        deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.deletedBy != null">
        deleted_by = #{record.deletedBy,jdbcType=BIGINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update data_catelog_item
    set id = #{record.id,jdbcType=BIGINT},
      data_catelog_id = #{record.dataCatelogId,jdbcType=BIGINT},
      item_name = #{record.itemName,jdbcType=VARCHAR},
      item_type = #{record.itemType,jdbcType=VARCHAR},
      item_length = #{record.itemLength,jdbcType=VARCHAR},
      share_type = #{record.shareType,jdbcType=VARCHAR},
      share_condition = #{record.shareCondition,jdbcType=VARCHAR},
      share_method_category = #{record.shareMethodCategory,jdbcType=VARCHAR},
      share_method_type = #{record.shareMethodType,jdbcType=VARCHAR},
      is_open = #{record.isOpen,jdbcType=TINYINT},
      open_condition = #{record.openCondition,jdbcType=VARCHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=BIGINT},
      deleted_at = #{record.deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{record.deletedBy,jdbcType=BIGINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItem">
    update data_catelog_item
    <set>
      <if test="dataCatelogId != null">
        data_catelog_id = #{dataCatelogId,jdbcType=BIGINT},
      </if>
      <if test="itemName != null">
        item_name = #{itemName,jdbcType=VARCHAR},
      </if>
      <if test="itemType != null">
        item_type = #{itemType,jdbcType=VARCHAR},
      </if>
      <if test="itemLength != null">
        item_length = #{itemLength,jdbcType=VARCHAR},
      </if>
      <if test="shareType != null">
        share_type = #{shareType,jdbcType=VARCHAR},
      </if>
      <if test="shareCondition != null">
        share_condition = #{shareCondition,jdbcType=VARCHAR},
      </if>
      <if test="shareMethodCategory != null">
        share_method_category = #{shareMethodCategory,jdbcType=VARCHAR},
      </if>
      <if test="shareMethodType != null">
        share_method_type = #{shareMethodType,jdbcType=VARCHAR},
      </if>
      <if test="isOpen != null">
        is_open = #{isOpen,jdbcType=TINYINT},
      </if>
      <if test="openCondition != null">
        open_condition = #{openCondition,jdbcType=VARCHAR},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=BIGINT},
      </if>
      <if test="deletedAt != null">
        deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      </if>
      <if test="deletedBy != null">
        deleted_by = #{deletedBy,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.lightinit.hsdataplatform.entity.DataCatelogItem">
    update data_catelog_item
    set data_catelog_id = #{dataCatelogId,jdbcType=BIGINT},
      item_name = #{itemName,jdbcType=VARCHAR},
      item_type = #{itemType,jdbcType=VARCHAR},
      item_length = #{itemLength,jdbcType=VARCHAR},
      share_type = #{shareType,jdbcType=VARCHAR},
      share_condition = #{shareCondition,jdbcType=VARCHAR},
      share_method_category = #{shareMethodCategory,jdbcType=VARCHAR},
      share_method_type = #{shareMethodType,jdbcType=VARCHAR},
      is_open = #{isOpen,jdbcType=TINYINT},
      open_condition = #{openCondition,jdbcType=VARCHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=BIGINT},
      deleted_at = #{deletedAt,jdbcType=TIMESTAMP},
      deleted_by = #{deletedBy,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="getDataCatelogItemIds" parameterType="java.lang.Long" resultType="java.lang.Long">
    SELECT dci.id FROM data_catelog_item dci WHERE dci.data_catelog_id=#{id}
  </select>
</mapper>