后端更改表结构
This commit is contained in:
parent
893297f6e5
commit
7de741c9c3
@ -30,10 +30,10 @@ CREATE TABLE `t_sys_entitlement` (
|
||||
`state` TINYINT(6) NOT NULL DEFAULT 1 COMMENT '状态 0-停用, 1-启用',
|
||||
`pid` VARCHAR(32) NOT NULL COMMENT '父ID',
|
||||
`ent_sort` INT(11) NOT NULL DEFAULT 0 COMMENT '排序字段, 规则:正序',
|
||||
`system` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`sys_type` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`created_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updated_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
PRIMARY KEY (`ent_id`, `system`)
|
||||
PRIMARY KEY (`ent_id`, `sys_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='系统权限表';
|
||||
|
||||
-- 角色表
|
||||
@ -41,7 +41,7 @@ DROP TABLE IF EXISTS `t_sys_role`;
|
||||
CREATE TABLE `t_sys_role` (
|
||||
`role_id` VARCHAR(32) NOT NULL COMMENT '角色ID, ROLE_开头',
|
||||
`role_name` VARCHAR(32) NOT NULL COMMENT '角色名称',
|
||||
`system` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`sys_type` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`belong_info_id` VARCHAR(64) NOT NULL DEFAULT '0' COMMENT '所属商户ID / 0(平台)',
|
||||
`updated_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
PRIMARY KEY (`role_id`)
|
||||
@ -67,14 +67,14 @@ CREATE TABLE `t_sys_user` (
|
||||
`user_no` VARCHAR(32) COMMENT '员工编号',
|
||||
`is_admin` TINYINT(6) NOT NULL DEFAULT 0 COMMENT '是否超管(超管拥有全部权限) 0-否 1-是',
|
||||
`state` TINYINT(6) NOT NULL DEFAULT 0 COMMENT '状态 0-停用 1-启用',
|
||||
`system` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`sys_type` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`belong_info_id` VARCHAR(64) NOT NULL DEFAULT '0' COMMENT '所属商户ID / 0(平台)',
|
||||
`created_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间',
|
||||
`updated_at` TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) COMMENT '更新时间',
|
||||
PRIMARY KEY (`sys_user_id`),
|
||||
UNIQUE KEY(`system`,`login_username`),
|
||||
UNIQUE KEY(`system`,`telphone`),
|
||||
UNIQUE KEY(`system`, `user_no`)
|
||||
UNIQUE KEY(`sys_type`,`login_username`),
|
||||
UNIQUE KEY(`sys_type`,`telphone`),
|
||||
UNIQUE KEY(`sys_type`, `user_no`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=100001 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户表';
|
||||
|
||||
-- 系统用户认证表
|
||||
@ -86,7 +86,7 @@ CREATE TABLE `t_sys_user_auth` (
|
||||
`identifier` VARCHAR(128) NOT NULL COMMENT '认证标识 ( 用户名 | open_id )',
|
||||
`credential` VARCHAR(128) NOT NULL COMMENT '密码凭证',
|
||||
`salt` VARCHAR(128) NOT NULL COMMENT 'salt',
|
||||
`system` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`sys_type` VARCHAR(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
PRIMARY KEY (`auth_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1001 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户认证表';
|
||||
|
||||
@ -121,7 +121,7 @@ CREATE TABLE `t_sys_log` (
|
||||
`user_id` bigint(20) DEFAULT NULL COMMENT '系统用户ID',
|
||||
`user_name` varchar(32) DEFAULT NULL COMMENT '用户姓名',
|
||||
`user_ip` varchar(128) NOT NULL DEFAULT '' COMMENT '用户IP',
|
||||
`system` varchar(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`sys_type` varchar(8) NOT NULL COMMENT '所属系统: MGR-运营平台, MCH-商户中心',
|
||||
`method_name` varchar(128) NOT NULL DEFAULT '' COMMENT '方法名',
|
||||
`method_remark` varchar(128) NOT NULL DEFAULT '' COMMENT '方法描述',
|
||||
`req_url` varchar(256) NOT NULL DEFAULT '' COMMENT '请求地址',
|
||||
|
@ -100,7 +100,7 @@ public class SysEntitlement extends BaseModel {
|
||||
/**
|
||||
* 所属系统: MGR-运营平台, MCH-商户中心
|
||||
*/
|
||||
private String system;
|
||||
private String sysType;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
|
@ -70,7 +70,7 @@ public class SysLog implements Serializable {
|
||||
/**
|
||||
* 所属系统: MGR-运营平台, MCH-商户中心
|
||||
*/
|
||||
private String system;
|
||||
private String sysType;
|
||||
|
||||
/**
|
||||
* 方法名
|
||||
|
@ -60,7 +60,7 @@ public class SysRole implements Serializable {
|
||||
/**
|
||||
* 所属系统: MGR-运营平台, MCH-商户中心
|
||||
*/
|
||||
private String system;
|
||||
private String sysType;
|
||||
|
||||
/**
|
||||
* 所属商户ID / 0(平台)
|
||||
|
@ -96,7 +96,7 @@ public class SysUser extends BaseModel {
|
||||
/**
|
||||
* 所属系统: MGR-运营平台, MCH-商户中心
|
||||
*/
|
||||
private String system;
|
||||
private String sysType;
|
||||
|
||||
/**
|
||||
* 所属商户ID / 0(平台)
|
||||
|
@ -80,7 +80,7 @@ public class SysUserAuth implements Serializable {
|
||||
/**
|
||||
* 所属系统: MGR-运营平台, MCH-商户中心
|
||||
*/
|
||||
private String system;
|
||||
private String sysType;
|
||||
|
||||
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class CurrentUserController extends CommonCtrl{
|
||||
allMenuList = sysEntitlementService.list(SysEntitlement.gw()
|
||||
.in(SysEntitlement::getEntId, entIdList)
|
||||
.in(SysEntitlement::getEntType, Arrays.asList(CS.ENT_TYPE.MENU_LEFT, CS.ENT_TYPE.MENU_OTHER))
|
||||
.eq(SysEntitlement::getSystem, CS.SYS_TYPE.MGR)
|
||||
.eq(SysEntitlement::getSysType, CS.SYS_TYPE.MGR)
|
||||
.eq(SysEntitlement::getState, CS.PUB_USABLE));
|
||||
}
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class MchInfoController extends CommonCtrl {
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
List<SysUser> userList = sysUserService.list(SysUser.gw()
|
||||
.eq(SysUser::getBelongInfoId, mchNo)
|
||||
.eq(SysUser::getSystem, CS.SYS_TYPE.MCH)
|
||||
.eq(SysUser::getSysType, CS.SYS_TYPE.MCH)
|
||||
);
|
||||
if (userList.size() > 0) {
|
||||
for (SysUser user:userList) {
|
||||
|
@ -55,7 +55,7 @@ public class SysEntController extends CommonCtrl {
|
||||
|
||||
return ApiRes.ok(sysEntitlementService.getOne(SysEntitlement.gw()
|
||||
.eq(SysEntitlement::getEntId, getValStringRequired("entId"))
|
||||
.eq(SysEntitlement::getSystem, getValStringRequired("system")))
|
||||
.eq(SysEntitlement::getSysType, getValStringRequired("system")))
|
||||
);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ public class SysEntController extends CommonCtrl {
|
||||
public ApiRes updateById(@PathVariable("entId") String entId) {
|
||||
|
||||
SysEntitlement queryObject = getObject(SysEntitlement.class);
|
||||
sysEntitlementService.update(queryObject, SysEntitlement.gw().eq(SysEntitlement::getEntId, entId).eq(SysEntitlement::getSystem, queryObject.getSystem()));
|
||||
sysEntitlementService.update(queryObject, SysEntitlement.gw().eq(SysEntitlement::getEntId, entId).eq(SysEntitlement::getSysType, queryObject.getSysType()));
|
||||
return ApiRes.ok();
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class SysEntController extends CommonCtrl {
|
||||
public ApiRes showTree() {
|
||||
|
||||
//查询全部数据
|
||||
List<SysEntitlement> list = sysEntitlementService.list(SysEntitlement.gw().eq(SysEntitlement::getSystem, getValStringRequired("system")));
|
||||
List<SysEntitlement> list = sysEntitlementService.list(SysEntitlement.gw().eq(SysEntitlement::getSysType, getValStringRequired("system")));
|
||||
|
||||
//转换为json树状结构
|
||||
JSONArray jsonArray = (JSONArray) JSONArray.toJSON(list);
|
||||
|
@ -64,7 +64,7 @@ public class SysLogController extends CommonCtrl {
|
||||
condition.orderByDesc(SysLog::getCreatedAt);
|
||||
if (sysLog.getUserId() != null) condition.eq(SysLog::getUserId, sysLog.getUserId());
|
||||
if (sysLog.getUserName() != null) condition.eq(SysLog::getUserName, sysLog.getUserName());
|
||||
if (StringUtils.isNotEmpty(sysLog.getSystem())) condition.eq(SysLog::getSystem, sysLog.getSystem());
|
||||
if (StringUtils.isNotEmpty(sysLog.getSysType())) condition.eq(SysLog::getSysType, sysLog.getSysType());
|
||||
if (paramJSON != null) {
|
||||
if (StringUtils.isNotEmpty(paramJSON.getString("createdStart"))) condition.ge(SysLog::getCreatedAt, paramJSON.getString("createdStart"));
|
||||
if (StringUtils.isNotEmpty(paramJSON.getString("createdEnd"))) condition.le(SysLog::getCreatedAt, paramJSON.getString("createdEnd"));
|
||||
|
@ -70,7 +70,7 @@ public class SysRoleController extends CommonCtrl {
|
||||
|
||||
QueryWrapper<SysRole> condition = new QueryWrapper<>();
|
||||
LambdaQueryWrapper<SysRole> lambdaCondition = condition.lambda();
|
||||
lambdaCondition.eq(SysRole::getSystem, CS.SYS_TYPE.MGR);
|
||||
lambdaCondition.eq(SysRole::getSysType, CS.SYS_TYPE.MGR);
|
||||
lambdaCondition.eq(SysRole::getBelongInfoId, 0);
|
||||
|
||||
if(StringUtils.isNotEmpty(queryObject.getRoleName())){
|
||||
@ -109,7 +109,7 @@ public class SysRoleController extends CommonCtrl {
|
||||
SysRole SysRole = getObject(SysRole.class);
|
||||
String roleId = "ROLE_" + StringKit.getUUID(6);
|
||||
SysRole.setRoleId(roleId);
|
||||
SysRole.setSystem(CS.SYS_TYPE.MGR); //后台系统
|
||||
SysRole.setSysType(CS.SYS_TYPE.MGR); //后台系统
|
||||
sysRoleService.save(SysRole);
|
||||
|
||||
//权限信息集合
|
||||
|
@ -60,7 +60,7 @@ public class SysUserController extends CommonCtrl {
|
||||
SysUser queryObject = getObject(SysUser.class);
|
||||
|
||||
LambdaQueryWrapper<SysUser> condition = SysUser.gw();
|
||||
condition.eq(SysUser::getSystem, CS.SYS_TYPE.MGR);
|
||||
condition.eq(SysUser::getSysType, CS.SYS_TYPE.MGR);
|
||||
|
||||
if(StringUtils.isNotEmpty(queryObject.getRealname())){
|
||||
condition.like(SysUser::getRealname, queryObject.getRealname());
|
||||
|
@ -166,7 +166,7 @@ public class AuthService {
|
||||
|
||||
//用户拥有的角色集合 需要以ROLE_ 开头, 用户拥有的权限集合
|
||||
List<String> roleList = sysRoleService.findListByUser(sysUser.getSysUserId());
|
||||
List<String> entList = sysRoleEntRelaService.selectEntIdsByUserId(sysUser.getSysUserId(), sysUser.getIsAdmin(), sysUser.getSystem());
|
||||
List<String> entList = sysRoleEntRelaService.selectEntIdsByUserId(sysUser.getSysUserId(), sysUser.getIsAdmin(), sysUser.getSysType());
|
||||
|
||||
List<SimpleGrantedAuthority> grantedAuthorities = new LinkedList<>();
|
||||
roleList.stream().forEach(role -> grantedAuthorities.add(new SimpleGrantedAuthority(role)));
|
||||
|
@ -160,7 +160,7 @@ public class MethodLogAop{
|
||||
sysLog.setReqUrl(request.getRequestURL().toString());
|
||||
sysLog.setUserIp(requestKitBean.getClientIp());
|
||||
sysLog.setCreatedAt(new Date());
|
||||
sysLog.setSystem(CS.SYS_TYPE.MCH);
|
||||
sysLog.setSysType(CS.SYS_TYPE.MCH);
|
||||
|
||||
if (userDetails != null) {
|
||||
sysLog.setUserId(JeeUserDetails.getCurrentUserDetails().getSysUser().getSysUserId());
|
||||
|
@ -73,7 +73,7 @@ public class CurrentUserController extends CommonCtrl{
|
||||
allMenuList = sysEntitlementService.list(SysEntitlement.gw()
|
||||
.in(SysEntitlement::getEntId, entIdList)
|
||||
.in(SysEntitlement::getEntType, Arrays.asList(CS.ENT_TYPE.MENU_LEFT, CS.ENT_TYPE.MENU_OTHER))
|
||||
.eq(SysEntitlement::getSystem, CS.SYS_TYPE.MCH)
|
||||
.eq(SysEntitlement::getSysType, CS.SYS_TYPE.MCH)
|
||||
.eq(SysEntitlement::getState, CS.PUB_USABLE));
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class SysEntController extends CommonCtrl {
|
||||
public ApiRes showTree() {
|
||||
|
||||
//查询全部数据
|
||||
List<SysEntitlement> list = sysEntitlementService.list(SysEntitlement.gw().eq(SysEntitlement::getSystem, CS.SYS_TYPE.MCH));
|
||||
List<SysEntitlement> list = sysEntitlementService.list(SysEntitlement.gw().eq(SysEntitlement::getSysType, CS.SYS_TYPE.MCH));
|
||||
|
||||
//4. 转换为json树状结构
|
||||
JSONArray jsonArray = (JSONArray) JSONArray.toJSON(list);
|
||||
|
@ -69,7 +69,7 @@ public class SysRoleController extends CommonCtrl {
|
||||
SysRole queryObject = getObject(SysRole.class);
|
||||
|
||||
LambdaQueryWrapper<SysRole> condition = SysRole.gw();
|
||||
condition.eq(SysRole::getSystem, CS.SYS_TYPE.MCH);
|
||||
condition.eq(SysRole::getSysType, CS.SYS_TYPE.MCH);
|
||||
condition.eq(SysRole::getBelongInfoId, getCurrentMchNo());
|
||||
|
||||
if(StringUtils.isNotEmpty(queryObject.getRoleName())){
|
||||
@ -103,7 +103,7 @@ public class SysRoleController extends CommonCtrl {
|
||||
SysRole SysRole = getObject(SysRole.class);
|
||||
String roleId = "ROLE_" + StringKit.getUUID(6);
|
||||
SysRole.setRoleId(roleId);
|
||||
SysRole.setSystem(CS.SYS_TYPE.MCH); //后台系统
|
||||
SysRole.setSysType(CS.SYS_TYPE.MCH); //后台系统
|
||||
SysRole.setBelongInfoId(getCurrentUser().getSysUser().getBelongInfoId());
|
||||
sysRoleService.save(SysRole);
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class SysUserController extends CommonCtrl {
|
||||
SysUser queryObject = getObject(SysUser.class);
|
||||
|
||||
LambdaQueryWrapper<SysUser> condition = SysUser.gw();
|
||||
condition.eq(SysUser::getSystem, CS.SYS_TYPE.MCH);
|
||||
condition.eq(SysUser::getSysType, CS.SYS_TYPE.MCH);
|
||||
condition.eq(SysUser::getBelongInfoId, getCurrentUser().getSysUser().getBelongInfoId());
|
||||
|
||||
if(StringUtils.isNotEmpty(queryObject.getRealname())){
|
||||
|
@ -176,7 +176,7 @@ public class AuthService {
|
||||
|
||||
//用户拥有的角色集合 需要以ROLE_ 开头, 用户拥有的权限集合
|
||||
List<String> roleList = sysRoleService.findListByUser(sysUser.getSysUserId());
|
||||
List<String> entList = sysRoleEntRelaService.selectEntIdsByUserId(sysUser.getSysUserId(), sysUser.getIsAdmin(), sysUser.getSystem());
|
||||
List<String> entList = sysRoleEntRelaService.selectEntIdsByUserId(sysUser.getSysUserId(), sysUser.getIsAdmin(), sysUser.getSysType());
|
||||
|
||||
List<SimpleGrantedAuthority> grantedAuthorities = new LinkedList<>();
|
||||
roleList.stream().forEach(role -> grantedAuthorities.add(new SimpleGrantedAuthority(role)));
|
||||
|
@ -108,7 +108,7 @@ public class MchInfoService extends ServiceImpl<MchInfoMapper, MchInfo> {
|
||||
|
||||
List<SysUser> userList = sysUserService.list(SysUser.gw()
|
||||
.eq(SysUser::getBelongInfoId, mchNo)
|
||||
.eq(SysUser::getSystem, CS.SYS_TYPE.MCH)
|
||||
.eq(SysUser::getSysType, CS.SYS_TYPE.MCH)
|
||||
);
|
||||
// 返回的用户id
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
@ -123,7 +123,7 @@ public class MchInfoService extends ServiceImpl<MchInfoMapper, MchInfo> {
|
||||
// 5.删除当前商户的登录用户
|
||||
sysUserService.remove(SysUser.gw()
|
||||
.eq(SysUser::getBelongInfoId, mchNo)
|
||||
.eq(SysUser::getSystem, CS.SYS_TYPE.MCH)
|
||||
.eq(SysUser::getSysType, CS.SYS_TYPE.MCH)
|
||||
);
|
||||
|
||||
// 6.删除当前商户
|
||||
|
@ -47,7 +47,7 @@ public class SysRoleEntRelaService extends ServiceImpl<SysRoleEntRelaMapper, Sys
|
||||
if(isAdmin == CS.YES){
|
||||
|
||||
List<String> result = new ArrayList<>();
|
||||
sysEntitlementService.list(SysEntitlement.gw().select(SysEntitlement::getEntId).eq(SysEntitlement::getSystem, system).eq(SysEntitlement::getState, CS.PUB_USABLE)
|
||||
sysEntitlementService.list(SysEntitlement.gw().select(SysEntitlement::getEntId).eq(SysEntitlement::getSysType, system).eq(SysEntitlement::getState, CS.PUB_USABLE)
|
||||
).stream().forEach(r -> result.add(r.getEntId()));
|
||||
|
||||
return result;
|
||||
|
@ -52,13 +52,13 @@ public class SysUserAuthService extends ServiceImpl<SysUserAuthMapper, SysUserAu
|
||||
String userPwd = new BCryptPasswordEncoder().encode(pwdRaw);
|
||||
|
||||
/** 用户名登录方式 */
|
||||
SysUserAuth record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSystem(system);
|
||||
SysUserAuth record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSysType(system);
|
||||
record.setIdentityType(CS.AUTH_TYPE.LOGIN_USER_NAME);
|
||||
record.setIdentifier(loginUserName);
|
||||
save(record);
|
||||
|
||||
/** 手机号登录方式 */
|
||||
record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSystem(system);
|
||||
record = new SysUserAuth(); record.setUserId(userId); record.setCredential(userPwd); record.setSalt(salt);record.setSysType(system);
|
||||
record.setIdentityType(CS.AUTH_TYPE.TELPHONE);
|
||||
record.setIdentifier(telPhone);
|
||||
save(record);
|
||||
@ -86,7 +86,7 @@ public class SysUserAuthService extends ServiceImpl<SysUserAuthMapper, SysUserAu
|
||||
//更改密码
|
||||
if(StringUtils.isNotEmpty(newPwd)){
|
||||
//根据当前用户ID 查询出用户的所有认证记录
|
||||
List<SysUserAuth> authList = list(SysUserAuth.gw().eq(SysUserAuth::getSystem, system).eq(SysUserAuth::getUserId, resetUserId));
|
||||
List<SysUserAuth> authList = list(SysUserAuth.gw().eq(SysUserAuth::getSysType, system).eq(SysUserAuth::getUserId, resetUserId));
|
||||
for (SysUserAuth auth : authList) {
|
||||
if(StringUtils.isEmpty(auth.getSalt())){ //可能为其他登录方式, 不存在salt
|
||||
continue;
|
||||
|
@ -62,15 +62,15 @@ public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
|
||||
if(sysUser.getSex() == null ) throw new BizException("性别不能为空!");
|
||||
|
||||
//登录用户名不可重复
|
||||
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0 ){
|
||||
if( count(SysUser.gw().eq(SysUser::getSysType, system).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0 ){
|
||||
throw new BizException("登录用户名已存在!");
|
||||
}
|
||||
//手机号不可重复
|
||||
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0 ){
|
||||
if( count(SysUser.gw().eq(SysUser::getSysType, system).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0 ){
|
||||
throw new BizException("手机号已存在!");
|
||||
}
|
||||
//员工号不可重复
|
||||
if( count(SysUser.gw().eq(SysUser::getSystem, system).eq(SysUser::getUserNo, sysUser.getUserNo())) > 0 ){
|
||||
if( count(SysUser.gw().eq(SysUser::getSysType, system).eq(SysUser::getUserNo, sysUser.getUserNo())) > 0 ){
|
||||
throw new BizException("员工号已存在!");
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
|
||||
}
|
||||
|
||||
//1. 插入用户主表
|
||||
sysUser.setSystem(system); // 系统类型
|
||||
sysUser.setSysType(system); // 系统类型
|
||||
this.save(sysUser);
|
||||
|
||||
Long sysUserId = sysUser.getSysUserId();
|
||||
@ -109,21 +109,21 @@ public class SysUserService extends ServiceImpl<SysUserMapper, SysUser> {
|
||||
//修改了手机号, 需要修改auth表信息
|
||||
if(!dbRecord.getTelphone().equals(sysUser.getTelphone())){
|
||||
|
||||
if(count(SysUser.gw().eq(SysUser::getSystem, dbRecord.getSystem()).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0){
|
||||
if(count(SysUser.gw().eq(SysUser::getSysType, dbRecord.getSysType()).eq(SysUser::getTelphone, sysUser.getTelphone())) > 0){
|
||||
throw new BizException("该手机号已关联其他用户!");
|
||||
}
|
||||
|
||||
sysUserAuthService.resetAuthInfo(sysUserId, null, sysUser.getTelphone(), null, dbRecord.getSystem());
|
||||
sysUserAuthService.resetAuthInfo(sysUserId, null, sysUser.getTelphone(), null, dbRecord.getSysType());
|
||||
}
|
||||
|
||||
//修改了手机号, 需要修改auth表信息
|
||||
if(!dbRecord.getLoginUsername().equals(sysUser.getLoginUsername())){
|
||||
|
||||
if(count(SysUser.gw().eq(SysUser::getSystem, dbRecord.getSystem()).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0){
|
||||
if(count(SysUser.gw().eq(SysUser::getSysType, dbRecord.getSysType()).eq(SysUser::getLoginUsername, sysUser.getLoginUsername())) > 0){
|
||||
throw new BizException("该登录用户名已关联其他用户!");
|
||||
}
|
||||
|
||||
sysUserAuthService.resetAuthInfo(sysUserId, sysUser.getLoginUsername(), null, null, dbRecord.getSystem());
|
||||
sysUserAuthService.resetAuthInfo(sysUserId, sysUser.getLoginUsername(), null, null, dbRecord.getSysType());
|
||||
}
|
||||
|
||||
//修改用户主表
|
||||
|
@ -29,6 +29,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
public interface SysEntitlementMapper extends BaseMapper<SysEntitlement> {
|
||||
|
||||
Integer userHasLeftMenu(@Param("userId") Long userId, @Param("system") String system);
|
||||
Integer userHasLeftMenu(@Param("userId") Long userId, @Param("sysType") String sysType);
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
<result column="state" property="state" />
|
||||
<result column="pid" property="pid" />
|
||||
<result column="ent_sort" property="entSort" />
|
||||
<result column="system" property="system" />
|
||||
<result column="sys_type" property="sysType" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
@ -25,7 +25,7 @@
|
||||
select DISTINCT ent_id from t_sys_role_ent_rela where role_id in (
|
||||
select role_id from t_sys_user_role_rela where user_id = #{userId}
|
||||
)
|
||||
) and state = 1 and ent_type = 'ML' and system = #{system}
|
||||
) and state = 1 and ent_type = 'ML' and sys_type = #{sysType}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="user_name" property="userName" />
|
||||
<result column="user_ip" property="userIp" />
|
||||
<result column="system" property="system" />
|
||||
<result column="sys_type" property="sysType" />
|
||||
<result column="method_name" property="methodName" />
|
||||
<result column="method_remark" property="methodRemark" />
|
||||
<result column="req_url" property="reqUrl" />
|
||||
|
@ -31,6 +31,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysRoleEntRelaMapper extends BaseMapper<SysRoleEntRela> {
|
||||
|
||||
List<String> selectEntIdsByUserId(@Param("userId") Long userId, @Param("system") String system);
|
||||
List<String> selectEntIdsByUserId(@Param("userId") Long userId, @Param("sysType") String sysType);
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
select distinct ent_id from t_sys_entitlement where ent_id in (
|
||||
select distinct re.ent_id from t_sys_role_ent_rela re left join t_sys_user_role_rela ur on re.role_id = ur.role_id
|
||||
where ur.user_id = #{userId}
|
||||
) and `system` = #{system} and state = 1
|
||||
) and `sys_type` = #{sysType} and state = 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<resultMap id="BaseResultMap" type="com.jeequan.jeepay.core.entity.SysRole">
|
||||
<id column="role_id" property="roleId" />
|
||||
<result column="role_name" property="roleName" />
|
||||
<result column="system" property="system" />
|
||||
<result column="sys_type" property="sysType" />
|
||||
<result column="belong_info_id" property="belongInfoId" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
</resultMap>
|
||||
|
@ -30,6 +30,6 @@ import com.jeequan.jeepay.core.entity.SysUserAuth;
|
||||
public interface SysUserAuthMapper extends BaseMapper<SysUserAuth> {
|
||||
|
||||
SysUserAuth selectByLogin(@Param("identifier")String identifier,
|
||||
@Param("identityType")Byte identityType, @Param("system")String system);
|
||||
@Param("identityType")Byte identityType, @Param("sysType")String sysType);
|
||||
|
||||
}
|
||||
|
@ -10,14 +10,14 @@
|
||||
<result column="identifier" property="identifier" />
|
||||
<result column="credential" property="credential" />
|
||||
<result column="salt" property="salt" />
|
||||
<result column="system" property="system" />
|
||||
<result column="sys_type" property="sysType" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- 根据登录信息查询 -->
|
||||
<select id="selectByLogin" resultMap="BaseResultMap">
|
||||
select a.* from t_sys_user_auth a left join t_sys_user u on a.user_id = u.sys_user_id
|
||||
where a.identity_type = #{identityType} and a.identifier = #{identifier} and a.system = #{system}
|
||||
where a.identity_type = #{identityType} and a.identifier = #{identifier} and a.sys_type = #{sysType}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<result column="user_no" property="userNo" />
|
||||
<result column="is_admin" property="isAdmin" />
|
||||
<result column="state" property="state" />
|
||||
<result column="system" property="system" />
|
||||
<result column="sys_type" property="sysType" />
|
||||
<result column="belong_info_id" property="belongInfoId" />
|
||||
<result column="created_at" property="createdAt" />
|
||||
<result column="updated_at" property="updatedAt" />
|
||||
|
Loading…
Reference in New Issue
Block a user