SysMenuMapper.xml 10.5 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.SysMenuMapper">
  <resultMap id="BaseResultMap" type="com.glsx.manager.pojo.menu.SysMenu">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="parent_id" jdbcType="INTEGER" property="parentId" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="right_des" jdbcType="VARCHAR" property="rightDes" />
    <result column="request_add" jdbcType="VARCHAR" property="requestAdd" />
    <result column="menu_status" jdbcType="TINYINT" property="menuStatus" />
    <result column="menu_type" jdbcType="TINYINT" property="menuType" />
    <result column="menu_icon" jdbcType="VARCHAR" property="menuIcon" />
    <result column="is_show" jdbcType="TINYINT" property="isShow" />
    <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="menu_group" jdbcType="VARCHAR" property="menuGroup" />
    <result column="func_type" jdbcType="VARCHAR" property="funcType" />
  </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, name, parent_id, sort, right_des, request_add, menu_status, menu_type, menu_icon, 
    is_show, create_time, update_time, remark, update_by, create_by, label, menu_group, 
    func_type
  </sql>
  <select id="selectByExample" parameterType="com.glsx.manager.pojo.menu.SysMenuExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'false' as QUERYID,
    <include refid="Base_Column_List" />
    from sys_menu
    <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_menu
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from sys_menu
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.glsx.manager.pojo.menu.SysMenu">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_menu (name, parent_id, sort, 
      right_des, request_add, menu_status, 
      menu_type, menu_icon, is_show, 
      create_time, update_time, remark, 
      update_by, create_by, label, 
      menu_group, func_type)
    values (#{name,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, 
      #{rightDes,jdbcType=VARCHAR}, #{requestAdd,jdbcType=VARCHAR}, #{menuStatus,jdbcType=TINYINT}, 
      #{menuType,jdbcType=TINYINT}, #{menuIcon,jdbcType=VARCHAR}, #{isShow,jdbcType=TINYINT}, 
      #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, 
      #{updateBy,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{label,jdbcType=TINYINT}, 
      #{menuGroup,jdbcType=VARCHAR}, #{funcType,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.glsx.manager.pojo.menu.SysMenu">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_menu
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="name != null">
        name,
      </if>
      <if test="parentId != null">
        parent_id,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="rightDes != null">
        right_des,
      </if>
      <if test="requestAdd != null">
        request_add,
      </if>
      <if test="menuStatus != null">
        menu_status,
      </if>
      <if test="menuType != null">
        menu_type,
      </if>
      <if test="menuIcon != null">
        menu_icon,
      </if>
      <if test="isShow != null">
        is_show,
      </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="menuGroup != null">
        menu_group,
      </if>
      <if test="funcType != null">
        func_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="rightDes != null">
        #{rightDes,jdbcType=VARCHAR},
      </if>
      <if test="requestAdd != null">
        #{requestAdd,jdbcType=VARCHAR},
      </if>
      <if test="menuStatus != null">
        #{menuStatus,jdbcType=TINYINT},
      </if>
      <if test="menuType != null">
        #{menuType,jdbcType=TINYINT},
      </if>
      <if test="menuIcon != null">
        #{menuIcon,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        #{isShow,jdbcType=TINYINT},
      </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="menuGroup != null">
        #{menuGroup,jdbcType=VARCHAR},
      </if>
      <if test="funcType != null">
        #{funcType,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.glsx.manager.pojo.menu.SysMenu">
    update sys_menu
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="parentId != null">
        parent_id = #{parentId,jdbcType=INTEGER},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="rightDes != null">
        right_des = #{rightDes,jdbcType=VARCHAR},
      </if>
      <if test="requestAdd != null">
        request_add = #{requestAdd,jdbcType=VARCHAR},
      </if>
      <if test="menuStatus != null">
        menu_status = #{menuStatus,jdbcType=TINYINT},
      </if>
      <if test="menuType != null">
        menu_type = #{menuType,jdbcType=TINYINT},
      </if>
      <if test="menuIcon != null">
        menu_icon = #{menuIcon,jdbcType=VARCHAR},
      </if>
      <if test="isShow != null">
        is_show = #{isShow,jdbcType=TINYINT},
      </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="menuGroup != null">
        menu_group = #{menuGroup,jdbcType=VARCHAR},
      </if>
      <if test="funcType != null">
        func_type = #{funcType,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.glsx.manager.pojo.menu.SysMenu">
    update sys_menu
    set name = #{name,jdbcType=VARCHAR},
      parent_id = #{parentId,jdbcType=INTEGER},
      sort = #{sort,jdbcType=INTEGER},
      right_des = #{rightDes,jdbcType=VARCHAR},
      request_add = #{requestAdd,jdbcType=VARCHAR},
      menu_status = #{menuStatus,jdbcType=TINYINT},
      menu_type = #{menuType,jdbcType=TINYINT},
      menu_icon = #{menuIcon,jdbcType=VARCHAR},
      is_show = #{isShow,jdbcType=TINYINT},
      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},
      menu_group = #{menuGroup,jdbcType=VARCHAR},
      func_type = #{funcType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>