diff --git a/src/main/java/club/joylink/rtss/entity/SysAccountExample.java b/src/main/java/club/joylink/rtss/entity/SysAccountExample.java index 9c8c1a8be..dd723267c 100644 --- a/src/main/java/club/joylink/rtss/entity/SysAccountExample.java +++ b/src/main/java/club/joylink/rtss/entity/SysAccountExample.java @@ -395,66 +395,6 @@ public class SysAccountExample { return (Criteria) this; } - public Criteria andOrgIdIsNull() { - addCriterion("org_id is null"); - return (Criteria) this; - } - - public Criteria andOrgIdIsNotNull() { - addCriterion("org_id is not null"); - return (Criteria) this; - } - - public Criteria andOrgIdEqualTo(Long value) { - addCriterion("org_id =", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotEqualTo(Long value) { - addCriterion("org_id <>", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdGreaterThan(Long value) { - addCriterion("org_id >", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdGreaterThanOrEqualTo(Long value) { - addCriterion("org_id >=", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdLessThan(Long value) { - addCriterion("org_id <", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdLessThanOrEqualTo(Long value) { - addCriterion("org_id <=", value, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdIn(List values) { - addCriterion("org_id in", values, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotIn(List values) { - addCriterion("org_id not in", values, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdBetween(Long value1, Long value2) { - addCriterion("org_id between", value1, value2, "orgId"); - return (Criteria) this; - } - - public Criteria andOrgIdNotBetween(Long value1, Long value2) { - addCriterion("org_id not between", value1, value2, "orgId"); - return (Criteria) this; - } - public Criteria andNameIsNull() { addCriterion("`name` is null"); return (Criteria) this; @@ -1547,6 +1487,7 @@ public class SysAccountExample { } /** + * */ public static class Criteria extends GeneratedCriteria { diff --git a/src/main/java/club/joylink/rtss/services/SysUserService.java b/src/main/java/club/joylink/rtss/services/SysUserService.java index 32446e022..c0c1b3b6e 100644 --- a/src/main/java/club/joylink/rtss/services/SysUserService.java +++ b/src/main/java/club/joylink/rtss/services/SysUserService.java @@ -85,6 +85,9 @@ public class SysUserService implements ISysUserService { @Autowired private QRCodeManager qrCodeManager; + /** + * @update 20221019 删除账号查询逻辑,去除绑定组织操作 + */ @Override public AccountVO findUserByAccountAndPassword(String account, String password, String project) { /* 先按手机号和邮箱查询 */ @@ -92,8 +95,6 @@ public class SysUserService implements ISysUserService { example.createCriteria().andMobileEqualTo(account).andPasswordEqualTo(password); // 手机号 example.or().andEmailEqualTo(account).andPasswordEqualTo(password); // 邮箱 List users = this.sysAccountDAO.selectByExample(example); - Collection projectOrgs = iOrgService.findEntities(project, BusinessConsts.Org.Status.VALID); - Map orgMap = projectOrgs.stream().collect(Collectors.toMap(Org::getId, Function.identity())); AccountVO accountVO = null; if (!CollectionUtils.isEmpty(users)) { accountVO = new AccountVO(users.get(0)); @@ -103,34 +104,10 @@ public class SysUserService implements ISysUserService { example.clear(); example.createCriteria().andAccountEqualTo(account).andPasswordEqualTo(password); users = this.sysAccountDAO.selectByExample(example); - for (SysAccount user : users) { //只能有一个账号符合条件 - if (user.getOrgId() == null) { - if (accountVO != null) { - log.error("账号[{}]信息异常", account); - throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("账号信息异常"); - } - accountVO = new AccountVO(user); - } else { - Org org = orgMap.get(user.getOrgId()); - if (org != null) { //该账号的组织包含在项目组织中 - if (accountVO != null) { - log.error("账号[{}]信息异常", account); - throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("账号信息异常"); - } - accountVO = new AccountVO(user); - } - } + if (CollectionUtils.isEmpty(users)) { + throw BusinessExceptionAssertEnum.SYSTEM_EXCEPTION.exception("账号信息异常"); } - } - if (accountVO != null) { - Org topOrg; - if (accountVO.getOrgId() != null) { - topOrg = iOrgService.getEntity(accountVO.getOrgId()); - } else { - topOrg = iOrgService.findTopOrgOfUser(accountVO.getId()); - } - /* 如果用户属于该顶级组织,设置相关属性 */ - setOrgInfoOfThisOrg(topOrg, accountVO); + accountVO = new AccountVO(users.get(0)); } return accountVO; } @@ -179,7 +156,7 @@ public class SysUserService implements ISysUserService { @Override public SysAccount findEntity(@NonNull String account, long orgId) { SysAccountExample example = new SysAccountExample(); - example.createCriteria().andAccountEqualTo(account).andOrgIdEqualTo(orgId); + example.createCriteria().andAccountEqualTo(account); List users = sysAccountDAO.selectByExample(example); if (CollectionUtils.isEmpty(users)) { return null; @@ -191,7 +168,7 @@ public class SysUserService implements ISysUserService { @Override public boolean isExist(@NonNull String account, long orgId) { SysAccountExample example = new SysAccountExample(); - example.createCriteria().andAccountEqualTo(account).andOrgIdEqualTo(orgId); + example.createCriteria().andAccountEqualTo(account); return sysAccountDAO.countByExample(example) > 0; } diff --git a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java index 2f5283cdd..023b4b118 100644 --- a/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java +++ b/src/main/java/club/joylink/rtss/services/auth/AuthenticateService.java @@ -233,6 +233,9 @@ public class AuthenticateService implements IAuthenticateService { } } + /** + * @update 20221019 去除设置组织信息 + */ @Override public void wmConfirmClientLogin(String code, String state) { LoginScanParam param = LoginScanParam.parse(state); @@ -249,7 +252,7 @@ public class AuthenticateService implements IAuthenticateService { LoginUserInfoVO loginUserInfo = new LoginUserInfoVO(user, loginStatusVo.getClient(), loginStatusVo.getProjectVO().name(), loginStatusVo.getDeviceVO()); // 设置组织信息 - iSysUserService.setOrgInfoOfOrgRelWithTheProject(loginUserInfo.getProjectInfo().name(), user); + // iSysUserService.setOrgInfoOfOrgRelWithTheProject(loginUserInfo.getProjectInfo().name(), user); // 登陆 login(loginUserInfo, true); // 更新登陆状态 diff --git a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java index 4bbe62bbb..89a5c20c1 100644 --- a/src/main/java/club/joylink/rtss/services/org/OrgUserService.java +++ b/src/main/java/club/joylink/rtss/services/org/OrgUserService.java @@ -463,12 +463,12 @@ public class OrgUserService implements IOrgUserService { * @param topOrg 导入的组织所属的顶级组织 * @param orgId 要导入的组织 * @param orgUserIdSet 导入的组织当前已有的成员 + * @update 20221019 创建用户时去除组织ID account.setOrgId(topOrg.getId()); */ private void importOrgUser(Org topOrg, Long orgId, Set orgUserIdSet, ImportOrgUserVO importOrgUser) { SysAccount user = iSysUserService.findEntity(importOrgUser.getAccount(), topOrg.getId()); if (user == null) { SysAccount account = importOrgUser.convert2DB(); - account.setOrgId(topOrg.getId()); iSysUserService.createUser(account); create(orgId, account.getId(), BusinessConsts.OrgRole.Student); } else { diff --git a/src/main/resources/mybatis/mapper/SysAccountDAO.xml b/src/main/resources/mybatis/mapper/SysAccountDAO.xml index 77cf9be57..54cb2008e 100644 --- a/src/main/resources/mybatis/mapper/SysAccountDAO.xml +++ b/src/main/resources/mybatis/mapper/SysAccountDAO.xml @@ -1,465 +1,454 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + - + + + + id, account, parent_account, `type`, `name`, nickname, avatar_path, `password`, + mobile, nationcode, email, wx_id, wx_union_id, wm_open_id, `status`, roles, `source`, + create_time, update_user_id, update_time + + - select - - distinct - - - from sys_account - - - - - order by ${orderByClause} - - - - limit ${offset}, ${limit} - - - limit ${limit} - - - - - - delete from sys_account - where id = #{id,jdbcType=BIGINT} - - - delete from sys_account - - - - - - insert into sys_account (account, parent_account, `type`, - org_id, `name`, nickname, - avatar_path, `password`, mobile, - nationcode, email, wx_id, - wx_union_id, wm_open_id, `status`, - roles, `source`, create_time, - update_user_id, update_time) - values (#{account,jdbcType=VARCHAR}, #{parentAccount,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, - #{orgId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, - #{avatarPath,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, - #{nationcode,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{wxId,jdbcType=VARCHAR}, - #{wxUnionId,jdbcType=VARCHAR}, #{wmOpenId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, - #{roles,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, - #{updateUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}) - - - insert into sys_account - - - account, - - - parent_account, - - - `type`, - - - org_id, - - - `name`, - - - nickname, - - - avatar_path, - - - `password`, - - - mobile, - - - nationcode, - - - email, - - - wx_id, - - - wx_union_id, - - - wm_open_id, - - - `status`, - - - roles, - - - `source`, - - - create_time, - - - update_user_id, - - - update_time, - - - - - #{account,jdbcType=VARCHAR}, - - - #{parentAccount,jdbcType=VARCHAR}, - - - #{type,jdbcType=VARCHAR}, - - - #{orgId,jdbcType=BIGINT}, - - - #{name,jdbcType=VARCHAR}, - - - #{nickname,jdbcType=VARCHAR}, - - - #{avatarPath,jdbcType=VARCHAR}, - - - #{password,jdbcType=VARCHAR}, - - - #{mobile,jdbcType=VARCHAR}, - - - #{nationcode,jdbcType=VARCHAR}, - - - #{email,jdbcType=VARCHAR}, - - - #{wxId,jdbcType=VARCHAR}, - - - #{wxUnionId,jdbcType=VARCHAR}, - - - #{wmOpenId,jdbcType=VARCHAR}, - - - #{status,jdbcType=VARCHAR}, - - - #{roles,jdbcType=VARCHAR}, - - - #{source,jdbcType=VARCHAR}, - - - #{createTime,jdbcType=TIMESTAMP}, - - - #{updateUserId,jdbcType=BIGINT}, - - - #{updateTime,jdbcType=TIMESTAMP}, - - - - - - update sys_account - - - id = #{record.id,jdbcType=BIGINT}, - - + + from sys_account + + + + + order by ${orderByClause} + + + + limit ${offset}, ${limit} + + + limit ${limit} + + + + + + delete from sys_account + where id = #{id,jdbcType=BIGINT} + + + delete from sys_account + + + + + + insert into sys_account (account, parent_account, `type`, + `name`, nickname, + avatar_path, `password`, mobile, + nationcode, email, wx_id, + wx_union_id, wm_open_id, `status`, + roles, `source`, create_time, + update_user_id, update_time) + values (#{account,jdbcType=VARCHAR}, #{parentAccount,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, + #{avatarPath,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, + #{nationcode,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{wxId,jdbcType=VARCHAR}, + #{wxUnionId,jdbcType=VARCHAR}, #{wmOpenId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, + #{roles,jdbcType=VARCHAR}, #{source,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, + #{updateUserId,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}) + + + insert into sys_account + + + account, + + + parent_account, + + + `type`, + + + `name`, + + + nickname, + + + avatar_path, + + + `password`, + + + mobile, + + + nationcode, + + + email, + + + wx_id, + + + wx_union_id, + + + wm_open_id, + + + `status`, + + + roles, + + + `source`, + + + create_time, + + + update_user_id, + + + update_time, + + + + + #{account,jdbcType=VARCHAR}, + + + #{parentAccount,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{nickname,jdbcType=VARCHAR}, + + + #{avatarPath,jdbcType=VARCHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{mobile,jdbcType=VARCHAR}, + + + #{nationcode,jdbcType=VARCHAR}, + + + #{email,jdbcType=VARCHAR}, + + + #{wxId,jdbcType=VARCHAR}, + + + #{wxUnionId,jdbcType=VARCHAR}, + + + #{wmOpenId,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{roles,jdbcType=VARCHAR}, + + + #{source,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateUserId,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + update sys_account + + + id = #{record.id,jdbcType=BIGINT}, + + + account = #{record.account,jdbcType=VARCHAR}, + + + parent_account = #{record.parentAccount,jdbcType=VARCHAR}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + nickname = #{record.nickname,jdbcType=VARCHAR}, + + + avatar_path = #{record.avatarPath,jdbcType=VARCHAR}, + + + `password` = #{record.password,jdbcType=VARCHAR}, + + + mobile = #{record.mobile,jdbcType=VARCHAR}, + + + nationcode = #{record.nationcode,jdbcType=VARCHAR}, + + + email = #{record.email,jdbcType=VARCHAR}, + + + wx_id = #{record.wxId,jdbcType=VARCHAR}, + + + wx_union_id = #{record.wxUnionId,jdbcType=VARCHAR}, + + + wm_open_id = #{record.wmOpenId,jdbcType=VARCHAR}, + + + `status` = #{record.status,jdbcType=VARCHAR}, + + + roles = #{record.roles,jdbcType=VARCHAR}, + + + `source` = #{record.source,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_user_id = #{record.updateUserId,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + update sys_account + set id = #{record.id,jdbcType=BIGINT}, account = #{record.account,jdbcType=VARCHAR}, - - parent_account = #{record.parentAccount,jdbcType=VARCHAR}, - - `type` = #{record.type,jdbcType=VARCHAR}, - - - org_id = #{record.orgId,jdbcType=BIGINT}, - - `name` = #{record.name,jdbcType=VARCHAR}, - - nickname = #{record.nickname,jdbcType=VARCHAR}, - - avatar_path = #{record.avatarPath,jdbcType=VARCHAR}, - - `password` = #{record.password,jdbcType=VARCHAR}, - - mobile = #{record.mobile,jdbcType=VARCHAR}, - - nationcode = #{record.nationcode,jdbcType=VARCHAR}, - - email = #{record.email,jdbcType=VARCHAR}, - - wx_id = #{record.wxId,jdbcType=VARCHAR}, - - wx_union_id = #{record.wxUnionId,jdbcType=VARCHAR}, - - wm_open_id = #{record.wmOpenId,jdbcType=VARCHAR}, - - `status` = #{record.status,jdbcType=VARCHAR}, - - roles = #{record.roles,jdbcType=VARCHAR}, - - `source` = #{record.source,jdbcType=VARCHAR}, - - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - - update_user_id = #{record.updateUserId,jdbcType=BIGINT}, - - - update_time = #{record.updateTime,jdbcType=TIMESTAMP}, - - - - - - - - update sys_account - set id = #{record.id,jdbcType=BIGINT}, - account = #{record.account,jdbcType=VARCHAR}, - parent_account = #{record.parentAccount,jdbcType=VARCHAR}, - `type` = #{record.type,jdbcType=VARCHAR}, - org_id = #{record.orgId,jdbcType=BIGINT}, - `name` = #{record.name,jdbcType=VARCHAR}, - nickname = #{record.nickname,jdbcType=VARCHAR}, - avatar_path = #{record.avatarPath,jdbcType=VARCHAR}, - `password` = #{record.password,jdbcType=VARCHAR}, - mobile = #{record.mobile,jdbcType=VARCHAR}, - nationcode = #{record.nationcode,jdbcType=VARCHAR}, - email = #{record.email,jdbcType=VARCHAR}, - wx_id = #{record.wxId,jdbcType=VARCHAR}, - wx_union_id = #{record.wxUnionId,jdbcType=VARCHAR}, - wm_open_id = #{record.wmOpenId,jdbcType=VARCHAR}, - `status` = #{record.status,jdbcType=VARCHAR}, - roles = #{record.roles,jdbcType=VARCHAR}, - `source` = #{record.source,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=TIMESTAMP}, - update_user_id = #{record.updateUserId,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=TIMESTAMP} - - - - - - update sys_account - - - account = #{account,jdbcType=VARCHAR}, - - + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + update sys_account + + + account = #{account,jdbcType=VARCHAR}, + + + parent_account = #{parentAccount,jdbcType=VARCHAR}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + `name` = #{name,jdbcType=VARCHAR}, + + + nickname = #{nickname,jdbcType=VARCHAR}, + + + avatar_path = #{avatarPath,jdbcType=VARCHAR}, + + + `password` = #{password,jdbcType=VARCHAR}, + + + mobile = #{mobile,jdbcType=VARCHAR}, + + + nationcode = #{nationcode,jdbcType=VARCHAR}, + + + email = #{email,jdbcType=VARCHAR}, + + + wx_id = #{wxId,jdbcType=VARCHAR}, + + + wx_union_id = #{wxUnionId,jdbcType=VARCHAR}, + + + wm_open_id = #{wmOpenId,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + roles = #{roles,jdbcType=VARCHAR}, + + + `source` = #{source,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_user_id = #{updateUserId,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=BIGINT} + + + update sys_account + set account = #{account,jdbcType=VARCHAR}, parent_account = #{parentAccount,jdbcType=VARCHAR}, - - `type` = #{type,jdbcType=VARCHAR}, - - - org_id = #{orgId,jdbcType=BIGINT}, - - `name` = #{name,jdbcType=VARCHAR}, - - nickname = #{nickname,jdbcType=VARCHAR}, - - avatar_path = #{avatarPath,jdbcType=VARCHAR}, - - `password` = #{password,jdbcType=VARCHAR}, - - mobile = #{mobile,jdbcType=VARCHAR}, - - nationcode = #{nationcode,jdbcType=VARCHAR}, - - email = #{email,jdbcType=VARCHAR}, - - wx_id = #{wxId,jdbcType=VARCHAR}, - - wx_union_id = #{wxUnionId,jdbcType=VARCHAR}, - - wm_open_id = #{wmOpenId,jdbcType=VARCHAR}, - - `status` = #{status,jdbcType=VARCHAR}, - - roles = #{roles,jdbcType=VARCHAR}, - - `source` = #{source,jdbcType=VARCHAR}, - - create_time = #{createTime,jdbcType=TIMESTAMP}, - - update_user_id = #{updateUserId,jdbcType=BIGINT}, - - - update_time = #{updateTime,jdbcType=TIMESTAMP}, - - - where id = #{id,jdbcType=BIGINT} - - - update sys_account - set account = #{account,jdbcType=VARCHAR}, - parent_account = #{parentAccount,jdbcType=VARCHAR}, - `type` = #{type,jdbcType=VARCHAR}, - org_id = #{orgId,jdbcType=BIGINT}, - `name` = #{name,jdbcType=VARCHAR}, - nickname = #{nickname,jdbcType=VARCHAR}, - avatar_path = #{avatarPath,jdbcType=VARCHAR}, - `password` = #{password,jdbcType=VARCHAR}, - mobile = #{mobile,jdbcType=VARCHAR}, - nationcode = #{nationcode,jdbcType=VARCHAR}, - email = #{email,jdbcType=VARCHAR}, - wx_id = #{wxId,jdbcType=VARCHAR}, - wx_union_id = #{wxUnionId,jdbcType=VARCHAR}, - wm_open_id = #{wmOpenId,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - roles = #{roles,jdbcType=VARCHAR}, - `source` = #{source,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=TIMESTAMP}, - update_user_id = #{updateUserId,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=TIMESTAMP} - where id = #{id,jdbcType=BIGINT} - + update_time = #{updateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + \ No newline at end of file