mirror of
https://github.com/PlayEdu/PlayEdu
synced 2026-02-03 15:22:19 +08:00
数据表自动迁移
This commit is contained in:
@@ -31,6 +31,8 @@ public interface AdminRoleService extends IService<AdminRole> {
|
||||
|
||||
AdminRole getBySlug(String slug);
|
||||
|
||||
Integer initSuperAdminRole();
|
||||
|
||||
void createWithPermissionIds(String name, Integer[] permissionIds);
|
||||
|
||||
void relatePermissions(AdminRole role, Integer[] permissionIds);
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import xyz.playedu.common.constant.BackendConstant;
|
||||
import xyz.playedu.common.domain.AdminRole;
|
||||
import xyz.playedu.common.domain.AdminRolePermission;
|
||||
import xyz.playedu.common.exception.NotFoundException;
|
||||
@@ -53,6 +54,20 @@ public class AdminRoleServiceImpl extends ServiceImpl<AdminRoleMapper, AdminRole
|
||||
return getOne(query().getWrapper().eq("slug", slug));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer initSuperAdminRole() {
|
||||
AdminRole role = new AdminRole();
|
||||
|
||||
role.setName("超级管理员");
|
||||
role.setSlug(BackendConstant.SUPER_ADMIN_ROLE);
|
||||
role.setCreatedAt(new Date());
|
||||
role.setUpdatedAt(new Date());
|
||||
|
||||
save(role);
|
||||
|
||||
return role.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void createWithPermissionIds(String name, Integer[] permissionIds) {
|
||||
|
||||
Reference in New Issue
Block a user