24282 2 年之前
父节点
当前提交
47ca9572f7

+ 14 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysRole.java

@@ -102,6 +102,12 @@ public class SysRole extends BaseEntity {
     @TableField(exist = false)
     @TableField(exist = false)
     private Set<String> permissions;
     private Set<String> permissions;
 
 
+    /**
+     * 关键字
+     */
+    @TableField(exist = false)
+    private String keyword;
+
     public SysRole() {
     public SysRole() {
 
 
     }
     }
@@ -235,6 +241,14 @@ public class SysRole extends BaseEntity {
         this.tenantId = tenantId;
         this.tenantId = tenantId;
     }
     }
 
 
+    public String getKeyword() {
+        return keyword;
+    }
+
+    public void setKeyword(String keyword) {
+        this.keyword = keyword;
+    }
+
     @Override
     @Override
     public String toString() {
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 0 - 2
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -8,8 +8,6 @@ import com.ruoyi.common.annotation.Excel.Type;
 import com.ruoyi.common.annotation.Excels;
 import com.ruoyi.common.annotation.Excels;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.common.core.domain.BaseEntity;
 import com.ruoyi.common.xss.Xss;
 import com.ruoyi.common.xss.Xss;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 
 import javax.validation.constraints.Email;
 import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotBlank;

+ 30 - 27
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -31,33 +31,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     </sql>
     
     
     <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
     <select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
-		<include refid="selectRoleVo"/>
-		where r.del_flag = '0'
-		<if test="roleId != null and roleId != 0">
-			AND r.role_id = #{roleId}
-		</if>
-		<if test="tenantId != null and tenantId != ''">
-			AND r.tenant_id = #{tenantId}
-		</if>
-		<if test="roleName != null and roleName != ''">
-			AND r.role_name like concat('%', #{roleName}, '%')
-		</if>
-		<if test="status != null and status != ''">
-			AND r.status = #{status}
-		</if>
-		<if test="roleKey != null and roleKey != ''">
-			AND r.role_key like concat('%', #{roleKey}, '%')
-		</if>
-		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
-		</if>
-		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
-		</if>
-		<!-- 数据范围过滤 -->
-		${params.dataScope}
-		order by r.role_sort
-	</select>
+        <include refid="selectRoleVo"/>
+        where r.del_flag = '0'
+        <if test="roleId != null and roleId != 0">
+            AND r.role_id = #{roleId}
+        </if>
+        <if test="tenantId != null and tenantId != ''">
+            AND r.tenant_id = #{tenantId}
+        </if>
+        <if test="roleName != null and roleName != ''">
+            AND r.role_name like concat('%', #{roleName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND r.status = #{status}
+        </if>
+        <if test="roleKey != null and roleKey != ''">
+            AND r.role_key like concat('%', #{roleKey}, '%')
+        </if>
+        <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+            and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+        </if>
+        <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+            and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+        </if>
+        <if test="keyword neq null and keyword neq ''">
+            and (instr(r.role_key,#{keyword}) or instr(r.role_name,#{keyword}))
+        </if>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+        order by r.role_sort
+    </select>
     
     
 	<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
 	<select id="selectRolePermissionByUserId" parameterType="Long" resultMap="SysRoleResult">
 		<include refid="selectRoleVo"/>
 		<include refid="selectRoleVo"/>