SysOrgMapper.xml 8.14 KB
<?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.zteits.sys.mapper.SysOrgMapper" >
  <resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysOrg" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="org_code" property="orgCode" jdbcType="VARCHAR" />
    <result column="org_name" property="orgName" jdbcType="VARCHAR" />
    <result column="short_name" property="shortName" jdbcType="VARCHAR" />
    <result column="sort_num" property="sortNum" jdbcType="INTEGER" />
    <result column="org_level" property="orgLevel" jdbcType="INTEGER" />
    <result column="parent_org_id" property="parentOrgId" jdbcType="BIGINT" />
    <result column="org_desc" property="orgDesc" jdbcType="VARCHAR" />
    <result column="org_leader_id" property="orgLeaderId" jdbcType="BIGINT" />
    <result column="org_icon" property="orgIcon" jdbcType="VARCHAR" />
    <result column="sys_code" property="sysCode" jdbcType="VARCHAR" />
    <result column="data_state" property="dataState" jdbcType="INTEGER" />
    <result column="create_empid" property="createEmpid" jdbcType="VARCHAR" />
    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
    <result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR" />
    <result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, org_code, org_name, short_name, sort_num, org_level, parent_org_id, org_desc, 
    org_leader_id, org_icon, sys_code, data_state, create_empid, create_date, modfiy_empid, 
    modfiy_date
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from sys_org
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from sys_org
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.zteits.sys.domain.SysOrg" >
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_org (org_code, org_name, short_name, 
      sort_num, org_level, parent_org_id, 
      org_desc, org_leader_id, org_icon, 
      sys_code, data_state, create_empid, 
      create_date, modfiy_empid, modfiy_date
      )
    values (#{orgCode,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, #{shortName,jdbcType=VARCHAR}, 
      #{sortNum,jdbcType=INTEGER}, #{orgLevel,jdbcType=INTEGER}, #{parentOrgId,jdbcType=BIGINT}, 
      #{orgDesc,jdbcType=VARCHAR}, #{orgLeaderId,jdbcType=BIGINT}, #{orgIcon,jdbcType=VARCHAR}, 
      #{sysCode,jdbcType=VARCHAR}, #{dataState,jdbcType=INTEGER}, #{createEmpid,jdbcType=VARCHAR}, 
      #{createDate,jdbcType=TIMESTAMP}, #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.zteits.sys.domain.SysOrg" >
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_org
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="orgCode != null" >
        org_code,
      </if>
      <if test="orgName != null" >
        org_name,
      </if>
      <if test="shortName != null" >
        short_name,
      </if>
      <if test="sortNum != null" >
        sort_num,
      </if>
      <if test="orgLevel != null" >
        org_level,
      </if>
      <if test="parentOrgId != null" >
        parent_org_id,
      </if>
      <if test="orgDesc != null" >
        org_desc,
      </if>
      <if test="orgLeaderId != null" >
        org_leader_id,
      </if>
      <if test="orgIcon != null" >
        org_icon,
      </if>
      <if test="sysCode != null" >
        sys_code,
      </if>
      <if test="dataState != null" >
        data_state,
      </if>
      <if test="createEmpid != null" >
        create_empid,
      </if>
      <if test="createDate != null" >
        create_date,
      </if>
      <if test="modfiyEmpid != null" >
        modfiy_empid,
      </if>
      <if test="modfiyDate != null" >
        modfiy_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="orgCode != null" >
        #{orgCode,jdbcType=VARCHAR},
      </if>
      <if test="orgName != null" >
        #{orgName,jdbcType=VARCHAR},
      </if>
      <if test="shortName != null" >
        #{shortName,jdbcType=VARCHAR},
      </if>
      <if test="sortNum != null" >
        #{sortNum,jdbcType=INTEGER},
      </if>
      <if test="orgLevel != null" >
        #{orgLevel,jdbcType=INTEGER},
      </if>
      <if test="parentOrgId != null" >
        #{parentOrgId,jdbcType=BIGINT},
      </if>
      <if test="orgDesc != null" >
        #{orgDesc,jdbcType=VARCHAR},
      </if>
      <if test="orgLeaderId != null" >
        #{orgLeaderId,jdbcType=BIGINT},
      </if>
      <if test="orgIcon != null" >
        #{orgIcon,jdbcType=VARCHAR},
      </if>
      <if test="sysCode != null" >
        #{sysCode,jdbcType=VARCHAR},
      </if>
      <if test="dataState != null" >
        #{dataState,jdbcType=INTEGER},
      </if>
      <if test="createEmpid != null" >
        #{createEmpid,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="modfiyEmpid != null" >
        #{modfiyEmpid,jdbcType=VARCHAR},
      </if>
      <if test="modfiyDate != null" >
        #{modfiyDate,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.zteits.sys.domain.SysOrg" >
    update sys_org
    <set >
      <if test="orgCode != null" >
        org_code = #{orgCode,jdbcType=VARCHAR},
      </if>
      <if test="orgName != null" >
        org_name = #{orgName,jdbcType=VARCHAR},
      </if>
      <if test="shortName != null" >
        short_name = #{shortName,jdbcType=VARCHAR},
      </if>
      <if test="sortNum != null" >
        sort_num = #{sortNum,jdbcType=INTEGER},
      </if>
      <if test="orgLevel != null" >
        org_level = #{orgLevel,jdbcType=INTEGER},
      </if>
      <if test="parentOrgId != null" >
        parent_org_id = #{parentOrgId,jdbcType=BIGINT},
      </if>
      <if test="orgDesc != null" >
        org_desc = #{orgDesc,jdbcType=VARCHAR},
      </if>
      <if test="orgLeaderId != null" >
        org_leader_id = #{orgLeaderId,jdbcType=BIGINT},
      </if>
      <if test="orgIcon != null" >
        org_icon = #{orgIcon,jdbcType=VARCHAR},
      </if>
      <if test="sysCode != null" >
        sys_code = #{sysCode,jdbcType=VARCHAR},
      </if>
      <if test="dataState != null" >
        data_state = #{dataState,jdbcType=INTEGER},
      </if>
      <if test="createEmpid != null" >
        create_empid = #{createEmpid,jdbcType=VARCHAR},
      </if>
      <if test="createDate != null" >
        create_date = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="modfiyEmpid != null" >
        modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
      </if>
      <if test="modfiyDate != null" >
        modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zteits.sys.domain.SysOrg" >
    update sys_org
    set org_code = #{orgCode,jdbcType=VARCHAR},
      org_name = #{orgName,jdbcType=VARCHAR},
      short_name = #{shortName,jdbcType=VARCHAR},
      sort_num = #{sortNum,jdbcType=INTEGER},
      org_level = #{orgLevel,jdbcType=INTEGER},
      parent_org_id = #{parentOrgId,jdbcType=BIGINT},
      org_desc = #{orgDesc,jdbcType=VARCHAR},
      org_leader_id = #{orgLeaderId,jdbcType=BIGINT},
      org_icon = #{orgIcon,jdbcType=VARCHAR},
      sys_code = #{sysCode,jdbcType=VARCHAR},
      data_state = #{dataState,jdbcType=INTEGER},
      create_empid = #{createEmpid,jdbcType=VARCHAR},
      create_date = #{createDate,jdbcType=TIMESTAMP},
      modfiy_empid = #{modfiyEmpid,jdbcType=VARCHAR},
      modfiy_date = #{modfiyDate,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>