用户列表支持根据角色筛选

pull/10/head
xuxueli 6 years ago
parent a0012b290e
commit 98c2354955

@ -50,11 +50,11 @@ public class UserController {
@PermessionLimit(adminuser = true)
public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int start,
@RequestParam(required = false, defaultValue = "10") int length,
String username) {
String username, int role) {
// page list
List<XxlJobUser> list = xxlJobUserDao.pageList(start, length, username);
int list_count = xxlJobUserDao.pageListCount(start, length, username);
List<XxlJobUser> list = xxlJobUserDao.pageList(start, length, username, role);
int list_count = xxlJobUserDao.pageListCount(start, length, username, role);
// package result
Map<String, Object> maps = new HashMap<String, Object>();

@ -13,10 +13,12 @@ public interface XxlJobUserDao {
public List<XxlJobUser> pageList(@Param("offset") int offset,
@Param("pagesize") int pagesize,
@Param("username") String username);
@Param("username") String username,
@Param("role") int role);
public int pageListCount(@Param("offset") int offset,
@Param("pagesize") int pagesize,
@Param("username") String username);
@Param("username") String username,
@Param("role") int role);
public XxlJobUser loadByUserName(@Param("username") String username);

@ -26,6 +26,9 @@
<if test="username != null and username != ''">
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
</if>
<if test="role gt -1">
AND t.role = #{role}
</if>
</trim>
ORDER BY username ASC
LIMIT #{offset}, #{pagesize}
@ -38,6 +41,9 @@
<if test="username != null and username != ''">
AND t.username like CONCAT(CONCAT('%', #{username}), '%')
</if>
<if test="role gt -1">
AND t.role = #{role}
</if>
</trim>
</select>

@ -11,6 +11,7 @@ $(function() {
data : function ( d ) {
var obj = {};
obj.username = $('#username').val();
obj.role = $('#role').val();
obj.start = d.start;
obj.length = d.length;
return obj;

@ -25,6 +25,16 @@
<section class="content">
<div class="row">
<div class="col-xs-3">
<div class="input-group">
<span class="input-group-addon">${I18n.user_role}</span>
<select class="form-control" id="role" >
<option value="-1" >${I18n.system_all}</option>
<option value="0" >${I18n.user_role_admin}</option>
<option value="1" >${I18n.user_role_normal}</option>
</select>
</div>
</div>
<div class="col-xs-3">
<div class="input-group">
<span class="input-group-addon">${I18n.user_username}</span>

Loading…
Cancel
Save