<?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.boco.nbd.wios.manage.mapper.extdb.WarehouseMapper" >
  <resultMap id="BaseResultMap" type="com.boco.nbd.wios.manage.entity.bo.Warehouse" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="warehouse_leven_id" property="warehouseLevenId" jdbcType="VARCHAR" />
    <result column="name" property="name" jdbcType="VARCHAR" />
    <result column="area" property="area" jdbcType="VARCHAR" />
    <result column="service_provider" property="serviceProvider" jdbcType="VARCHAR" />
    <result column="warehouse_attribution" property="warehouseAttribution" jdbcType="VARCHAR" />
    <result column="msg" property="msg" jdbcType="VARCHAR" />
    <result column="status" property="status" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="create_account" property="createAccount" jdbcType="VARCHAR" />
    <result column="modify_account" property="modifyAccount" jdbcType="VARCHAR" />
    <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
    <result column="appkey" property="appkey" jdbcType="VARCHAR" />
    <result column="is_enabled" property="isEnabled" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    id, warehouse_leven_id, name, area, service_provider, warehouse_attribution, msg, 
    status, create_time, create_account, modify_account, modify_time, appkey, is_enabled
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.boco.nbd.wios.manage.entity.bo.WarehouseCriteria" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_warehouse
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from t_warehouse
    where id = #{id,jdbcType=VARCHAR}
  </select>

  <select id="selectBySuperiorWarehouseId" parameterType="java.lang.String" resultType="int">
    select count(id) from t_warehouse where superior_warehouse_id = #{id,jdbcType=VARCHAR} and status = 1
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_warehouse
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.WarehouseCriteria" >
    delete from t_warehouse
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.boco.nbd.wios.manage.entity.bo.Warehouse" >
    insert into t_warehouse (id, warehouse_leven_id, name, 
      area, service_provider, warehouse_attribution, 
      msg, status, create_time, 
      create_account, modify_account, modify_time, 
      appkey, is_enabled)
    values (#{id,jdbcType=VARCHAR}, #{warehouseLevenId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{area,jdbcType=VARCHAR}, #{serviceProvider,jdbcType=VARCHAR}, #{warehouseAttribution,jdbcType=VARCHAR}, 
      #{msg,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{createAccount,jdbcType=VARCHAR}, #{modifyAccount,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, 
      #{appkey,jdbcType=VARCHAR}, #{isEnabled,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.boco.nbd.wios.manage.entity.bo.Warehouse" >
    insert into t_warehouse
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="warehouseLevenId != null" >
        warehouse_leven_id,
      </if>
      <if test="name != null" >
        name,
      </if>
      <if test="area != null" >
        area,
      </if>
      <if test="serviceProvider != null" >
        service_provider,
      </if>
      <if test="warehouseAttribution != null" >
        warehouse_attribution,
      </if>
      <if test="msg != null" >
        msg,
      </if>
      <if test="status != null" >
        status,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="createAccount != null" >
        create_account,
      </if>
      <if test="modifyAccount != null" >
        modify_account,
      </if>
      <if test="modifyTime != null" >
        modify_time,
      </if>
      <if test="appkey != null" >
        appkey,
      </if>
      <if test="isEnabled != null" >
        is_enabled,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="warehouseLevenId != null" >
        #{warehouseLevenId,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="area != null" >
        #{area,jdbcType=VARCHAR},
      </if>
      <if test="serviceProvider != null" >
        #{serviceProvider,jdbcType=VARCHAR},
      </if>
      <if test="warehouseAttribution != null" >
        #{warehouseAttribution,jdbcType=VARCHAR},
      </if>
      <if test="msg != null" >
        #{msg,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createAccount != null" >
        #{createAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyAccount != null" >
        #{modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null" >
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="appkey != null" >
        #{appkey,jdbcType=VARCHAR},
      </if>
      <if test="isEnabled != null" >
        #{isEnabled,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.WarehouseCriteria" resultType="java.lang.Integer" >
    select count(*) from t_warehouse
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_warehouse
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.warehouseLevenId != null" >
        warehouse_leven_id = #{record.warehouseLevenId,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null" >
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.area != null" >
        area = #{record.area,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceProvider != null" >
        service_provider = #{record.serviceProvider,jdbcType=VARCHAR},
      </if>
      <if test="record.warehouseAttribution != null" >
        warehouse_attribution = #{record.warehouseAttribution,jdbcType=VARCHAR},
      </if>
      <if test="record.msg != null" >
        msg = #{record.msg,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null" >
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createAccount != null" >
        create_account = #{record.createAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.modifyAccount != null" >
        modify_account = #{record.modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.modifyTime != null" >
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.appkey != null" >
        appkey = #{record.appkey,jdbcType=VARCHAR},
      </if>
      <if test="record.isEnabled != null" >
        is_enabled = #{record.isEnabled,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_warehouse
    set id = #{record.id,jdbcType=VARCHAR},
      warehouse_leven_id = #{record.warehouseLevenId,jdbcType=VARCHAR},
      name = #{record.name,jdbcType=VARCHAR},
      area = #{record.area,jdbcType=VARCHAR},
      service_provider = #{record.serviceProvider,jdbcType=VARCHAR},
      warehouse_attribution = #{record.warehouseAttribution,jdbcType=VARCHAR},
      msg = #{record.msg,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_account = #{record.createAccount,jdbcType=VARCHAR},
      modify_account = #{record.modifyAccount,jdbcType=VARCHAR},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      appkey = #{record.appkey,jdbcType=VARCHAR},
      is_enabled = #{record.isEnabled,jdbcType=INTEGER}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.boco.nbd.wios.manage.entity.bo.Warehouse" >
    update t_warehouse
    <set >
      <if test="warehouseLevenId != null" >
        warehouse_leven_id = #{warehouseLevenId,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="area != null" >
        area = #{area,jdbcType=VARCHAR},
      </if>
      <if test="serviceProvider != null" >
        service_provider = #{serviceProvider,jdbcType=VARCHAR},
      </if>
      <if test="warehouseAttribution != null" >
        warehouse_attribution = #{warehouseAttribution,jdbcType=VARCHAR},
      </if>
      <if test="msg != null" >
        msg = #{msg,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createAccount != null" >
        create_account = #{createAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyAccount != null" >
        modify_account = #{modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null" >
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="appkey != null" >
        appkey = #{appkey,jdbcType=VARCHAR},
      </if>
      <if test="isEnabled != null" >
        is_enabled = #{isEnabled,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.boco.nbd.wios.manage.entity.bo.Warehouse" >
    update t_warehouse
    set warehouse_leven_id = #{warehouseLevenId,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      area = #{area,jdbcType=VARCHAR},
      service_provider = #{serviceProvider,jdbcType=VARCHAR},
      warehouse_attribution = #{warehouseAttribution,jdbcType=VARCHAR},
      msg = #{msg,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_account = #{createAccount,jdbcType=VARCHAR},
      modify_account = #{modifyAccount,jdbcType=VARCHAR},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      appkey = #{appkey,jdbcType=VARCHAR},
      is_enabled = #{isEnabled,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>