郑永安
2023-06-19 f65443d8abeaedc9d102324565e8368e7c9d90c8
src/main/java/com/gk/firework/Mapper/mybatis/PermissionInfoMapper.xml
对比新文件
@@ -0,0 +1,165 @@
<?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.gk.firework.Mapper.PermissionInfoMapper">
  <resultMap id="BaseResultMap" type="com.gk.firework.Domain.PermissionInfo">
    <!--          -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="level" jdbcType="INTEGER" property="level" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="path" jdbcType="VARCHAR" property="path" />
    <result column="component" jdbcType="VARCHAR" property="component" />
    <result column="icon" jdbcType="VARCHAR" property="icon" />
    <result column="buttontype" jdbcType="VARCHAR" property="buttontype" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="sortorder" jdbcType="DOUBLE" property="sortorder" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="expand" jdbcType="BIT" property="expand" />
    <result column="checked" jdbcType="BIT" property="checked" />
    <result column="selected" jdbcType="BIT" property="selected" />
    <result column="createdby" jdbcType="VARCHAR" property="createdby" />
    <result column="createddate" jdbcType="TIMESTAMP" property="createddate" />
    <result column="lastmodifiedby" jdbcType="VARCHAR" property="lastmodifiedby" />
    <result column="lastmodifieddate" jdbcType="TIMESTAMP" property="lastmodifieddate" />
    <result column="parentid" jdbcType="INTEGER" property="parentid" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--          -->
    id, name, level, title, path, component, icon, buttontype, status, description, sortorder,
    type, expand, checked, selected, createdby, createddate, lastmodifiedby, lastmodifieddate,
    parentid
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from permission
    where id = #{id,jdbcType=INTEGER}
  </select>
  <select id="selectAll" resultType="com.gk.firework.Domain.PermissionInfo">
    select
    <include refid="Base_Column_List" />
    from permission
    where `status` = 1
    order by sortorder asc
  </select>
  <select id="selectByUserId" resultType="com.gk.firework.Domain.PermissionInfo">
    SELECT
    <include refid="Base_Column_List" />
    FROM
   permission
    WHERE
   id IN (
      SELECT DISTINCT
         rolepermissions.permissionid
      FROM
         rolepermissions
      WHERE
         roleid IN (
            SELECT
               userroles.roleid
            FROM
               userroles
            LEFT JOIN `user` ON `user`.id = userroles.userid
            WHERE
               `user`.id = #{userId}
         )
   )
   and `status` = 1
    ORDER BY `level`,sortorder ASC
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--          -->
    delete from permission
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <update id="updateByPrimaryKeySelective" parameterType="com.gk.firework.Domain.PermissionInfo">
    <!--          -->
    update permission
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        level = #{level,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="path != null">
        path = #{path,jdbcType=VARCHAR},
      </if>
      <if test="component != null">
        component = #{component,jdbcType=VARCHAR},
      </if>
      <if test="icon != null">
        icon = #{icon,jdbcType=VARCHAR},
      </if>
      <if test="buttontype != null">
        buttonType = #{buttontype,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="sortorder != null">
        sortorder = #{sortorder,jdbcType=DOUBLE},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="expand != null">
        expand = #{expand,jdbcType=BIT},
      </if>
      <if test="checked != null">
        checked = #{checked,jdbcType=BIT},
      </if>
      <if test="selected != null">
        selected = #{selected,jdbcType=BIT},
      </if>
      <if test="createdby != null">
        createdby = #{createdby,jdbcType=VARCHAR},
      </if>
      <if test="createddate != null">
        createddate = #{createddate,jdbcType=TIMESTAMP},
      </if>
      <if test="lastmodifiedby != null">
        lastmodifiedby = #{lastmodifiedby,jdbcType=VARCHAR},
      </if>
      <if test="lastmodifieddate != null">
        lastmodifieddate = #{lastmodifieddate,jdbcType=TIMESTAMP},
      </if>
      <if test="parentid != null">
        parentid = #{parentid,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.gk.firework.Domain.PermissionInfo">
    <!--          -->
    update permission
    set name = #{name,jdbcType=VARCHAR},
      level = #{level,jdbcType=INTEGER},
      title = #{title,jdbcType=VARCHAR},
      path = #{path,jdbcType=VARCHAR},
      component = #{component,jdbcType=VARCHAR},
      icon = #{icon,jdbcType=VARCHAR},
      buttonType = #{buttontype,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      description = #{description,jdbcType=VARCHAR},
      sortorder = #{sortorder,jdbcType=DOUBLE},
      type = #{type,jdbcType=INTEGER},
      expand = #{expand,jdbcType=BIT},
      checked = #{checked,jdbcType=BIT},
      selected = #{selected,jdbcType=BIT},
      createdby = #{createdby,jdbcType=VARCHAR},
      createddate = #{createddate,jdbcType=TIMESTAMP},
      lastmodifiedby = #{lastmodifiedby,jdbcType=VARCHAR},
      lastmodifieddate = #{lastmodifieddate,jdbcType=TIMESTAMP},
      parentid = #{parentid,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>