增加用户列表拓展按钮功能
This commit is contained in:
parent
492bf77aa4
commit
496b0b2c00
@ -200,4 +200,9 @@ public interface ISystemConstant {
|
||||
*/
|
||||
String DEFAULT_PASSWORD = "88888888";
|
||||
|
||||
/**
|
||||
* 注册用户审核
|
||||
*/
|
||||
String REGISTER_USER_EXAMINE = "registerUserExamine";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package ink.wgink.interfaces.expand.register;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: IRegisterWithExpandInfoHandlerService
|
||||
* @Description: 注册处理器,该接口在登录成功之后执行自定义的处理
|
||||
* @Author: wanggeng
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IRegisterWithExpandInfoHandlerService {
|
||||
|
||||
/**
|
||||
* 注册处理
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param expandInfo 拓展信息
|
||||
* @param requestParams 请求参数
|
||||
* @throws Exception
|
||||
*/
|
||||
void handler(String userId, Map<String, Object> expandInfo, Map<String, Object> requestParams) throws Exception;
|
||||
|
||||
}
|
@ -63,6 +63,14 @@ public interface IUserBaseService {
|
||||
*/
|
||||
List<UserDTO> listByUsernames(List<String> usernames);
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
* @param userState 用户状态
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> listByUserState(Integer userState);
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
@ -88,6 +96,15 @@ public interface IUserBaseService {
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageByIds(List<String> userIds, ListPage page);
|
||||
|
||||
/**
|
||||
* 用户分页列表
|
||||
*
|
||||
* @param userState 用户状态
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<UserDTO>> listPageByUserState(Integer userState, ListPage page);
|
||||
|
||||
/**
|
||||
* 用户列表
|
||||
*
|
||||
@ -119,7 +136,7 @@ public interface IUserBaseService {
|
||||
/**
|
||||
* 不包含的用户分页列表
|
||||
*
|
||||
* @param userIds 不包含的用户ID列表
|
||||
* @param excludeUserIds 不包含的用户ID列表
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
|
@ -0,0 +1,26 @@
|
||||
package ink.wgink.interfaces.user;
|
||||
|
||||
import ink.wgink.pojo.bos.UserExpandOptionBtnBO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: IUserOptionButtonService
|
||||
* @Description: 用户操作接口
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/1 17:23
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface IUserExpandOptionButton {
|
||||
|
||||
Integer getWidth();
|
||||
|
||||
String getTitle();
|
||||
|
||||
String getFixed();
|
||||
|
||||
String getAlign();
|
||||
|
||||
List<UserExpandOptionBtnBO> listBtn();
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package ink.wgink.pojo.bos;
|
||||
|
||||
/**
|
||||
* @ClassName: UserOptionBtn
|
||||
* @Description: 用户拓展操作按钮
|
||||
* @Author: wanggeng
|
||||
* @Date: 2022/4/1 21:32
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class UserExpandOptionBtnBO {
|
||||
|
||||
private String title;
|
||||
private String route;
|
||||
private String colorClass;
|
||||
|
||||
public String getTitle() {
|
||||
return title == null ? "" : title.trim();
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getRoute() {
|
||||
return route == null ? "" : route.trim();
|
||||
}
|
||||
|
||||
public void setRoute(String route) {
|
||||
this.route = route;
|
||||
}
|
||||
|
||||
public String getColorClass() {
|
||||
return colorClass == null ? "" : colorClass.trim();
|
||||
}
|
||||
|
||||
public void setColorClass(String colorClass) {
|
||||
this.colorClass = colorClass;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@ package ink.wgink.service.user.controller.route;
|
||||
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import ink.wgink.interfaces.user.IUserExpandBaseService;
|
||||
import ink.wgink.interfaces.user.IUserExpandOptionButton;
|
||||
import ink.wgink.util.ResourceUtil;
|
||||
import ink.wgink.util.request.StaticResourceRequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -14,6 +15,8 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* When you feel like quitting. Think about why you started
|
||||
@ -32,6 +35,8 @@ public class UserRouteController {
|
||||
|
||||
@Autowired(required = false)
|
||||
private IUserExpandBaseService userExpandBaseService;
|
||||
@Autowired(required = false)
|
||||
private IUserExpandOptionButton userExpandOptionButton;
|
||||
|
||||
@GetMapping("list")
|
||||
public ModelAndView list() {
|
||||
@ -39,6 +44,15 @@ public class UserRouteController {
|
||||
if (userExpandBaseService != null) {
|
||||
mv.addObject("userExpand", userExpandBaseService.getRoute());
|
||||
}
|
||||
if (userExpandOptionButton != null) {
|
||||
Map<String, Object> expandOption = new HashMap<>();
|
||||
expandOption.put("btns", userExpandOptionButton.listBtn());
|
||||
expandOption.put("width", userExpandOptionButton.getWidth());
|
||||
expandOption.put("title", userExpandOptionButton.getTitle());
|
||||
expandOption.put("fixed", userExpandOptionButton.getFixed());
|
||||
expandOption.put("align", userExpandOptionButton.getAlign());
|
||||
mv.addObject("expandOption", expandOption);
|
||||
}
|
||||
return mv;
|
||||
}
|
||||
|
||||
|
@ -81,6 +81,14 @@ public interface IUserDao extends IInitBaseTable {
|
||||
*/
|
||||
void updateLoginInfo(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 更新用户状态
|
||||
*
|
||||
* @param params
|
||||
* @throws UpdateException
|
||||
*/
|
||||
void updateUserState(Map<String, Object> params) throws UpdateException;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
@ -125,4 +133,5 @@ public interface IUserDao extends IInitBaseTable {
|
||||
* @throws SearchException
|
||||
*/
|
||||
String getGmtPasswordModified(String userId) throws SearchException;
|
||||
|
||||
}
|
||||
|
@ -12,8 +12,23 @@ package ink.wgink.service.user.enums;
|
||||
*/
|
||||
public enum UserStateEnum {
|
||||
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
NORMAL(0),
|
||||
LOCK(1);
|
||||
/**
|
||||
* 锁定
|
||||
*/
|
||||
LOCK(1),
|
||||
/**
|
||||
* 未审核
|
||||
*/
|
||||
UN_EXAMINE(-1),
|
||||
/**
|
||||
* 审核不通过
|
||||
*/
|
||||
UN_PASS(-2);
|
||||
|
||||
|
||||
private int value;
|
||||
|
||||
|
@ -12,8 +12,18 @@ package ink.wgink.service.user.enums;
|
||||
*/
|
||||
public enum UserTypeEnum {
|
||||
|
||||
/**
|
||||
* 系统用户
|
||||
*/
|
||||
SYSTEM(1),
|
||||
NORMAL(2);
|
||||
/**
|
||||
* 普通用户
|
||||
*/
|
||||
NORMAL(2),
|
||||
/**
|
||||
* 公共用户
|
||||
*/
|
||||
PUBLIC(3);
|
||||
|
||||
private int value;
|
||||
|
||||
|
@ -149,6 +149,8 @@ public interface IUserService extends IUserBaseService, IUserCheckService {
|
||||
* 修改密码
|
||||
*
|
||||
* @param token
|
||||
* @param updatePasswordVO
|
||||
* @throws ReflectUtil.ReflectException
|
||||
*/
|
||||
void updatePassword(String token, UpdatePasswordVO updatePasswordVO) throws ReflectUtil.ReflectException;
|
||||
|
||||
@ -186,6 +188,34 @@ public interface IUserService extends IUserBaseService, IUserCheckService {
|
||||
*/
|
||||
void updateExpiredDate(String userId, UpdateExpiredDateVO updateExpiredDateVO);
|
||||
|
||||
/**
|
||||
* 更新用户状态通过
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void updateUserStatePass(String userId);
|
||||
|
||||
/**
|
||||
* 更新用户状态通过
|
||||
*
|
||||
* @param userIds
|
||||
*/
|
||||
void updateUserStatePass(List<String> userIds);
|
||||
|
||||
/**
|
||||
* 更新用户状态不通过
|
||||
*
|
||||
* @param userId
|
||||
*/
|
||||
void updateUserStateUnPass(String userId);
|
||||
|
||||
/**
|
||||
* 更新用户状态不通过
|
||||
*
|
||||
* @param userIds
|
||||
*/
|
||||
void updateUserStateUnPass(List<String> userIds);
|
||||
|
||||
/**
|
||||
* 导入Excel
|
||||
*
|
||||
@ -231,6 +261,7 @@ public interface IUserService extends IUserBaseService, IUserCheckService {
|
||||
*
|
||||
* @param token
|
||||
* @return
|
||||
* @throws ReflectUtil.ReflectException
|
||||
*/
|
||||
AppUserDTO getAppUser(String token) throws ReflectUtil.ReflectException;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import ink.wgink.pojo.result.SuccessResultList;
|
||||
import ink.wgink.pojo.result.UploadExcelResultDTO;
|
||||
import ink.wgink.pojo.vos.UpdatePasswordVO;
|
||||
import ink.wgink.service.user.dao.IUserDao;
|
||||
import ink.wgink.service.user.enums.UserStateEnum;
|
||||
import ink.wgink.service.user.enums.UserUpdateTypeEnum;
|
||||
import ink.wgink.service.user.excel.UserExcel;
|
||||
import ink.wgink.service.user.excel.UserExcelError;
|
||||
@ -307,6 +308,42 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
userDao.updateExpiredDate(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStatePass(String userId) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("userId", userId);
|
||||
params.put("userState", UserStateEnum.NORMAL);
|
||||
setUpdateInfo(params);
|
||||
userDao.updateUserState(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStatePass(List<String> userIds) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("userIds", userIds);
|
||||
params.put("userState", UserStateEnum.NORMAL);
|
||||
setUpdateInfo(params);
|
||||
userDao.updateUserState(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStateUnPass(String userId) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("userId", userId);
|
||||
params.put("userState", UserStateEnum.UN_PASS);
|
||||
setUpdateInfo(params);
|
||||
userDao.updateUserState(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateUserStateUnPass(List<String> userIds) {
|
||||
Map<String, Object> params = getHashMap(4);
|
||||
params.put("userId", userIds);
|
||||
params.put("userState", UserStateEnum.UN_PASS);
|
||||
setUpdateInfo(params);
|
||||
userDao.updateUserState(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UploadExcelResultDTO importExcel(MultipartFile excel) throws IOException {
|
||||
Map<String, Object> params = getHashMap(16);
|
||||
@ -421,6 +458,13 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listByUserState(Integer userState) {
|
||||
Map<String, Object> params = getHashMap(2);
|
||||
params.put("userState", userState);
|
||||
return list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> list(Map<String, Object> params) {
|
||||
return ArrayListUtil.deepClone(userDao.list(params), UserDTO.class);
|
||||
@ -440,6 +484,12 @@ public class UserServiceImpl extends DefaultBaseService implements IUserService
|
||||
return listPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserDTO>> listPageByUserState(Integer userState, ListPage page) {
|
||||
page.getParams().put("userState", userState);
|
||||
return listPage(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserDTO> listByIds(List<String> userIds, Map<String, Object> params) {
|
||||
params.put("userIds", userIds);
|
||||
|
@ -239,6 +239,29 @@
|
||||
user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 更新用户状态 -->
|
||||
<update id="updateUserState" parameterType="map">
|
||||
UPDATE
|
||||
sys_user
|
||||
SET
|
||||
user_state = #{userState},
|
||||
modifier = #{modifier},
|
||||
gmt_modified = #{gmtModified}
|
||||
WHERE
|
||||
is_delete = 0
|
||||
<if test="userId != null and userId != ''">
|
||||
AND
|
||||
user_id = #{userId}
|
||||
</if>
|
||||
<if test="userIds != null and userIds.size > 0">
|
||||
AND
|
||||
user_id IN
|
||||
<foreach collection="userIds" index="index" open="(" separator="," close=")">
|
||||
#{userIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<!-- 更新过期时间 -->
|
||||
<update id="updateExpiredDate" parameterType="map" flushCache="true">
|
||||
UPDATE
|
||||
@ -393,7 +416,11 @@
|
||||
user_email LIKE CONCAT('%', #{keywords}, '%')
|
||||
)
|
||||
</if>
|
||||
<if test="userType != null and userType != ''">
|
||||
<if test="userState != null">
|
||||
AND
|
||||
user_state = #{userState}
|
||||
</if>
|
||||
<if test="userType != null">
|
||||
AND
|
||||
user_type = #{userType}
|
||||
</if>
|
||||
|
@ -37,6 +37,15 @@
|
||||
<option value="3">公共用户</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-inline layui-form search-item">
|
||||
<select id="userState" name="userState" lay-filter="typeFilter">
|
||||
<option value="">选择类型</option>
|
||||
<option value="0">正常</option>
|
||||
<option value="1">锁定</option>
|
||||
<option value="-1">未审核</option>
|
||||
<option value="-2">审核不通过</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-btn-group">
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
@ -67,7 +76,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
<script th:inline="javascript">
|
||||
layui.config({
|
||||
base: 'assets/layuiadmin/'
|
||||
}).extend({
|
||||
@ -83,6 +92,7 @@
|
||||
var windowHeight = $(window).height();
|
||||
var resizeTimeout = null;
|
||||
var tableUrl = 'api/user/listpage';
|
||||
var expandOption = [[${expandOption}]];
|
||||
|
||||
// 初始化表格
|
||||
function initTable() {
|
||||
@ -112,13 +122,16 @@
|
||||
var value;
|
||||
switch (item.userState) {
|
||||
case 1:
|
||||
value = '<span class="layui-badge">冻结</span>';
|
||||
value = '<span class="layui-badge layui-bg-blue">锁定</span>';
|
||||
break;
|
||||
case 2:
|
||||
value = '<span class="layui-badge layui-bg-green">锁定</span>';
|
||||
case -1:
|
||||
value = '<span class="layui-badge layui-bg-gray">未审核</span>';
|
||||
break;
|
||||
case -2:
|
||||
value = '<span class="layui-badge">审核不通过</span>';
|
||||
break;
|
||||
default:
|
||||
value = '<span class="layui-badge layui-bg-blue">正常</span>';
|
||||
value = '<span class="layui-badge layui-bg-green">正常</span>';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
@ -193,6 +206,18 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
if(expandOption) {
|
||||
colsArray.push({
|
||||
field:'expandOpition', width: expandOption.width, title: expandOption.title, fixed: expandOption.fixed, align: expandOption.align, templet: function(item) {
|
||||
var btns = '<div class="layui-btn-group">';
|
||||
for(var i = 0, item; item = expandOption.btns[i++];) {
|
||||
btns += '<button type="button" class="layui-btn layui-btn-xs" lay-event="expandOpitionEvent" data-route="'+ item.route +'" data-title="'+ item.title +'">'+ item.title +'</button>';
|
||||
}
|
||||
btns += '</div>';
|
||||
return btns;
|
||||
}
|
||||
});
|
||||
}
|
||||
table.render({
|
||||
elem: '#dataTable',
|
||||
id: 'dataTable',
|
||||
@ -228,7 +253,8 @@
|
||||
keywords: $('#keywords').val(),
|
||||
startTime: $('#startTime').val(),
|
||||
endTime: $('#endTime').val(),
|
||||
userType: $('#userType').val()
|
||||
userType: $('#userType').val(),
|
||||
userState: $('#userState').val()
|
||||
},
|
||||
page: {
|
||||
curr: currentPage
|
||||
@ -387,6 +413,14 @@
|
||||
height: '80%',
|
||||
onClose: function() {}
|
||||
});
|
||||
} else if(layEvent === 'expandOpitionEvent') {
|
||||
top.dialog.open({
|
||||
url: top.restAjax.path('{userExpandOptionRoute}?userId={userId}', [this.dataset.route, data.userId]),
|
||||
title: '【'+ data.userName +'】'+ this.dataset.title,
|
||||
width: '60%',
|
||||
height: '80%',
|
||||
onClose: function() {}
|
||||
});
|
||||
}
|
||||
});
|
||||
// 事件-排序
|
||||
|
Loading…
Reference in New Issue
Block a user