<?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.SysNationMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.SysNation" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="code" property="code" jdbcType="VARCHAR" />
    <result column="province" property="province" jdbcType="VARCHAR" />
    <result column="city" property="city" jdbcType="VARCHAR" />
    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="district" property="district" jdbcType="VARCHAR" />
    <result column="last_update_time" property="lastUpdateTime" jdbcType="TIMESTAMP" />
    <result column="operator" property="operator" jdbcType="INTEGER" />
    <result column="operator_ip" property="operatorIp" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, code, province, city, parent_id, create_time, district, last_update_time, operator, 
    operator_ip
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from sys_nation
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from sys_nation
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.SysNation" >
    insert into sys_nation (id, code, province, 
      city, parent_id, create_time, 
      district, last_update_time, operator, 
      operator_ip)
    values (#{id,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, #{province,jdbcType=VARCHAR}, 
      #{city,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{district,jdbcType=VARCHAR}, #{lastUpdateTime,jdbcType=TIMESTAMP}, #{operator,jdbcType=INTEGER}, 
      #{operatorIp,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.SysNation" >
    insert into sys_nation
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="code != null" >
        code,
      </if>
      <if test="province != null" >
        province,
      </if>
      <if test="city != null" >
        city,
      </if>
      <if test="parentId != null" >
        parent_id,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="district != null" >
        district,
      </if>
      <if test="lastUpdateTime != null" >
        last_update_time,
      </if>
      <if test="operator != null" >
        operator,
      </if>
      <if test="operatorIp != null" >
        operator_ip,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="code != null" >
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="province != null" >
        #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null" >
        #{city,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null" >
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="district != null" >
        #{district,jdbcType=VARCHAR},
      </if>
      <if test="lastUpdateTime != null" >
        #{lastUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null" >
        #{operator,jdbcType=INTEGER},
      </if>
      <if test="operatorIp != null" >
        #{operatorIp,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.SysNation" >
    update sys_nation
    <set >
      <if test="code != null" >
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="province != null" >
        province = #{province,jdbcType=VARCHAR},
      </if>
      <if test="city != null" >
        city = #{city,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null" >
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="district != null" >
        district = #{district,jdbcType=VARCHAR},
      </if>
      <if test="lastUpdateTime != null" >
        last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="operator != null" >
        operator = #{operator,jdbcType=INTEGER},
      </if>
      <if test="operatorIp != null" >
        operator_ip = #{operatorIp,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.SysNation" >
    update sys_nation
    set code = #{code,jdbcType=VARCHAR},
      province = #{province,jdbcType=VARCHAR},
      city = #{city,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      district = #{district,jdbcType=VARCHAR},
      last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP},
      operator = #{operator,jdbcType=INTEGER},
      operator_ip = #{operatorIp,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>