Finish role search

This commit is contained in:
2023-11-15 09:52:19 +08:00
parent 574c0df384
commit c0c033ad77
2 changed files with 13 additions and 9 deletions

View File

@@ -38,7 +38,9 @@ class RoleServiceImpl(
baseMapper.selectPage(roleIdsPage, roleGetParam?.searchName, roleGetParam?.searchRegex ?: false) baseMapper.selectPage(roleIdsPage, roleGetParam?.searchName, roleGetParam?.searchRegex ?: false)
val rolePage = Page<Role>(roleIdsPage.current, roleIdsIPage.size, roleIdsIPage.total) val rolePage = Page<Role>(roleIdsPage.current, roleIdsIPage.size, roleIdsIPage.total)
if (roleIdsIPage.total > 0) {
rolePage.setRecords(baseMapper.getWithPowerByList(roleIdsIPage.records)) rolePage.setRecords(baseMapper.getWithPowerByList(roleIdsIPage.records))
}
return RoleConverter.rolePageToRoleWithPowerPageVo(rolePage) return RoleConverter.rolePageToRoleWithPowerPageVo(rolePage)

View File

@@ -6,6 +6,7 @@
from t_role from t_role
<where> <where>
deleted = 0 deleted = 0
<if test="searchName != null">
<choose> <choose>
<when test="searchRegex == true"> <when test="searchRegex == true">
and t_role.name regexp #{searchName} and t_role.name regexp #{searchName}
@@ -14,6 +15,7 @@
and t_role.name like concat('%' ,#{searchName}, '%') and t_role.name like concat('%' ,#{searchName}, '%')
</otherwise> </otherwise>
</choose> </choose>
</if>
</where> </where>
</select> </select>