SysOrganizationMapper.xml 8.45 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.glsx.manager.mapper.SysOrganizationMapper">
  <resultMap id="BaseResultMap" type="com.glsx.manager.pojo.menu.SysOrganization">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="parent_id" jdbcType="INTEGER" property="parentId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="org_status" jdbcType="TINYINT" property="orgStatus" />
    <result column="org_type" jdbcType="TINYINT" property="orgType" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="update_by" jdbcType="VARCHAR" property="updateBy" />
    <result column="create_by" jdbcType="VARCHAR" property="createBy" />
    <result column="label" jdbcType="TINYINT" property="label" />
    <result column="org_group" jdbcType="VARCHAR" property="orgGroup" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, parent_id, name, org_status, org_type, sort, create_time, update_time, remark, 
    update_by, create_by, label, org_group
  </sql>
  <select id="selectByExample" parameterType="com.glsx.manager.pojo.menu.SysOrganizationExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from sys_organization
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from sys_organization
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_organization
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.glsx.manager.pojo.menu.SysOrganization">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_organization (parent_id, name, org_status, 
      org_type, sort, create_time, 
      update_time, remark, update_by, 
      create_by, label, org_group
      )
    values (#{parentId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{orgStatus,jdbcType=TINYINT}, 
      #{orgType,jdbcType=TINYINT}, #{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, 
      #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR}, 
      #{createBy,jdbcType=VARCHAR}, #{label,jdbcType=TINYINT}, #{orgGroup,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.glsx.manager.pojo.menu.SysOrganization">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_organization
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="orgStatus != null">
        org_status,
      </if>
      <if test="orgType != null">
        org_type,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="label != null">
        label,
      </if>
      <if test="orgGroup != null">
        org_group,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="parentId != null">
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="orgStatus != null">
        #{orgStatus,jdbcType=TINYINT},
      </if>
      <if test="orgType != null">
        #{orgType,jdbcType=TINYINT},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="label != null">
        #{label,jdbcType=TINYINT},
      </if>
      <if test="orgGroup != null">
        #{orgGroup,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.pojo.menu.SysOrganization">
    update sys_organization
    <set>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="orgStatus != null">
        org_status = #{orgStatus,jdbcType=TINYINT},
      </if>
      <if test="orgType != null">
        org_type = #{orgType,jdbcType=TINYINT},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=VARCHAR},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=VARCHAR},
      </if>
      <if test="label != null">
        label = #{label,jdbcType=TINYINT},
      </if>
      <if test="orgGroup != null">
        org_group = #{orgGroup,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.glsx.manager.pojo.menu.SysOrganization">
    update sys_organization
    set parent_id = #{parentId,jdbcType=INTEGER},
      name = #{name,jdbcType=VARCHAR},
      org_status = #{orgStatus,jdbcType=TINYINT},
      org_type = #{orgType,jdbcType=TINYINT},
      sort = #{sort,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR},
      update_by = #{updateBy,jdbcType=VARCHAR},
      create_by = #{createBy,jdbcType=VARCHAR},
      label = #{label,jdbcType=TINYINT},
      org_group = #{orgGroup,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>