【8.1.1】【sys】更新批量保存用户角色

pull/60/head
fengshuonan 2024-02-12 23:19:56 +08:00
parent b1d5cd9b4a
commit 993dcd4f2a
3 changed files with 21 additions and 0 deletions

View File

@ -59,4 +59,12 @@ public interface SysUserRoleService extends IService<SysUserRole>, SysUserRoleSe
*/
void updateOtherOrgBusinessRole(Long userId, Long excludeOrgId, List<NewUserRoleBindItem> currentOrgBindRoleList);
/**
*
*
* @author fengshuonan
* @since 2024/2/12 23:13
*/
void quickBatchSaveUserRole(List<SysUserRole> batchUserRole);
}

View File

@ -4,8 +4,10 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
import cn.stylefeng.roses.kernel.dsctn.api.context.DataSourceContext;
import cn.stylefeng.roses.kernel.event.sdk.publish.BusinessEventPublisher;
import cn.stylefeng.roses.kernel.log.api.util.BusinessLogUtil;
import cn.stylefeng.roses.kernel.rule.enums.DbTypeEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.sys.api.SysRoleLimitServiceApi;
import cn.stylefeng.roses.kernel.sys.api.SysRoleServiceApi;
@ -339,6 +341,16 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
userRoleCache.remove(userId.toString());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void quickBatchSaveUserRole(List<SysUserRole> batchUserRole) {
if (DbTypeEnum.MYSQL.equals(DataSourceContext.me().getCurrentDbType())) {
this.getBaseMapper().insertBatchSomeColumn(batchUserRole);
} else {
this.saveBatch(batchUserRole);
}
}
/**
*
*

View File

@ -412,6 +412,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
@Override
@Transactional(rollbackFor = Exception.class)
public void quickBatchSaveUser(List<SysUser> batchUser) {
if (DbTypeEnum.MYSQL.equals(DataSourceContext.me().getCurrentDbType())) {
this.getBaseMapper().insertBatchSomeColumn(batchUser);