数据表自动迁移

This commit is contained in:
xxx
2023-08-27 13:28:13 +08:00
parent 2e0801fb57
commit 1d31045807
14 changed files with 982 additions and 390 deletions

View File

@@ -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);

View File

@@ -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) {