<?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="resources/permission.WbDeptMapper">
  <resultMap id="BaseResultMap" type="com.wb.permission.pojo.WbDept">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="DEPT_ID" jdbcType="VARCHAR" property="deptId" />
    <result column="TENANCY_ID" jdbcType="VARCHAR" property="tenancyId" />
    <result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName" />
    <result column="PARENT_DEPT" jdbcType="VARCHAR" property="parentDept" />
    <result column="ORDER_INDEX" jdbcType="DECIMAL" property="orderIndex" />
    <result column="IS_TENANCY" jdbcType="CHAR" property="isTenancy" />
    <result column="IS_WEB" jdbcType="CHAR" property="isWeb" />
    <result column="DEPT_TYPE" jdbcType="VARCHAR" property="deptType" />
    <result column="GROUP_CODE" jdbcType="VARCHAR" property="groupCode" />
    <result column="NOTES" jdbcType="VARCHAR" property="notes" />
    <result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy" />
    <result column="CREATED_ON" jdbcType="TIMESTAMP" property="createdOn" />
    <result column="UPDATED_BY" jdbcType="VARCHAR" property="updatedBy" />
    <result column="UPDATED_ON" jdbcType="TIMESTAMP" property="updatedOn" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    DEPT_ID, TENANCY_ID, DEPT_NAME, PARENT_DEPT, ORDER_INDEX, IS_TENANCY, IS_WEB, DEPT_TYPE, 
    GROUP_CODE, NOTES, CREATED_BY, CREATED_ON, UPDATED_BY, UPDATED_ON
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from WB_DEPT
    where DEPT_ID = #{deptId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from WB_DEPT
    where DEPT_ID = #{deptId,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.wb.permission.pojo.WbDept">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into WB_DEPT (DEPT_ID, TENANCY_ID, DEPT_NAME, 
      PARENT_DEPT, ORDER_INDEX, IS_TENANCY, 
      IS_WEB, DEPT_TYPE, GROUP_CODE, 
      NOTES, CREATED_BY, CREATED_ON, 
      UPDATED_BY, UPDATED_ON)
    values (#{deptId,jdbcType=VARCHAR}, #{tenancyId,jdbcType=VARCHAR}, #{deptName,jdbcType=VARCHAR}, 
      #{parentDept,jdbcType=VARCHAR}, #{orderIndex,jdbcType=DECIMAL}, #{isTenancy,jdbcType=CHAR}, 
      #{isWeb,jdbcType=CHAR}, #{deptType,jdbcType=VARCHAR}, #{groupCode,jdbcType=VARCHAR}, 
      #{notes,jdbcType=VARCHAR}, #{createdBy,jdbcType=VARCHAR}, #{createdOn,jdbcType=TIMESTAMP}, 
      #{updatedBy,jdbcType=VARCHAR}, #{updatedOn,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.wb.permission.pojo.WbDept">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into WB_DEPT
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="deptId != null">
        DEPT_ID,
      </if>
      <if test="tenancyId != null">
        TENANCY_ID,
      </if>
      <if test="deptName != null">
        DEPT_NAME,
      </if>
      <if test="parentDept != null">
        PARENT_DEPT,
      </if>
      <if test="orderIndex != null">
        ORDER_INDEX,
      </if>
      <if test="isTenancy != null">
        IS_TENANCY,
      </if>
      <if test="isWeb != null">
        IS_WEB,
      </if>
      <if test="deptType != null">
        DEPT_TYPE,
      </if>
      <if test="groupCode != null">
        GROUP_CODE,
      </if>
      <if test="notes != null">
        NOTES,
      </if>
      <if test="createdBy != null">
        CREATED_BY,
      </if>
      <if test="createdOn != null">
        CREATED_ON,
      </if>
      <if test="updatedBy != null">
        UPDATED_BY,
      </if>
      <if test="updatedOn != null">
        UPDATED_ON,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="deptId != null">
        #{deptId,jdbcType=VARCHAR},
      </if>
      <if test="tenancyId != null">
        #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="deptName != null">
        #{deptName,jdbcType=VARCHAR},
      </if>
      <if test="parentDept != null">
        #{parentDept,jdbcType=VARCHAR},
      </if>
      <if test="orderIndex != null">
        #{orderIndex,jdbcType=DECIMAL},
      </if>
      <if test="isTenancy != null">
        #{isTenancy,jdbcType=CHAR},
      </if>
      <if test="isWeb != null">
        #{isWeb,jdbcType=CHAR},
      </if>
      <if test="deptType != null">
        #{deptType,jdbcType=VARCHAR},
      </if>
      <if test="groupCode != null">
        #{groupCode,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        #{notes,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        #{updatedOn,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.wb.permission.pojo.WbDept">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update WB_DEPT
    <set>
      <if test="tenancyId != null">
        TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="deptName != null">
        DEPT_NAME = #{deptName,jdbcType=VARCHAR},
      </if>
      <if test="parentDept != null">
        PARENT_DEPT = #{parentDept,jdbcType=VARCHAR},
      </if>
      <if test="orderIndex != null">
        ORDER_INDEX = #{orderIndex,jdbcType=DECIMAL},
      </if>
      <if test="isTenancy != null">
        IS_TENANCY = #{isTenancy,jdbcType=CHAR},
      </if>
      <if test="isWeb != null">
        IS_WEB = #{isWeb,jdbcType=CHAR},
      </if>
      <if test="deptType != null">
        DEPT_TYPE = #{deptType,jdbcType=VARCHAR},
      </if>
      <if test="groupCode != null">
        GROUP_CODE = #{groupCode,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        NOTES = #{notes,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP},
      </if>
    </set>
    where DEPT_ID = #{deptId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.wb.permission.pojo.WbDept">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update WB_DEPT
    set TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      DEPT_NAME = #{deptName,jdbcType=VARCHAR},
      PARENT_DEPT = #{parentDept,jdbcType=VARCHAR},
      ORDER_INDEX = #{orderIndex,jdbcType=DECIMAL},
      IS_TENANCY = #{isTenancy,jdbcType=CHAR},
      IS_WEB = #{isWeb,jdbcType=CHAR},
      DEPT_TYPE = #{deptType,jdbcType=VARCHAR},
      GROUP_CODE = #{groupCode,jdbcType=VARCHAR},
      NOTES = #{notes,jdbcType=VARCHAR},
      CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP}
    where DEPT_ID = #{deptId,jdbcType=VARCHAR}
  </update>

  <!--删除部门-->
  <delete id="delWbDeptByDeptIds" parameterType="java.lang.String">
    delete from WB_DEPT
    where instr(#{deptId,jdbcType=VARCHAR},DEPT_ID)>0
  </delete>

  <!-- 查询部门信息-->
  <select id="selectWbDept" parameterType="com.wb.permission.pojo.WbDept" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from WB_DEPT
    where DEPT_ID = #{deptId,jdbcType=VARCHAR}
  </select>
</mapper>