SysRoleMapper.xml 6.44 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.SysRoleMapper" >
  <resultMap id="BaseResultMap" type="com.zteits.sys.domain.SysRole" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="role_code" property="roleCode" jdbcType="CHAR" />
    <result column="role_name" property="roleName" jdbcType="VARCHAR" />
    <result column="role_desc" property="roleDesc" 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" />
    <result column="create_empname" property="createEmpname" jdbcType="VARCHAR" />
    <result column="org_id" property="orgId" jdbcType="BIGINT" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, role_code, role_name, role_desc, sys_code, data_state, create_empid, create_date, 
    modfiy_empid, modfiy_date, create_empname, org_id
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from sys_role
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from sys_role
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.zteits.sys.domain.SysRole" >
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role (role_code, role_name, role_desc, 
      sys_code, data_state, create_empid, 
      create_date, modfiy_empid, modfiy_date, 
      create_empname, org_id)
    values (#{roleCode,jdbcType=CHAR}, #{roleName,jdbcType=VARCHAR}, #{roleDesc,jdbcType=VARCHAR}, 
      #{sysCode,jdbcType=VARCHAR}, #{dataState,jdbcType=INTEGER}, #{createEmpid,jdbcType=VARCHAR}, 
      #{createDate,jdbcType=TIMESTAMP}, #{modfiyEmpid,jdbcType=VARCHAR}, #{modfiyDate,jdbcType=TIMESTAMP}, 
      #{createEmpname,jdbcType=VARCHAR}, #{orgId,jdbcType=BIGINT})
  </insert>
  <insert id="insertSelective" parameterType="com.zteits.sys.domain.SysRole" >
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER" >
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_role
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="roleCode != null" >
        role_code,
      </if>
      <if test="roleName != null" >
        role_name,
      </if>
      <if test="roleDesc != null" >
        role_desc,
      </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>
      <if test="createEmpname != null" >
        create_empname,
      </if>
      <if test="orgId != null" >
        org_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="roleCode != null" >
        #{roleCode,jdbcType=CHAR},
      </if>
      <if test="roleName != null" >
        #{roleName,jdbcType=VARCHAR},
      </if>
      <if test="roleDesc != null" >
        #{roleDesc,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>
      <if test="createEmpname != null" >
        #{createEmpname,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null" >
        #{orgId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.zteits.sys.domain.SysRole" >
    update sys_role
    <set >
      <if test="roleCode != null" >
        role_code = #{roleCode,jdbcType=CHAR},
      </if>
      <if test="roleName != null" >
        role_name = #{roleName,jdbcType=VARCHAR},
      </if>
      <if test="roleDesc != null" >
        role_desc = #{roleDesc,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>
      <if test="createEmpname != null" >
        create_empname = #{createEmpname,jdbcType=VARCHAR},
      </if>
      <if test="orgId != null" >
        org_id = #{orgId,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.zteits.sys.domain.SysRole" >
    update sys_role
    set role_code = #{roleCode,jdbcType=CHAR},
      role_name = #{roleName,jdbcType=VARCHAR},
      role_desc = #{roleDesc,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},
      create_empname = #{createEmpname,jdbcType=VARCHAR},
      org_id = #{orgId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>