<?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.def.DispatchConfigMapper" >
  <resultMap id="BaseResultMap" type="com.boco.nbd.wios.manage.entity.bo.DispatchConfig" >
    <id column="id" property="id" jdbcType="VARCHAR" />
    <result column="region_id" property="regionId" jdbcType="INTEGER" />
    <result column="supplier_id" property="supplierId" jdbcType="VARCHAR" />
    <result column="dispatch_num" property="dispatchNum" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP" />
    <result column="is_del" property="isDel" 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, region_id, supplier_id, dispatch_num, create_time, modify_time, is_del
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfigCriteria" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_dispatch_config
    <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_dispatch_config
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_dispatch_config
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfigCriteria" >
    delete from t_dispatch_config
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfig" >
    insert into t_dispatch_config (id, region_id, supplier_id, 
      dispatch_num, create_time, modify_time, 
      is_del)
    values (#{id,jdbcType=VARCHAR}, #{regionId,jdbcType=INTEGER}, #{supplierId,jdbcType=VARCHAR}, 
      #{dispatchNum,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, 
      #{isDel,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfig" >
    insert into t_dispatch_config
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="regionId != null" >
        region_id,
      </if>
      <if test="supplierId != null" >
        supplier_id,
      </if>
      <if test="dispatchNum != null" >
        dispatch_num,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="modifyTime != null" >
        modify_time,
      </if>
      <if test="isDel != null" >
        is_del,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="regionId != null" >
        #{regionId,jdbcType=INTEGER},
      </if>
      <if test="supplierId != null" >
        #{supplierId,jdbcType=VARCHAR},
      </if>
      <if test="dispatchNum != null" >
        #{dispatchNum,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null" >
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isDel != null" >
        #{isDel,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfigCriteria" resultType="java.lang.Integer" >
    select count(*) from t_dispatch_config
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <select id="getDispatchConfigListByRegionId" resultType="com.boco.nbd.wios.manage.entity.bo.DispatchConfig">
    select
    <include refid="Base_Column_List" />
    from t_dispatch_config
    where is_del=0 and region_id = #{regionId,jdbcType=INTEGER}
  </select>
  <select id="getDispatchConfigListByCondition" resultType="com.boco.nbd.wios.manage.entity.bo.DispatchConfig">
    select
    <include refid="Base_Column_List" />
    from t_dispatch_config
    where is_del=0
    <if test="supplierId != null and supplierId != ''" >
        and supplier_id = #{supplierId,jdbcType=INTEGER}
    </if>
    <if test="list != null" >
      and region_id in
      <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
        #{item}
      </foreach>
    </if>
    order by region_id desc
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_dispatch_config
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.regionId != null" >
        region_id = #{record.regionId,jdbcType=INTEGER},
      </if>
      <if test="record.supplierId != null" >
        supplier_id = #{record.supplierId,jdbcType=VARCHAR},
      </if>
      <if test="record.dispatchNum != null" >
        dispatch_num = #{record.dispatchNum,jdbcType=INTEGER},
      </if>
      <if test="record.createTime != null" >
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.modifyTime != null" >
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isDel != null" >
        is_del = #{record.isDel,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_dispatch_config
    set id = #{record.id,jdbcType=VARCHAR},
      region_id = #{record.regionId,jdbcType=INTEGER},
      supplier_id = #{record.supplierId,jdbcType=VARCHAR},
      dispatch_num = #{record.dispatchNum,jdbcType=INTEGER},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      is_del = #{record.isDel,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.DispatchConfig" >
    update t_dispatch_config
    <set >
      <if test="regionId != null" >
        region_id = #{regionId,jdbcType=INTEGER},
      </if>
      <if test="supplierId != null" >
        supplier_id = #{supplierId,jdbcType=VARCHAR},
      </if>
      <if test="dispatchNum != null" >
        dispatch_num = #{dispatchNum,jdbcType=INTEGER},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null" >
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isDel != null" >
        is_del = #{isDel,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.boco.nbd.wios.manage.entity.bo.DispatchConfig" >
    update t_dispatch_config
    set region_id = #{regionId,jdbcType=INTEGER},
      supplier_id = #{supplierId,jdbcType=VARCHAR},
      dispatch_num = #{dispatchNum,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      is_del = #{isDel,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>