<?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.fdage.dao.base.TbResourceMapper">
  <resultMap id="BaseResultMap" type="com.fdage.pojo.TbResource">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="resource_type" jdbcType="VARCHAR" property="resourceType" />
    <result column="resource_key" jdbcType="VARCHAR" property="resourceKey" />
    <result column="parent_id" jdbcType="INTEGER" property="parentId" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="rec_status" jdbcType="VARCHAR" property="recStatus" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, name, url, resource_type, resource_key, description, parent_id, sort, rec_status, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from tb_resource
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from tb_resource
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.fdage.pojo.TbResource" useGeneratedKeys="true" keyProperty="id">
    insert into tb_resource (id, name, url, resource_type, resource_key, description, parent_id,
     sort, rec_status, create_time, update_time)
    values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, 
      #{resourceType,jdbcType=VARCHAR}, #{resourceKey,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, 
      #{sort,jdbcType=INTEGER}, #{recStatus,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}), #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.fdage.pojo.TbResource" useGeneratedKeys="true" keyProperty="id">
    insert into tb_resource
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="url != null">
        url,
      </if>
      <if test="resourceType != null">
        resource_type,
      </if>
      <if test="resourceKey != null">
        resource_key,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="recStatus != null">
        rec_status,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        #{url,jdbcType=VARCHAR},
      </if>
      <if test="resourceType != null">
        #{resourceType,jdbcType=INTEGER},
      </if>
      <if test="resourceKey != null">
        #{resourceKey,jdbcType=TIMESTAMP},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="recStatus != null">
        #{recStatus,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.fdage.pojo.TbResource">
    update tb_resource
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="url != null">
        url = #{url,jdbcType=VARCHAR},
      </if>
      <if test="resourceType != null">
        resource_type = #{resourceType,jdbcType=INTEGER},
      </if>
      <if test="resourceKey != null">
        resource_key = #{resourceKey,jdbcType=TIMESTAMP},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="recStatus != null">
        rec_status = #{recStatus,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fdage.pojo.TbResource">
    update tb_resource
    set 
      name = #{name,jdbcType=VARCHAR},
      url = #{url,jdbcType=VARCHAR},
      resource_type = #{resourceType,jdbcType=INTEGER},
      resource_key = #{resourceKey,jdbcType=TIMESTAMP},
      description = #{description,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      sort = #{sort,jdbcType=INTEGER},
      rec_status = #{recStatus,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>