|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
package xyz.wbsite.module.system.mgr;
|
|
|
|
|
package ${basePackage}.module.system.mgr;
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
@ -7,26 +7,30 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
|
|
import xyz.wbsite.frame.base.ErrorType;
|
|
|
|
|
import xyz.wbsite.frame.base.Token;
|
|
|
|
|
import xyz.wbsite.frame.utils.IDgenerator;
|
|
|
|
|
import xyz.wbsite.frame.utils.MapperUtil;
|
|
|
|
|
import xyz.wbsite.frame.utils.Message;
|
|
|
|
|
import xyz.wbsite.frame.utils.ValidationUtil;
|
|
|
|
|
import xyz.wbsite.module.system.ent.User;
|
|
|
|
|
import xyz.wbsite.module.system.mpr.UserMapper;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserCreateRequest;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserDeleteRequest;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserFindRequest;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserGetRequest;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserRoleCreateRequest;
|
|
|
|
|
import xyz.wbsite.module.system.req.UserUpdateRequest;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserCreateResponse;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserDeleteResponse;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserFindResponse;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserGetResponse;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserRoleCreateResponse;
|
|
|
|
|
import xyz.wbsite.module.system.rsp.UserUpdateResponse;
|
|
|
|
|
import ${basePackage}.frame.base.ErrorType;
|
|
|
|
|
import ${basePackage}.frame.base.Token;
|
|
|
|
|
import ${basePackage}.frame.utils.IDgenerator;
|
|
|
|
|
import ${basePackage}.frame.utils.MD5Util;
|
|
|
|
|
import ${basePackage}.frame.utils.MapperUtil;
|
|
|
|
|
import ${basePackage}.frame.utils.Message;
|
|
|
|
|
import ${basePackage}.frame.utils.ValidationUtil;
|
|
|
|
|
import ${basePackage}.module.system.ent.Dept;
|
|
|
|
|
import ${basePackage}.module.system.ent.User;
|
|
|
|
|
import ${basePackage}.module.system.mpr.UserMapper;
|
|
|
|
|
import ${basePackage}.module.system.req.DeptFindRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserCreateRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserDeleteRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserFindRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserGetRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserRoleCreateRequest;
|
|
|
|
|
import ${basePackage}.module.system.req.UserUpdateRequest;
|
|
|
|
|
import ${basePackage}.module.system.rsp.DeptFindResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserCreateResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserDeleteResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserFindResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserGetResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserRoleCreateResponse;
|
|
|
|
|
import ${basePackage}.module.system.rsp.UserUpdateResponse;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* USER - 用户
|
|
|
|
@ -42,6 +46,8 @@ public class UserManagerImpl implements UserManager {
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserMapper userMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private DeptManager deptManager;
|
|
|
|
|
@Autowired
|
|
|
|
|
private UserRoleManager userRoleManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -62,6 +68,25 @@ public class UserManagerImpl implements UserManager {
|
|
|
|
|
long id = IDgenerator.nextId();
|
|
|
|
|
User entity = MapperUtil.map(request, User.class);
|
|
|
|
|
entity.setId(id);
|
|
|
|
|
entity.setUserPwd(MD5Util.generatePwd(entity.getUserPwd()));
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
DeptFindRequest deptFindRequest = new DeptFindRequest();
|
|
|
|
|
deptFindRequest.setDeptCode(request.getDeptCode());
|
|
|
|
|
deptFindRequest.setPageSize(1);
|
|
|
|
|
DeptFindResponse deptFindResponse = deptManager.find(deptFindRequest, token);
|
|
|
|
|
if (deptFindResponse.hasError()) {
|
|
|
|
|
response.addErrors(deptFindResponse.getErrors());
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
if (deptFindResponse.getResult().size() == 0) {
|
|
|
|
|
response.addError(ErrorType.BUSINESS_ERROR, "[" + request.getDeptCode() + "]机构代码不存在");
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
Dept dept = deptFindResponse.getResult().get(0);
|
|
|
|
|
entity.setDeptId(dept.getId());
|
|
|
|
|
entity.setDeptName(dept.getDeptName());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long result = userMapper.insert(entity, token);
|
|
|
|
|
if (1L != result) {
|
|
|
|
@ -154,7 +179,9 @@ public class UserManagerImpl implements UserManager {
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
|
|
|
|
if (request.getPageSize() != 0) {
|
|
|
|
|
PageHelper.startPage(request.getPageNumber(), request.getPageSize());
|
|
|
|
|
}
|
|
|
|
|
if (StringUtil.isNotEmpty(request.getSortKey())) {
|
|
|
|
|
PageHelper.orderBy(request.getSortKey() + " " + request.getSortType());
|
|
|
|
|
}
|
|
|
|
|