parent
a572ac900d
commit
7c9e8d9d2e
@ -0,0 +1,90 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.excel.WSheet;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.module.system.ent.Dept;
|
||||
import ${basePackage}.module.system.mgr.DeptManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class DeptAjax{
|
||||
|
||||
@Autowired
|
||||
private DeptManager deptManager;
|
||||
|
||||
public DeptCreateResponse create(DeptCreateRequest request) {
|
||||
return deptManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptDeleteResponse delete(DeptDeleteRequest request) {
|
||||
return deptManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptUpdateResponse update(DeptUpdateRequest request) {
|
||||
return deptManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptFindResponse find(DeptFindRequest request) {
|
||||
return deptManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptGetResponse get(DeptGetRequest request) {
|
||||
return deptManager.get(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WSheet<>(Dept.class));
|
||||
}
|
||||
|
||||
public Object exports(TreeNode jsonParam) {
|
||||
DeptFindRequest request = MapperUtil.toJava(jsonParam, DeptFindRequest.class);
|
||||
DeptFindResponse response = deptManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WSheet<>(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
WSheet<Dept> sheet = new WSheet<>(file.getBytes(), Dept.class, new WSheet.Validator<Dept>() {
|
||||
@Override
|
||||
public List<String> validate(Dept o) {
|
||||
DeptCreateRequest request = MapperUtil.map(o, DeptCreateRequest.class);
|
||||
return ValidationUtil.validate(request);
|
||||
}
|
||||
});
|
||||
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException | ReadErrorException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.excel.WSheet;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.module.system.ent.Role;
|
||||
import ${basePackage}.module.system.mgr.RoleManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class RoleAjax{
|
||||
|
||||
@Autowired
|
||||
private RoleManager roleManager;
|
||||
|
||||
public RoleCreateResponse create(RoleCreateRequest request) {
|
||||
return roleManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleDeleteResponse delete(RoleDeleteRequest request) {
|
||||
return roleManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleUpdateResponse update(RoleUpdateRequest request) {
|
||||
return roleManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleFindResponse find(RoleFindRequest request) {
|
||||
return roleManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleGetResponse get(RoleGetRequest request) {
|
||||
return roleManager.get(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WSheet<>(Role.class));
|
||||
}
|
||||
|
||||
public Object exports(TreeNode jsonParam) {
|
||||
RoleFindRequest request = MapperUtil.toJava(jsonParam, RoleFindRequest.class);
|
||||
RoleFindResponse response = roleManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WSheet<>(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
WSheet<Role> sheet = new WSheet<>(file.getBytes(), Role.class, new WSheet.Validator<Role>() {
|
||||
@Override
|
||||
public List<String> validate(Role o) {
|
||||
RoleCreateRequest request = MapperUtil.map(o, RoleCreateRequest.class);
|
||||
return ValidationUtil.validate(request);
|
||||
}
|
||||
});
|
||||
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException | ReadErrorException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.excel.WSheet;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.module.system.ent.RoleResource;
|
||||
import ${basePackage}.module.system.mgr.RoleResourceManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class RoleResourceAjax{
|
||||
|
||||
@Autowired
|
||||
private RoleResourceManager roleResourceManager;
|
||||
|
||||
public RoleResourceCreateResponse create(RoleResourceCreateRequest request) {
|
||||
return roleResourceManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request) {
|
||||
return roleResourceManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request) {
|
||||
return roleResourceManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceFindResponse find(RoleResourceFindRequest request) {
|
||||
return roleResourceManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceGetResponse get(RoleResourceGetRequest request) {
|
||||
return roleResourceManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.excel.WSheet;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.module.system.ent.User;
|
||||
import ${basePackage}.module.system.mgr.UserManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class UserAjax{
|
||||
|
||||
@Autowired
|
||||
private UserManager userManager;
|
||||
|
||||
public UserCreateResponse create(UserCreateRequest request) {
|
||||
return userManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserDeleteResponse delete(UserDeleteRequest request) {
|
||||
return userManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserUpdateResponse update(UserUpdateRequest request) {
|
||||
return userManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserFindResponse find(UserFindRequest request) {
|
||||
return userManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserGetResponse get(UserGetRequest request) {
|
||||
return userManager.get(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public Object template(){
|
||||
return ResponseUtil.apply(new WSheet<>(User.class));
|
||||
}
|
||||
|
||||
public Object exports(TreeNode jsonParam) {
|
||||
UserFindRequest request = MapperUtil.toJava(jsonParam, UserFindRequest.class);
|
||||
UserFindResponse response = userManager.find(request, LocalData.getToken());
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
} else if (response.getTotalCount() == 0) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, "导出数据为空");
|
||||
return response;
|
||||
}
|
||||
return ResponseUtil.apply(new WSheet<>(response.getResult()));
|
||||
}
|
||||
|
||||
public Object imports(MultipartFile file) {
|
||||
BaseResponse baseResponse = new BaseResponse();
|
||||
try {
|
||||
WSheet<User> sheet = new WSheet<>(file.getBytes(), User.class, new WSheet.Validator<User>() {
|
||||
@Override
|
||||
public List<String> validate(User o) {
|
||||
UserCreateRequest request = MapperUtil.map(o, UserCreateRequest.class);
|
||||
return ValidationUtil.validate(request);
|
||||
}
|
||||
});
|
||||
|
||||
if (sheet.hasError()) {
|
||||
return ResponseUtil.apply(sheet.getBytes(), sheet.getName() + "-检查.xlsx");
|
||||
} else {
|
||||
return baseResponse;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.dumpException(e);
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, "上传文件出错");
|
||||
} catch (TemplateNotMatchException | ReadErrorException e) {
|
||||
baseResponse.addError(ErrorType.BUSINESS_ERROR, e.getMessage());
|
||||
}
|
||||
return baseResponse;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package ${basePackage}.action.ajax.system;
|
||||
|
||||
import com.fasterxml.jackson.core.TreeNode;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import ${basePackage}.frame.excel.WSheet;
|
||||
import ${basePackage}.frame.utils.LogUtil;
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.utils.ResponseUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.frame.excel.exception.ReadErrorException;
|
||||
import ${basePackage}.frame.excel.exception.TemplateNotMatchException;
|
||||
import ${basePackage}.module.system.ent.UserRole;
|
||||
import ${basePackage}.module.system.mgr.UserRoleManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public class UserRoleAjax{
|
||||
|
||||
@Autowired
|
||||
private UserRoleManager userRoleManager;
|
||||
|
||||
public UserRoleCreateResponse create(UserRoleCreateRequest request) {
|
||||
return userRoleManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request) {
|
||||
return userRoleManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleUpdateResponse update(UserRoleUpdateRequest request) {
|
||||
return userRoleManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleFindResponse find(UserRoleFindRequest request) {
|
||||
return userRoleManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleGetResponse get(UserRoleGetRequest request) {
|
||||
return userRoleManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ${basePackage}.action.api.system;
|
||||
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.module.system.mgr.DeptManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class DeptApi{
|
||||
|
||||
@Autowired
|
||||
private DeptManager deptManager;
|
||||
|
||||
public DeptCreateResponse create(DeptCreateRequest request) {
|
||||
return deptManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptDeleteResponse delete(DeptDeleteRequest request) {
|
||||
return deptManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptUpdateResponse update(DeptUpdateRequest request) {
|
||||
return deptManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptFindResponse find(DeptFindRequest request) {
|
||||
return deptManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public DeptGetResponse get(DeptGetRequest request) {
|
||||
return deptManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ${basePackage}.action.api.system;
|
||||
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.module.system.mgr.RoleManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class RoleApi{
|
||||
|
||||
@Autowired
|
||||
private RoleManager roleManager;
|
||||
|
||||
public RoleCreateResponse create(RoleCreateRequest request) {
|
||||
return roleManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleDeleteResponse delete(RoleDeleteRequest request) {
|
||||
return roleManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleUpdateResponse update(RoleUpdateRequest request) {
|
||||
return roleManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleFindResponse find(RoleFindRequest request) {
|
||||
return roleManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleGetResponse get(RoleGetRequest request) {
|
||||
return roleManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ${basePackage}.action.api.system;
|
||||
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.module.system.mgr.RoleResourceManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class RoleResourceApi{
|
||||
|
||||
@Autowired
|
||||
private RoleResourceManager roleResourceManager;
|
||||
|
||||
public RoleResourceCreateResponse create(RoleResourceCreateRequest request) {
|
||||
return roleResourceManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request) {
|
||||
return roleResourceManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request) {
|
||||
return roleResourceManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceFindResponse find(RoleResourceFindRequest request) {
|
||||
return roleResourceManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public RoleResourceGetResponse get(RoleResourceGetRequest request) {
|
||||
return roleResourceManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ${basePackage}.action.api.system;
|
||||
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.module.system.mgr.UserManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class UserApi{
|
||||
|
||||
@Autowired
|
||||
private UserManager userManager;
|
||||
|
||||
public UserCreateResponse create(UserCreateRequest request) {
|
||||
return userManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserDeleteResponse delete(UserDeleteRequest request) {
|
||||
return userManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserUpdateResponse update(UserUpdateRequest request) {
|
||||
return userManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserFindResponse find(UserFindRequest request) {
|
||||
return userManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserGetResponse get(UserGetRequest request) {
|
||||
return userManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package ${basePackage}.action.api.system;
|
||||
|
||||
import ${basePackage}.frame.auth.LocalData;
|
||||
import ${basePackage}.module.system.mgr.UserRoleManager;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class UserRoleApi{
|
||||
|
||||
@Autowired
|
||||
private UserRoleManager userRoleManager;
|
||||
|
||||
public UserRoleCreateResponse create(UserRoleCreateRequest request) {
|
||||
return userRoleManager.create(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request) {
|
||||
return userRoleManager.delete(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleUpdateResponse update(UserRoleUpdateRequest request) {
|
||||
return userRoleManager.update(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleFindResponse find(UserRoleFindRequest request) {
|
||||
return userRoleManager.find(request, LocalData.getToken());
|
||||
}
|
||||
|
||||
public UserRoleGetResponse get(UserRoleGetRequest request) {
|
||||
return userRoleManager.get(request, LocalData.getToken());
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package ${basePackage}.frame.utils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* RequestUtil
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2017-01-01
|
||||
*/
|
||||
public class RequestUtil {
|
||||
|
||||
/**
|
||||
* 获取请求放IP
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getIp(HttpServletRequest request) {
|
||||
String ip = request.getHeader("X-Forwarded-For");
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_CLIENT_IP");
|
||||
}
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
|
||||
}
|
||||
|
||||
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
|
||||
} else if (ip.length() > 15) {
|
||||
String[] ips = ip.split(",");
|
||||
for (int index = 0; index < ips.length; index++) {
|
||||
String strIp = (String) ips[index];
|
||||
if (!("unknown".equalsIgnoreCase(strIp))) {
|
||||
ip = strIp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取情况方客户端信息
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public static String getUserAgent(HttpServletRequest request) {
|
||||
return request.getHeader("User-Agent");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package ${basePackage}.module.system.ent;
|
||||
|
||||
import ${basePackage}.frame.excel.annotation.ColumnDescription;
|
||||
import ${basePackage}.frame.excel.annotation.ColumnName;
|
||||
import ${basePackage}.frame.excel.annotation.SheetName;
|
||||
import ${basePackage}.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* ROLE - 角色
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@SheetName("角色")
|
||||
public class Role extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ROLE_NAME - 角色名称
|
||||
*/
|
||||
@ColumnName("角色名称")
|
||||
@ColumnDescription("")
|
||||
private String roleName;
|
||||
/**
|
||||
* ROLE_CODE - 角色代码
|
||||
*/
|
||||
@ColumnName("角色代码")
|
||||
@ColumnDescription("")
|
||||
private String roleCode;
|
||||
/**
|
||||
* ROLE_COMMENT - 角色描述
|
||||
*/
|
||||
@ColumnName("角色描述")
|
||||
@ColumnDescription("")
|
||||
private String roleComment;
|
||||
|
||||
public String getRoleName() {
|
||||
return this.roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
public String getRoleCode() {
|
||||
return this.roleCode;
|
||||
}
|
||||
|
||||
public void setRoleCode(String roleCode) {
|
||||
this.roleCode = roleCode;
|
||||
}
|
||||
|
||||
public String getRoleComment() {
|
||||
return this.roleComment;
|
||||
}
|
||||
|
||||
public void setRoleComment(String roleComment) {
|
||||
this.roleComment = roleComment;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package ${basePackage}.module.system.ent;
|
||||
|
||||
import ${basePackage}.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* ROLE_RESOURCE - 角色资源关系
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public class RoleResource extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ROLE_ID - 角色主键
|
||||
*/
|
||||
private Long roleId;
|
||||
/**
|
||||
* RESOURCE_ID - 资源主键
|
||||
*/
|
||||
private Long resourceId;
|
||||
|
||||
public Long getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public Long getResourceId() {
|
||||
return this.resourceId;
|
||||
}
|
||||
|
||||
public void setResourceId(Long resourceId) {
|
||||
this.resourceId = resourceId;
|
||||
}
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
package ${basePackage}.module.system.ent;
|
||||
|
||||
import ${basePackage}.frame.excel.annotation.ColumnDescription;
|
||||
import ${basePackage}.frame.excel.annotation.ColumnName;
|
||||
import ${basePackage}.frame.excel.annotation.SheetName;
|
||||
import ${basePackage}.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* USER - 用户
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@SheetName("用户")
|
||||
public class User extends BaseEntity {
|
||||
|
||||
/**
|
||||
* USER_NAME - 用户账户
|
||||
*/
|
||||
@ColumnName("用户账户")
|
||||
@ColumnDescription("")
|
||||
private String userName;
|
||||
/**
|
||||
* USER_CODE - 用户代码
|
||||
*/
|
||||
@ColumnName("用户代码")
|
||||
@ColumnDescription("")
|
||||
private String userCode;
|
||||
/**
|
||||
* USER_ALIAS - 用户别名
|
||||
*/
|
||||
@ColumnName("用户别名")
|
||||
@ColumnDescription("")
|
||||
private String userAlias;
|
||||
/**
|
||||
* USER_PWD - 用户密码
|
||||
*/
|
||||
@ColumnName("用户密码")
|
||||
@ColumnDescription("")
|
||||
private String userPwd;
|
||||
/**
|
||||
* USER_STATUS - 用户状态
|
||||
*/
|
||||
@ColumnName("用户状态")
|
||||
@ColumnDescription("")
|
||||
private String userStatus;
|
||||
/**
|
||||
* DEPT_ID - 部门主键
|
||||
*/
|
||||
@ColumnName("部门主键")
|
||||
@ColumnDescription("")
|
||||
private Long deptId;
|
||||
/**
|
||||
* DEPT_CODE - 部门代码
|
||||
*/
|
||||
@ColumnName("部门代码")
|
||||
@ColumnDescription("")
|
||||
private String deptCode;
|
||||
/**
|
||||
* DEPT_NAME - 部门名称
|
||||
*/
|
||||
@ColumnName("部门名称")
|
||||
@ColumnDescription("")
|
||||
private String deptName;
|
||||
|
||||
public String getUserName() {
|
||||
return this.userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserCode() {
|
||||
return this.userCode;
|
||||
}
|
||||
|
||||
public void setUserCode(String userCode) {
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
public String getUserAlias() {
|
||||
return this.userAlias;
|
||||
}
|
||||
|
||||
public void setUserAlias(String userAlias) {
|
||||
this.userAlias = userAlias;
|
||||
}
|
||||
|
||||
public String getUserPwd() {
|
||||
return this.userPwd;
|
||||
}
|
||||
|
||||
public void setUserPwd(String userPwd) {
|
||||
this.userPwd = userPwd;
|
||||
}
|
||||
|
||||
public String getUserStatus() {
|
||||
return this.userStatus;
|
||||
}
|
||||
|
||||
public void setUserStatus(String userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return this.deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptCode() {
|
||||
return this.deptCode;
|
||||
}
|
||||
|
||||
public void setDeptCode(String deptCode) {
|
||||
this.deptCode = deptCode;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return this.deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package ${basePackage}.module.system.ent;
|
||||
|
||||
import ${basePackage}.frame.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* USER_ROLE - 用户角色授权
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public class UserRole extends BaseEntity {
|
||||
|
||||
/**
|
||||
* USER_ID - 用户主键
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* ROLE_ID - 角色主键
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
public Long getUserId() {
|
||||
return this.userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return this.roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public interface RoleManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleCreateResponse create(RoleCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleDeleteResponse delete(RoleDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleUpdateResponse update(RoleUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleFindResponse find(RoleFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleGetResponse get(RoleGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.frame.utils.IDgenerator;
|
||||
import ${basePackage}.frame.utils.Message;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.ent.Role;
|
||||
import ${basePackage}.module.system.mpr.RoleMapper;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* ROLE - 角色
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class RoleManagerImpl implements RoleManager {
|
||||
|
||||
@Autowired
|
||||
private RoleMapper roleMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleCreateResponse create(RoleCreateRequest request, Token token) {
|
||||
RoleCreateResponse response = new RoleCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
Role entity = MapperUtil.map(request, Role.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = roleMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleDeleteResponse delete(RoleDeleteRequest request, Token token) {
|
||||
RoleDeleteResponse response = new RoleDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = roleMapper.delete(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleUpdateResponse update(RoleUpdateRequest request, Token token) {
|
||||
RoleUpdateResponse response = new RoleUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = roleMapper.update(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public RoleFindResponse find(RoleFindRequest request, Token token) {
|
||||
RoleFindResponse response = new RoleFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<Role> pageInfo = new PageInfo<>(roleMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public RoleGetResponse get(RoleGetRequest request, Token token) {
|
||||
RoleGetResponse response = new RoleGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
Role po = roleMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setRole(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 角色资源关系
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public interface RoleResourceManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleResourceCreateResponse create(RoleResourceCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleResourceUpdateResponse update(RoleResourceUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleResourceFindResponse find(RoleResourceFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
RoleResourceGetResponse get(RoleResourceGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.frame.utils.IDgenerator;
|
||||
import ${basePackage}.frame.utils.Message;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.ent.RoleResource;
|
||||
import ${basePackage}.module.system.mpr.RoleResourceMapper;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* ROLE_RESOURCE - 角色资源关系
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class RoleResourceManagerImpl implements RoleResourceManager {
|
||||
|
||||
@Autowired
|
||||
private RoleResourceMapper roleResourceMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleResourceCreateResponse create(RoleResourceCreateRequest request, Token token) {
|
||||
RoleResourceCreateResponse response = new RoleResourceCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
RoleResource entity = MapperUtil.map(request, RoleResource.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = roleResourceMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleResourceDeleteResponse delete(RoleResourceDeleteRequest request, Token token) {
|
||||
RoleResourceDeleteResponse response = new RoleResourceDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = roleResourceMapper.delete(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public RoleResourceUpdateResponse update(RoleResourceUpdateRequest request, Token token) {
|
||||
RoleResourceUpdateResponse response = new RoleResourceUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = roleResourceMapper.update(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public RoleResourceFindResponse find(RoleResourceFindRequest request, Token token) {
|
||||
RoleResourceFindResponse response = new RoleResourceFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<RoleResource> pageInfo = new PageInfo<>(roleResourceMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public RoleResourceGetResponse get(RoleResourceGetRequest request, Token token) {
|
||||
RoleResourceGetResponse response = new RoleResourceGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
RoleResource po = roleResourceMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setRoleResource(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public interface UserManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserCreateResponse create(UserCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserDeleteResponse delete(UserDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserUpdateResponse update(UserUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserFindResponse find(UserFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserGetResponse get(UserGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.frame.utils.IDgenerator;
|
||||
import ${basePackage}.frame.utils.Message;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.ent.User;
|
||||
import ${basePackage}.module.system.mpr.UserMapper;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* USER - 用户
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class UserManagerImpl implements UserManager {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserCreateResponse create(UserCreateRequest request, Token token) {
|
||||
UserCreateResponse response = new UserCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
User entity = MapperUtil.map(request, User.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = userMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserDeleteResponse delete(UserDeleteRequest request, Token token) {
|
||||
UserDeleteResponse response = new UserDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = userMapper.delete(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserUpdateResponse update(UserUpdateRequest request, Token token) {
|
||||
UserUpdateResponse response = new UserUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = userMapper.update(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public UserFindResponse find(UserFindRequest request, Token token) {
|
||||
UserFindResponse response = new UserFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<User> pageInfo = new PageInfo<>(userMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public UserGetResponse get(UserGetRequest request, Token token) {
|
||||
UserGetResponse response = new UserGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
User po = userMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setUser(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* 用户角色授权
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public interface UserRoleManager {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserRoleCreateResponse create(UserRoleCreateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserRoleDeleteResponse delete(UserRoleDeleteRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserRoleUpdateResponse update(UserRoleUpdateRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserRoleFindResponse find(UserRoleFindRequest request, Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return
|
||||
*/
|
||||
UserRoleGetResponse get(UserRoleGetRequest request, Token token);
|
||||
}
|
@ -0,0 +1,167 @@
|
||||
package ${basePackage}.module.system.mgr;
|
||||
|
||||
import ${basePackage}.frame.utils.IDgenerator;
|
||||
import ${basePackage}.frame.utils.Message;
|
||||
import ${basePackage}.frame.base.ErrorType;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
import ${basePackage}.frame.utils.MapperUtil;
|
||||
import ${basePackage}.frame.utils.ValidationUtil;
|
||||
import ${basePackage}.module.system.ent.UserRole;
|
||||
import ${basePackage}.module.system.mpr.UserRoleMapper;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.module.system.rsp.*;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* USER_ROLE - 用户角色授权
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
@Transactional
|
||||
@Service
|
||||
public class UserRoleManagerImpl implements UserRoleManager {
|
||||
|
||||
@Autowired
|
||||
private UserRoleMapper userRoleMapper;
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserRoleCreateResponse create(UserRoleCreateRequest request, Token token) {
|
||||
UserRoleCreateResponse response = new UserRoleCreateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long id = IDgenerator.nextId();
|
||||
UserRole entity = MapperUtil.map(request, UserRole.class);
|
||||
entity.setId(id);
|
||||
|
||||
long result = userRoleMapper.insert(entity, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.CREATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setId(id);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserRoleDeleteResponse delete(UserRoleDeleteRequest request, Token token) {
|
||||
UserRoleDeleteResponse response = new UserRoleDeleteResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = userRoleMapper.delete(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.DELETE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
public UserRoleUpdateResponse update(UserRoleUpdateRequest request, Token token) {
|
||||
UserRoleUpdateResponse response = new UserRoleUpdateResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
long result = userRoleMapper.update(request, token);
|
||||
if (1L != result) {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.UPDATE_FAILURE);
|
||||
return response;
|
||||
}
|
||||
response.setResult(result);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public UserRoleFindResponse find(UserRoleFindRequest request, Token token) {
|
||||
UserRoleFindResponse response = new UserRoleFindResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
||||
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
||||
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
||||
}
|
||||
PageInfo<UserRole> pageInfo = new PageInfo<>(userRoleMapper.find(request, token));
|
||||
|
||||
response.setResult(pageInfo.getList());
|
||||
response.setTotalCount(pageInfo.getTotal());
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 响应
|
||||
*/
|
||||
@Transactional(readOnly = true)
|
||||
public UserRoleGetResponse get(UserRoleGetRequest request, Token token) {
|
||||
UserRoleGetResponse response = new UserRoleGetResponse();
|
||||
|
||||
ValidationUtil.validate(request, response);
|
||||
if (response.hasError()) {
|
||||
return response;
|
||||
}
|
||||
|
||||
UserRole po = userRoleMapper.get(request, token);
|
||||
|
||||
if (po != null) {
|
||||
response.setUserRole(po);
|
||||
} else {
|
||||
response.addError(ErrorType.BUSINESS_ERROR, Message.GET_FAILURE);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package ${basePackage}.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${basePackage}.module.system.ent.Role;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* ROLE - 角色
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2019-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") Role request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<Role> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") RoleDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") RoleUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<Role> find(@Param("request") RoleFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
Role get(@Param("request") RoleGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
<?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="${basePackage}.module.system.mpr.RoleMapper">
|
||||
|
||||
<sql id="table">`SYS_ROLE`</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
`ID`,`ROLE_NAME`,`ROLE_CODE`,`ROLE_COMMENT`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
|
||||
</sql>
|
||||
|
||||
<resultMap id="role" type="${basePackage}.module.system.ent.Role">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="ROLE_NAME" jdbcType="VARCHAR" property="roleName"/>
|
||||
<result column="ROLE_CODE" jdbcType="VARCHAR" property="roleCode"/>
|
||||
<result column="ROLE_COMMENT" jdbcType="VARCHAR" property="roleComment"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="role">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.roleName != null and request.roleName != ''">
|
||||
AND `ROLE_NAME` = ${r"#"}{request.roleName}
|
||||
</if>
|
||||
<if test="request.roleCode != null and request.roleCode != ''">
|
||||
AND `ROLE_CODE` = ${r"#"}{request.roleCode}
|
||||
</if>
|
||||
<if test="request.roleComment != null and request.roleComment != ''">
|
||||
AND `ROLE_COMMENT` = ${r"#"}{request.roleComment}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="role">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
${r"#"}{request.id},
|
||||
${r"#"}{request.roleName,jdbcType=VARCHAR},
|
||||
${r"#"}{request.roleCode,jdbcType=VARCHAR},
|
||||
${r"#"}{request.roleComment,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
${r"#"}{item.id},
|
||||
${r"#"}{item.roleName,jdbcType=VARCHAR},
|
||||
${r"#"}{item.roleCode,jdbcType=VARCHAR},
|
||||
${r"#"}{item.roleComment,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET `IS_DELETED` = 1
|
||||
WHERE `IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
`ROLE_NAME` = ${r"#"}{request.roleName,jdbcType=VARCHAR},
|
||||
`ROLE_CODE` = ${r"#"}{request.roleCode,jdbcType=VARCHAR},
|
||||
`ROLE_COMMENT` = ${r"#"}{request.roleComment,jdbcType=VARCHAR},
|
||||
`ROW_VERSION` = `ROW_VERSION` + 1,
|
||||
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
|
||||
`LAST_UPDATE_TIME` = sysdate()
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="role">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,74 @@
|
||||
package ${basePackage}.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${basePackage}.module.system.ent.RoleResource;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* ROLE_RESOURCE - 角色资源关系
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2019-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoleResourceMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") RoleResource request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<RoleResource> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") RoleResourceDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") RoleResourceUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<RoleResource> find(@Param("request") RoleResourceFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
RoleResource get(@Param("request") RoleResourceGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<?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="${basePackage}.module.system.mpr.RoleResourceMapper">
|
||||
|
||||
<sql id="table">`SYS_ROLE_RESOURCE`</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
`ID`,`ROLE_ID`,`RESOURCE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
|
||||
</sql>
|
||||
|
||||
<resultMap id="roleResource" type="${basePackage}.module.system.ent.RoleResource">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
|
||||
<result column="RESOURCE_ID" jdbcType="BIGINT" property="resourceId"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="roleResource">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.roleId != null and request.roleId != 0">
|
||||
AND `ROLE_ID` = ${r"#"}{request.roleId}
|
||||
</if>
|
||||
<if test="request.resourceId != null and request.resourceId != 0">
|
||||
AND `RESOURCE_ID` = ${r"#"}{request.resourceId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="roleResource">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
${r"#"}{request.id},
|
||||
${r"#"}{request.roleId,jdbcType=BIGINT},
|
||||
${r"#"}{request.resourceId,jdbcType=BIGINT},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
${r"#"}{item.id},
|
||||
${r"#"}{item.roleId,jdbcType=BIGINT},
|
||||
${r"#"}{item.resourceId,jdbcType=BIGINT},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET `IS_DELETED` = 1
|
||||
WHERE `IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
`ROLE_ID` = ${r"#"}{request.roleId,jdbcType=BIGINT},
|
||||
`RESOURCE_ID` = ${r"#"}{request.resourceId,jdbcType=BIGINT},
|
||||
`ROW_VERSION` = `ROW_VERSION` + 1,
|
||||
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
|
||||
`LAST_UPDATE_TIME` = sysdate()
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="roleResource">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,74 @@
|
||||
package ${basePackage}.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${basePackage}.module.system.ent.User;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* USER - 用户
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2019-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") User request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<User> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") UserDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") UserUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<User> find(@Param("request") UserFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
User get(@Param("request") UserGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -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="${basePackage}.module.system.mpr.UserMapper">
|
||||
|
||||
<sql id="table">`SYS_USER`</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
`ID`,`USER_NAME`,`USER_CODE`,`USER_ALIAS`,`USER_PWD`,`USER_STATUS`,`DEPT_ID`,`DEPT_CODE`,`DEPT_NAME`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
|
||||
</sql>
|
||||
|
||||
<resultMap id="user" type="${basePackage}.module.system.ent.User">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="USER_NAME" jdbcType="VARCHAR" property="userName"/>
|
||||
<result column="USER_CODE" jdbcType="VARCHAR" property="userCode"/>
|
||||
<result column="USER_ALIAS" jdbcType="VARCHAR" property="userAlias"/>
|
||||
<result column="USER_PWD" jdbcType="VARCHAR" property="userPwd"/>
|
||||
<result column="USER_STATUS" jdbcType="VARCHAR" property="userStatus"/>
|
||||
<result column="DEPT_ID" jdbcType="BIGINT" property="deptId"/>
|
||||
<result column="DEPT_CODE" jdbcType="VARCHAR" property="deptCode"/>
|
||||
<result column="DEPT_NAME" jdbcType="VARCHAR" property="deptName"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="user">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.userName != null and request.userName != ''">
|
||||
AND `USER_NAME` = ${r"#"}{request.userName}
|
||||
</if>
|
||||
<if test="request.userCode != null and request.userCode != ''">
|
||||
AND `USER_CODE` = ${r"#"}{request.userCode}
|
||||
</if>
|
||||
<if test="request.userAlias != null and request.userAlias != ''">
|
||||
AND `USER_ALIAS` = ${r"#"}{request.userAlias}
|
||||
</if>
|
||||
<if test="request.userStatus != null and request.userStatus != ''">
|
||||
AND `USER_STATUS` = ${r"#"}{request.userStatus}
|
||||
</if>
|
||||
<if test="request.deptId != null and request.deptId != 0">
|
||||
AND `DEPT_ID` = ${r"#"}{request.deptId}
|
||||
</if>
|
||||
<if test="request.deptCode != null and request.deptCode != ''">
|
||||
AND `DEPT_CODE` = ${r"#"}{request.deptCode}
|
||||
</if>
|
||||
<if test="request.deptName != null and request.deptName != ''">
|
||||
AND `DEPT_NAME` = ${r"#"}{request.deptName}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="user">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
${r"#"}{request.id},
|
||||
${r"#"}{request.userName,jdbcType=VARCHAR},
|
||||
${r"#"}{request.userCode,jdbcType=VARCHAR},
|
||||
${r"#"}{request.userAlias,jdbcType=VARCHAR},
|
||||
${r"#"}{request.userPwd,jdbcType=VARCHAR},
|
||||
${r"#"}{request.userStatus,jdbcType=VARCHAR},
|
||||
${r"#"}{request.deptId,jdbcType=BIGINT},
|
||||
${r"#"}{request.deptCode,jdbcType=VARCHAR},
|
||||
${r"#"}{request.deptName,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
${r"#"}{item.id},
|
||||
${r"#"}{item.userName,jdbcType=VARCHAR},
|
||||
${r"#"}{item.userCode,jdbcType=VARCHAR},
|
||||
${r"#"}{item.userAlias,jdbcType=VARCHAR},
|
||||
${r"#"}{item.userPwd,jdbcType=VARCHAR},
|
||||
${r"#"}{item.userStatus,jdbcType=VARCHAR},
|
||||
${r"#"}{item.deptId,jdbcType=BIGINT},
|
||||
${r"#"}{item.deptCode,jdbcType=VARCHAR},
|
||||
${r"#"}{item.deptName,jdbcType=VARCHAR},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET `IS_DELETED` = 1
|
||||
WHERE `IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
`USER_NAME` = ${r"#"}{request.userName,jdbcType=VARCHAR},
|
||||
`USER_CODE` = ${r"#"}{request.userCode,jdbcType=VARCHAR},
|
||||
`USER_ALIAS` = ${r"#"}{request.userAlias,jdbcType=VARCHAR},
|
||||
`USER_PWD` = ${r"#"}{request.userPwd,jdbcType=VARCHAR},
|
||||
`USER_STATUS` = ${r"#"}{request.userStatus,jdbcType=VARCHAR},
|
||||
`DEPT_ID` = ${r"#"}{request.deptId,jdbcType=BIGINT},
|
||||
`DEPT_CODE` = ${r"#"}{request.deptCode,jdbcType=VARCHAR},
|
||||
`DEPT_NAME` = ${r"#"}{request.deptName,jdbcType=VARCHAR},
|
||||
`ROW_VERSION` = `ROW_VERSION` + 1,
|
||||
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
|
||||
`LAST_UPDATE_TIME` = sysdate()
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="user">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,74 @@
|
||||
package ${basePackage}.module.system.mpr;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ${basePackage}.module.system.ent.UserRole;
|
||||
import ${basePackage}.module.system.req.*;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* USER_ROLE - 用户角色授权
|
||||
*
|
||||
* @author wangbing
|
||||
* @date 2019-12-20
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserRoleMapper {
|
||||
|
||||
/**
|
||||
* 插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insert(@Param("request") UserRole request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long insertBatch(@Param("list") List<UserRole> request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long delete(@Param("request") UserRoleDeleteRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回数量
|
||||
*/
|
||||
long update(@Param("request") UserRoleUpdateRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
List<UserRole> find(@Param("request") UserRoleFindRequest request, @Param("token") Token token);
|
||||
|
||||
/**
|
||||
* 获得对象
|
||||
*
|
||||
* @param request 请求对象
|
||||
* @param token 令牌
|
||||
* @return 返回对象
|
||||
*/
|
||||
UserRole get(@Param("request") UserRoleGetRequest request, @Param("token") Token token);
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
<?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="${basePackage}.module.system.mpr.UserRoleMapper">
|
||||
|
||||
<sql id="table">`SYS_USER_ROLE`</sql>
|
||||
|
||||
<sql id="entityColumnList">
|
||||
`ID`,`USER_ID`,`ROLE_ID`,`ROW_VERSION`,`IS_DELETED`,`CREATE_BY`,`CREATE_TIME`,`LAST_UPDATE_BY`,`LAST_UPDATE_TIME`
|
||||
</sql>
|
||||
|
||||
<resultMap id="userRole" type="${basePackage}.module.system.ent.UserRole">
|
||||
<result column="ID" jdbcType="BIGINT" property="id"/>
|
||||
<result column="USER_ID" jdbcType="BIGINT" property="userId"/>
|
||||
<result column="ROLE_ID" jdbcType="BIGINT" property="roleId"/>
|
||||
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
||||
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
||||
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
||||
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
||||
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="find" resultMap="userRole">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.userId != null and request.userId != 0">
|
||||
AND `USER_ID` = ${r"#"}{request.userId}
|
||||
</if>
|
||||
<if test="request.roleId != null and request.roleId != 0">
|
||||
AND `ROLE_ID` = ${r"#"}{request.roleId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="search" resultMap="userRole">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
<if test="request.keyword != null and request.keyword != ''">
|
||||
1 = 2
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
${r"#"}{request.id},
|
||||
${r"#"}{request.userId,jdbcType=BIGINT},
|
||||
${r"#"}{request.roleId,jdbcType=BIGINT},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch">
|
||||
INSERT INTO
|
||||
<include refid="table"/>
|
||||
(
|
||||
<include refid="entityColumnList"/>
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item= "item" index ="index" separator=",">
|
||||
(
|
||||
${r"#"}{item.id},
|
||||
${r"#"}{item.userId,jdbcType=BIGINT},
|
||||
${r"#"}{item.roleId,jdbcType=BIGINT},
|
||||
0,
|
||||
0,
|
||||
${r"#"}{token.userId,jdbcType=NUMERIC},
|
||||
sysdate(),
|
||||
NULL,
|
||||
NULL
|
||||
)
|
||||
</foreach >
|
||||
</insert>
|
||||
|
||||
<update id="delete">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET `IS_DELETED` = 1
|
||||
WHERE `IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</update>
|
||||
|
||||
<update id="update">
|
||||
UPDATE
|
||||
<include refid="table"/>
|
||||
SET
|
||||
`USER_ID` = ${r"#"}{request.userId,jdbcType=BIGINT},
|
||||
`ROLE_ID` = ${r"#"}{request.roleId,jdbcType=BIGINT},
|
||||
`ROW_VERSION` = `ROW_VERSION` + 1,
|
||||
`LAST_UPDATE_BY` = ${r"#"}{token.userId},
|
||||
`LAST_UPDATE_TIME` = sysdate()
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
AND `ROW_VERSION` = ${r"#"}{request.rowVersion}
|
||||
</update>
|
||||
|
||||
<select id="get" resultMap="userRole">
|
||||
SELECT
|
||||
<include refid="entityColumnList"/>
|
||||
FROM
|
||||
<include refid="table"/>
|
||||
WHERE
|
||||
`IS_DELETED` = 0
|
||||
AND `ID` = ${r"#"}{request.id}
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,30 @@
|
||||
package ${basePackage}.module.system.req;
|
||||
|
||||
import ${basePackage}.frame.base.BaseFindRequest;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* TokensRequest - 通行证查询
|
||||
*
|
||||
* @author wangbing
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-20
|
||||
*/
|
||||
public class TokensBuildRequest extends BaseFindRequest {
|
||||
|
||||
/**
|
||||
* 登录令牌
|
||||
*/
|
||||
@NotBlank(message = "登录令牌不能为空")
|
||||
private String token;
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package ${basePackage}.module.system.rsp;
|
||||
|
||||
import ${basePackage}.frame.base.BaseResponse;
|
||||
import ${basePackage}.frame.base.Token;
|
||||
|
||||
/**
|
||||
* TokensGetResponse - 通行证
|
||||
*
|
||||
* @author author
|
||||
* @version 0.0.1
|
||||
* @since 2019-12-19
|
||||
*/
|
||||
public class TokensBuildResponse extends BaseResponse {
|
||||
|
||||
/**
|
||||
* 通行证
|
||||
*/
|
||||
private Token token;
|
||||
|
||||
public Token getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(Token token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
@ -0,0 +1,271 @@
|
||||
<div id="app" v-cloak>
|
||||
<el-card class="box-card search">
|
||||
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
|
||||
<el-form-item label="部门代码" prop="deptCode">
|
||||
<el-input v-model="vm.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="vm.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门别名" prop="deptAlias">
|
||||
<el-input v-model="vm.deptAlias" clearable size="small" placeholder="请输入部门别名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父部门代码" prop="supCode">
|
||||
<el-input v-model="vm.supCode" clearable size="small" placeholder="请输入父部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父部门名称" prop="supName">
|
||||
<el-input v-model="vm.supName" clearable size="small" placeholder="请输入父部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否有效" prop="valid">
|
||||
<el-radio-group v-model="vm.valid" clearable size="small">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
||||
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
||||
|
||||
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
|
||||
|
||||
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
|
||||
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
|
||||
<el-form-item label="部门代码" prop="deptCode">
|
||||
<el-input v-model="form.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门别名" prop="deptAlias">
|
||||
<el-input v-model="form.deptAlias" clearable size="small" placeholder="请输入部门别名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父部门代码" prop="supCode">
|
||||
<el-input v-model="form.supCode" clearable size="small" placeholder="请输入父部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="父部门名称" prop="supName">
|
||||
<el-input v-model="form.supName" clearable size="small" placeholder="请输入父部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="是否有效" prop="valid">
|
||||
<el-radio-group v-model="form.valid" clearable size="small">
|
||||
<el-radio :label="true">是</el-radio>
|
||||
<el-radio :label="false">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="form.dialog = false">取 消</el-button>
|
||||
<el-button size="small" type="primary" @click="onSave">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-button-group style="float: right;">
|
||||
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
|
||||
</el-tooltip>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
style="margin-top: 10px"
|
||||
@selection-change="onSelectionChange"
|
||||
empty-text="无数据"
|
||||
:data="result"
|
||||
size="mini"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
align="center"
|
||||
type="selection"
|
||||
width="40">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="主键"
|
||||
width="140">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptCode"
|
||||
label="部门代码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptName"
|
||||
label="部门名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptAlias"
|
||||
label="部门别名">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="supCode"
|
||||
label="父部门代码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="supName"
|
||||
label="父部门名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="valid"
|
||||
label="是否有效">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="140"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
|
||||
@command="onCommand">
|
||||
<i class="el-icon-edit"></i>编辑
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
background
|
||||
v-if="vm.totalCount > vm.pageSize"
|
||||
style="margin-top: 10px"
|
||||
@current-change="onPage"
|
||||
:current-page="vm.pageNumber"
|
||||
:page-size="vm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="vm.totalCount">
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
mixins: [mixin],
|
||||
el: "#app",
|
||||
data: {
|
||||
module: 'system',
|
||||
target: 'dept',
|
||||
vm: {//条件及分页参数
|
||||
deptCode: "",
|
||||
deptName: "",
|
||||
deptAlias: "",
|
||||
supCode: "",
|
||||
supName: "",
|
||||
valid: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
sortKey:'CREATE_TIME',
|
||||
sortType:'DESC'
|
||||
},
|
||||
form: {//待提交表单
|
||||
title: "",
|
||||
dialog: false,
|
||||
id: '',
|
||||
deptCode: "",
|
||||
deptName: "",
|
||||
deptAlias: "",
|
||||
supCode: "",
|
||||
supName: "",
|
||||
valid: "",
|
||||
rowVersion: ""
|
||||
},
|
||||
formRules: {
|
||||
deptCode: [
|
||||
{required: true, message: '部门代码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '部门代码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
deptName: [
|
||||
{required: true, message: '部门名称不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 100, message: '部门名称长度在 1 到 100 个字符', trigger: 'blur'}
|
||||
],
|
||||
deptAlias: [
|
||||
{min: 1, max: 50, message: '部门别名长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
supCode: [
|
||||
{min: 1, max: 50, message: '父部门代码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
supName: [
|
||||
{min: 1, max: 100, message: '父部门名称长度在 1 到 100 个字符', trigger: 'blur'}
|
||||
],
|
||||
valid: [
|
||||
{required: true, message: '是否有效不能为空', trigger: 'blur'},
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreate: function () {
|
||||
this.form.title = "部门新增";
|
||||
this.form.dialog = true;
|
||||
this.form.id = "";
|
||||
this.form.deptCode = "";
|
||||
this.form.deptName = "";
|
||||
this.form.deptAlias = "";
|
||||
this.form.supCode = "";
|
||||
this.form.supName = "";
|
||||
this.form.valid = "";
|
||||
},
|
||||
onCommand: function (arg) {
|
||||
const cmd = arg[0];
|
||||
const item = arg[1];
|
||||
switch (cmd) {
|
||||
case "edit":
|
||||
this.form.title = "部门编辑";
|
||||
this.form.dialog = true;
|
||||
this.form.id = item.id;
|
||||
this.form.deptCode = item.deptCode;
|
||||
this.form.deptName = item.deptName;
|
||||
this.form.deptAlias = item.deptAlias;
|
||||
this.form.supCode = item.supCode;
|
||||
this.form.supName = item.supName;
|
||||
this.form.valid = item.valid;
|
||||
this.form.rowVersion = item.rowVersion;
|
||||
break;
|
||||
case "delete":
|
||||
this.onDelete(item);
|
||||
break;
|
||||
default:
|
||||
this.w("未找到对应的命令");
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.onFind();
|
||||
},
|
||||
})
|
||||
</script>
|
@ -0,0 +1,211 @@
|
||||
<div id="app" v-cloak>
|
||||
<el-card class="box-card search">
|
||||
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
|
||||
<el-form-item label="角色名称" prop="roleName">
|
||||
<el-input v-model="vm.roleName" clearable size="small" placeholder="请输入角色名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色代码" prop="roleCode">
|
||||
<el-input v-model="vm.roleCode" clearable size="small" placeholder="请输入角色代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色描述" prop="roleComment">
|
||||
<el-input v-model="vm.roleComment" clearable size="small" placeholder="请输入角色描述"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
||||
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
||||
|
||||
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
|
||||
|
||||
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
|
||||
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
|
||||
<el-form-item label="角色名称" prop="roleName">
|
||||
<el-input v-model="form.roleName" clearable size="small" placeholder="请输入角色名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色代码" prop="roleCode">
|
||||
<el-input v-model="form.roleCode" clearable size="small" placeholder="请输入角色代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="角色描述" prop="roleComment">
|
||||
<el-input v-model="form.roleComment" clearable size="small" placeholder="请输入角色描述"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="form.dialog = false">取 消</el-button>
|
||||
<el-button size="small" type="primary" @click="onSave">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-button-group style="float: right;">
|
||||
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
|
||||
</el-tooltip>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
style="margin-top: 10px"
|
||||
@selection-change="onSelectionChange"
|
||||
empty-text="无数据"
|
||||
:data="result"
|
||||
size="mini"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
align="center"
|
||||
type="selection"
|
||||
width="40">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="主键"
|
||||
width="140">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="roleName"
|
||||
label="角色名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="roleCode"
|
||||
label="角色代码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="roleComment"
|
||||
label="角色描述">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="140"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
|
||||
@command="onCommand">
|
||||
<i class="el-icon-edit"></i>编辑
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
background
|
||||
v-if="vm.totalCount > vm.pageSize"
|
||||
style="margin-top: 10px"
|
||||
@current-change="onPage"
|
||||
:current-page="vm.pageNumber"
|
||||
:page-size="vm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="vm.totalCount">
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
mixins: [mixin],
|
||||
el: "#app",
|
||||
data: {
|
||||
module: 'system',
|
||||
target: 'role',
|
||||
vm: {//条件及分页参数
|
||||
roleName: "",
|
||||
roleCode: "",
|
||||
roleComment: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
sortKey:'CREATE_TIME',
|
||||
sortType:'DESC'
|
||||
},
|
||||
form: {//待提交表单
|
||||
title: "",
|
||||
dialog: false,
|
||||
id: '',
|
||||
roleName: "",
|
||||
roleCode: "",
|
||||
roleComment: "",
|
||||
rowVersion: ""
|
||||
},
|
||||
formRules: {
|
||||
roleName: [
|
||||
{required: true, message: '角色名称不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '角色名称长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
roleCode: [
|
||||
{required: true, message: '角色代码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '角色代码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
roleComment: [
|
||||
{min: 1, max: 50, message: '角色描述长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreate: function () {
|
||||
this.form.title = "角色新增";
|
||||
this.form.dialog = true;
|
||||
this.form.id = "";
|
||||
this.form.roleName = "";
|
||||
this.form.roleCode = "";
|
||||
this.form.roleComment = "";
|
||||
},
|
||||
onCommand: function (arg) {
|
||||
const cmd = arg[0];
|
||||
const item = arg[1];
|
||||
switch (cmd) {
|
||||
case "edit":
|
||||
this.form.title = "角色编辑";
|
||||
this.form.dialog = true;
|
||||
this.form.id = item.id;
|
||||
this.form.roleName = item.roleName;
|
||||
this.form.roleCode = item.roleCode;
|
||||
this.form.roleComment = item.roleComment;
|
||||
this.form.rowVersion = item.rowVersion;
|
||||
break;
|
||||
case "delete":
|
||||
this.onDelete(item);
|
||||
break;
|
||||
default:
|
||||
this.w("未找到对应的命令");
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.onFind();
|
||||
},
|
||||
})
|
||||
</script>
|
@ -0,0 +1,297 @@
|
||||
<div id="app" v-cloak>
|
||||
<el-card class="box-card search">
|
||||
<el-form :inline="true" :model="vm" ref="vm" label-position="left" label-width="90px">
|
||||
<el-form-item label="用户账户" prop="userName">
|
||||
<el-input v-model="vm.userName" clearable size="small" placeholder="请输入用户账户"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户代码" prop="userCode">
|
||||
<el-input v-model="vm.userCode" clearable size="small" placeholder="请输入用户代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户别名" prop="userAlias">
|
||||
<el-input v-model="vm.userAlias" clearable size="small" placeholder="请输入用户别名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户状态" prop="userStatus">
|
||||
<el-input-dict v-model="vm.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门主键" prop="deptId">
|
||||
<el-input-number v-model="vm.deptId" clearable size="small" placeholder="请输入部门主键" :step="1" step-strictly></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门代码" prop="deptCode">
|
||||
<el-input v-model="vm.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="vm.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="onSearch">搜索</el-button>
|
||||
<el-button type="warning" size="small" icon="el-icon-refresh-left" @click="onReset('vm')">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<el-card class="box-card">
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-button type="success" size="small" icon="el-icon-plus" @click="onCreate">新增</el-button>
|
||||
|
||||
<el-button type="warning" size="small" icon="el-icon-download" @click="onExport">导出</el-button>
|
||||
|
||||
<el-dialog class="form" :title="form.title" :visible.sync="form.dialog">
|
||||
<el-form :model="form" :inline="true" :rules="formRules" ref="form" label-position="left" label-width="90px">
|
||||
<el-form-item label="用户账户" prop="userName">
|
||||
<el-input v-model="form.userName" clearable size="small" placeholder="请输入用户账户"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户代码" prop="userCode">
|
||||
<el-input v-model="form.userCode" clearable size="small" placeholder="请输入用户代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户别名" prop="userAlias">
|
||||
<el-input v-model="form.userAlias" clearable size="small" placeholder="请输入用户别名"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户密码" prop="userPwd">
|
||||
<el-input v-model="form.userPwd" clearable size="small" placeholder="请输入用户密码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="用户状态" prop="userStatus">
|
||||
<el-input-dict v-model="form.userStatus" clearable size="small" placeholder="请输入用户状态" dict-name="USER_STATUS" ></el-input-dict>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门主键" prop="deptId">
|
||||
<el-input-number v-model="form.deptId" clearable size="small" placeholder="请输入部门主键" :step="1" step-strictly></el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门代码" prop="deptCode">
|
||||
<el-input v-model="form.deptCode" clearable size="small" placeholder="请输入部门代码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="部门名称" prop="deptName">
|
||||
<el-input v-model="form.deptName" clearable size="small" placeholder="请输入部门名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button size="small" @click="form.dialog = false">取 消</el-button>
|
||||
<el-button size="small" type="primary" @click="onSave">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-button-group style="float: right;">
|
||||
<el-tooltip effect="dark" content="Excel模板下载" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-date" @click="onTemplate"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="Excel导入" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-upload2" @click="onImport"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="批量删除" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-delete" @click="onBitchDelete"></el-button>
|
||||
</el-tooltip>
|
||||
|
||||
<el-tooltip effect="dark" content="刷新" placement="bottom">
|
||||
<el-button size="small" icon="el-icon-refresh" @click="onFind"></el-button>
|
||||
</el-tooltip>
|
||||
</el-button-group>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
style="margin-top: 10px"
|
||||
@selection-change="onSelectionChange"
|
||||
empty-text="无数据"
|
||||
:data="result"
|
||||
size="mini"
|
||||
style="width: 100%">
|
||||
<el-table-column
|
||||
align="center"
|
||||
type="selection"
|
||||
width="40">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="id"
|
||||
label="主键"
|
||||
width="140">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userName"
|
||||
label="用户账户">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userCode"
|
||||
label="用户代码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userAlias"
|
||||
label="用户别名">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userPwd"
|
||||
label="用户密码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="userStatus"
|
||||
label="用户状态">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptId"
|
||||
label="部门主键">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptCode"
|
||||
label="部门代码">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="deptName"
|
||||
label="部门名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
prop="createTime"
|
||||
width="140"
|
||||
label="创建时间">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
align="center"
|
||||
fixed="right"
|
||||
width="120"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown size="mini" split-button type="primary" @click="onCommand(['edit',scope.row])"
|
||||
@command="onCommand">
|
||||
<i class="el-icon-edit"></i>编辑
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="['delete',scope.row]" icon="el-icon-delete">删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<el-pagination
|
||||
background
|
||||
v-if="vm.totalCount > vm.pageSize"
|
||||
style="margin-top: 10px"
|
||||
@current-change="onPage"
|
||||
:current-page="vm.pageNumber"
|
||||
:page-size="vm.pageSize"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="vm.totalCount">
|
||||
</el-pagination>
|
||||
</el-card>
|
||||
</div>
|
||||
<script>
|
||||
var app = new Vue({
|
||||
mixins: [mixin],
|
||||
el: "#app",
|
||||
data: {
|
||||
module: 'system',
|
||||
target: 'user',
|
||||
vm: {//条件及分页参数
|
||||
userName: "",
|
||||
userCode: "",
|
||||
userAlias: "",
|
||||
userStatus: "",
|
||||
deptId: "",
|
||||
deptCode: "",
|
||||
deptName: "",
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
sortKey:'CREATE_TIME',
|
||||
sortType:'DESC'
|
||||
},
|
||||
form: {//待提交表单
|
||||
title: "",
|
||||
dialog: false,
|
||||
id: '',
|
||||
userName: "",
|
||||
userCode: "",
|
||||
userAlias: "",
|
||||
userPwd: "",
|
||||
userStatus: "",
|
||||
deptId: "",
|
||||
deptCode: "",
|
||||
deptName: "",
|
||||
rowVersion: ""
|
||||
},
|
||||
formRules: {
|
||||
userName: [
|
||||
{required: true, message: '用户账户不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 100, message: '用户账户长度在 1 到 100 个字符', trigger: 'blur'}
|
||||
],
|
||||
userCode: [
|
||||
{required: true, message: '用户代码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '用户代码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
userAlias: [
|
||||
{min: 1, max: 50, message: '用户别名长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
userPwd: [
|
||||
{required: true, message: '用户密码不能为空', trigger: 'blur'},
|
||||
{min: 1, max: 50, message: '用户密码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
userStatus: [
|
||||
{required: true, message: '用户状态不能为空', trigger: 'blur'},
|
||||
],
|
||||
deptId: [
|
||||
],
|
||||
deptCode: [
|
||||
{min: 1, max: 50, message: '部门代码长度在 1 到 50 个字符', trigger: 'blur'}
|
||||
],
|
||||
deptName: [
|
||||
{min: 1, max: 100, message: '部门名称长度在 1 到 100 个字符', trigger: 'blur'}
|
||||
],
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onCreate: function () {
|
||||
this.form.title = "用户新增";
|
||||
this.form.dialog = true;
|
||||
this.form.id = "";
|
||||
this.form.userName = "";
|
||||
this.form.userCode = "";
|
||||
this.form.userAlias = "";
|
||||
this.form.userPwd = "";
|
||||
this.form.userStatus = "";
|
||||
this.form.deptId = "";
|
||||
this.form.deptCode = "";
|
||||
this.form.deptName = "";
|
||||
},
|
||||
onCommand: function (arg) {
|
||||
const cmd = arg[0];
|
||||
const item = arg[1];
|
||||
switch (cmd) {
|
||||
case "edit":
|
||||
this.form.title = "用户编辑";
|
||||
this.form.dialog = true;
|
||||
this.form.id = item.id;
|
||||
this.form.userName = item.userName;
|
||||
this.form.userCode = item.userCode;
|
||||
this.form.userAlias = item.userAlias;
|
||||
this.form.userPwd = item.userPwd;
|
||||
this.form.userStatus = item.userStatus;
|
||||
this.form.deptId = item.deptId;
|
||||
this.form.deptCode = item.deptCode;
|
||||
this.form.deptName = item.deptName;
|
||||
this.form.rowVersion = item.rowVersion;
|
||||
break;
|
||||
case "delete":
|
||||
this.onDelete(item);
|
||||
break;
|
||||
default:
|
||||
this.w("未找到对应的命令");
|
||||
break;
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
this.onFind();
|
||||
},
|
||||
})
|
||||
</script>
|
Loading…
Reference in new issue