fix: 保留新建用户选择的部门
- 创建账号时保留表单提交的部门归属 - 补充跨部门创建回归测试
This commit is contained in:
@@ -67,9 +67,7 @@ public class SysAccountController extends BaseCurdController<SysAccountService,
|
||||
@Override
|
||||
protected Result onSaveOrUpdateBefore(SysAccount entity, boolean isSave) {
|
||||
LoginAccount loginUser = SaTokenUtil.getLoginAccount();
|
||||
BigInteger tenantId = loginUser.getTenantId();
|
||||
if (isSave) {
|
||||
commonFiled(entity, loginUser.getId(), tenantId, loginUser.getDeptId());
|
||||
// 查询用户名是否存在
|
||||
// long count = Db.selectCount(SqlPrepare.COUNT_ACCOUNT_BY_UNI_KEY, entity.getLoginName(), tenantId);
|
||||
QueryWrapper w = QueryWrapper.create();
|
||||
@@ -109,6 +107,23 @@ public class SysAccountController extends BaseCurdController<SysAccountService,
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 填充账号创建的公共字段。
|
||||
*
|
||||
* <p>账号部门由管理端表单指定;只有未提交部门时才沿用通用创建流程的默认部门。</p>
|
||||
*
|
||||
* @param entity 待创建的账号
|
||||
* @param loginAccount 当前登录账号
|
||||
*/
|
||||
@Override
|
||||
protected void fillCreateCommonFields(SysAccount entity, LoginAccount loginAccount) {
|
||||
BigInteger selectedDeptId = entity.getDeptId();
|
||||
super.fillCreateCommonFields(entity, loginAccount);
|
||||
if (selectedDeptId != null) {
|
||||
entity.setDeptId(selectedDeptId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveOrUpdateAfter(SysAccount entity, boolean isSave) {
|
||||
service.syncRelations(entity);
|
||||
|
||||
Reference in New Issue
Block a user