<?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.community.huiju.dao.TpEquipmentTreeMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpEquipmentTree" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="community_id" property="communityId" jdbcType="INTEGER" />
    <result column="equipment_name" property="equipmentName" jdbcType="VARCHAR" />
    <result column="pid" property="pid" jdbcType="INTEGER" />
    <result column="sort" property="sort" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_user" property="createUser" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, community_id, equipment_name, pid, sort, create_time, create_user, update_time, 
    update_user
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tp_equipment_tree
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from tp_equipment_tree
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.TpEquipmentTree" >
    insert into tp_equipment_tree (id, community_id, equipment_name, 
      pid, sort, create_time, 
      create_user, update_time, update_user
      )
    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{equipmentName,jdbcType=VARCHAR}, 
      #{pid,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
    insert into tp_equipment_tree
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="communityId != null" >
        community_id,
      </if>
      <if test="equipmentName != null" >
        equipment_name,
      </if>
      <if test="pid != null" >
        pid,
      </if>
      <if test="sort != null" >
        sort,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createUser != null" >
        create_user,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
      <if test="updateUser != null" >
        update_user,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="communityId != null" >
        #{communityId,jdbcType=INTEGER},
      </if>
      <if test="equipmentName != null" >
        #{equipmentName,jdbcType=VARCHAR},
      </if>
      <if test="pid != null" >
        #{pid,jdbcType=INTEGER},
      </if>
      <if test="sort != null" >
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null" >
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUser != null" >
        #{updateUser,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
    update tp_equipment_tree
    <set >
      <if test="communityId != null" >
        community_id = #{communityId,jdbcType=INTEGER},
      </if>
      <if test="equipmentName != null" >
        equipment_name = #{equipmentName,jdbcType=VARCHAR},
      </if>
      <if test="pid != null" >
        pid = #{pid,jdbcType=INTEGER},
      </if>
      <if test="sort != null" >
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null" >
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUser != null" >
        update_user = #{updateUser,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpEquipmentTree" >
    update tp_equipment_tree
    set community_id = #{communityId,jdbcType=INTEGER},
      equipment_name = #{equipmentName,jdbcType=VARCHAR},
      pid = #{pid,jdbcType=INTEGER},
      sort = #{sort,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user = #{createUser,jdbcType=INTEGER},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user = #{updateUser,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>