<?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.meta.ObjectCollectionTaggedMapper">
  <resultMap id="BaseResultMap" type="com.yd.dal.entity.meta.ObjectCollectionTagged">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="md_tag_id" jdbcType="INTEGER" property="mdTagId" />
    <result column="tagged_object_type" jdbcType="INTEGER" property="taggedObjectType" />
    <result column="tagged_object_id" jdbcType="BIGINT" property="taggedObjectId" />
    <result column="is_active" jdbcType="INTEGER" property="isActive" />
    <result column="recommend_order" jdbcType="INTEGER" property="recommendOrder" />
    <result column="display_order" jdbcType="INTEGER" property="displayOrder" />
    <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">
    id, md_tag_id, tagged_object_type, tagged_object_id, is_active, recommend_order, 
    display_order, created_at, created_by, updated_at, updated_by
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from ag_object_collection_tagged
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from ag_object_collection_tagged
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yd.dal.entity.meta.ObjectCollectionTagged" useGeneratedKeys="true">
    insert into ag_object_collection_tagged (md_tag_id, tagged_object_type, tagged_object_id, 
      is_active, recommend_order, display_order, 
      created_at, created_by, updated_at, 
      updated_by)
    values (#{mdTagId,jdbcType=INTEGER}, #{taggedObjectType,jdbcType=INTEGER}, #{taggedObjectId,jdbcType=BIGINT}, 
      #{isActive,jdbcType=INTEGER}, #{recommendOrder,jdbcType=INTEGER}, #{displayOrder,jdbcType=INTEGER}, 
      #{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.meta.ObjectCollectionTagged" useGeneratedKeys="true">
    insert into ag_object_collection_tagged
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mdTagId != null">
        md_tag_id,
      </if>
      <if test="taggedObjectType != null">
        tagged_object_type,
      </if>
      <if test="taggedObjectId != null">
        tagged_object_id,
      </if>
      <if test="isActive != null">
        is_active,
      </if>
      <if test="recommendOrder != null">
        recommend_order,
      </if>
      <if test="displayOrder != null">
        display_order,
      </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="mdTagId != null">
        #{mdTagId,jdbcType=INTEGER},
      </if>
      <if test="taggedObjectType != null">
        #{taggedObjectType,jdbcType=INTEGER},
      </if>
      <if test="taggedObjectId != null">
        #{taggedObjectId,jdbcType=BIGINT},
      </if>
      <if test="isActive != null">
        #{isActive,jdbcType=INTEGER},
      </if>
      <if test="recommendOrder != null">
        #{recommendOrder,jdbcType=INTEGER},
      </if>
      <if test="displayOrder != null">
        #{displayOrder,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>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.yd.dal.entity.meta.ObjectCollectionTagged">
    update ag_object_collection_tagged
    <set>
      <if test="mdTagId != null">
        md_tag_id = #{mdTagId,jdbcType=INTEGER},
      </if>
      <if test="taggedObjectType != null">
        tagged_object_type = #{taggedObjectType,jdbcType=INTEGER},
      </if>
      <if test="taggedObjectId != null">
        tagged_object_id = #{taggedObjectId,jdbcType=BIGINT},
      </if>
      <if test="isActive != null">
        is_active = #{isActive,jdbcType=INTEGER},
      </if>
      <if test="recommendOrder != null">
        recommend_order = #{recommendOrder,jdbcType=INTEGER},
      </if>
      <if test="displayOrder != null">
        display_order = #{displayOrder,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>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.yd.dal.entity.meta.ObjectCollectionTagged">
    update ag_object_collection_tagged
    set md_tag_id = #{mdTagId,jdbcType=INTEGER},
      tagged_object_type = #{taggedObjectType,jdbcType=INTEGER},
      tagged_object_id = #{taggedObjectId,jdbcType=BIGINT},
      is_active = #{isActive,jdbcType=INTEGER},
      recommend_order = #{recommendOrder,jdbcType=INTEGER},
      display_order = #{displayOrder,jdbcType=INTEGER},
      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="findByObjectCollectionTagged" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from ag_object_collection_tagged
      <where>
        <if test="id != null">
          id = #{id}
        </if>
        <if test="mdTagId != null">
          and md_tag_id = #{mdTagId,jdbcType=INTEGER}
        </if>
        <if test="taggedObjectType != null">
          and tagged_object_type = #{taggedObjectType,jdbcType=INTEGER}
        </if>
        <if test="taggedObjectId != null">
          and tagged_object_id = #{taggedObjectId,jdbcType=BIGINT}
        </if>
        <if test="isActive != null">
          and is_active = #{isActive,jdbcType=INTEGER}
        </if>
        <if test="recommendOrder != null">
          and recommend_order = #{recommendOrder,jdbcType=INTEGER}
        </if>
        <if test="displayOrder != null">
          and display_order = #{displayOrder,jdbcType=INTEGER}
        </if>
        <if test="createdAt != null">
          and  created_at = #{createdAt,jdbcType=TIMESTAMP}
        </if>
        <if test="createdBy != null">
          and created_by = #{createdBy,jdbcType=BIGINT}
        </if>
        <if test="updatedAt != null">
          and updated_at = #{updatedAt,jdbcType=TIMESTAMP}
        </if>
        <if test="updatedBy != null">
          and updated_by = #{updatedBy,jdbcType=BIGINT}
        </if>
      </where>
    </select>
</mapper>