Browse Source
* 变更工作台组件. * 工作台加入天气, 需要适配天气api接口. * 将 withAcceptLanguage 加入axios中, 用户自行决定是否加入头. * Platform模块新增用户收藏菜单接口,使用前需要切换目录 PlatformManagement.HttpApi.Host,运行命令行 **dotnet ef database update** 或 **dotnet ef migrations script**执行迁移pull/700/head
55 changed files with 2000 additions and 131 deletions
@ -0,0 +1,75 @@ |
|||
/* |
|||
天气接口 |
|||
数据来源: http://www.nmc.cn (中央气象台)
|
|||
*/ |
|||
import { defHttp } from '/@/utils/http/axios'; |
|||
import { Position, Province, WeatherResult } from './model'; |
|||
import { format } from '/@/utils/strings'; |
|||
|
|||
//const Host = 'http://www.nmc.cn';
|
|||
const Api = { |
|||
GetProvinces: '/wapi/rest/province/all', |
|||
GetPosition: '/wapi/rest/position', |
|||
GetCitys: '/wapi/rest/province/{province}', |
|||
GetWeather: '/wapi/rest/weather?stationid={code}', |
|||
}; |
|||
|
|||
export const getProvinces = () => { |
|||
return defHttp.get<Province[]>({ |
|||
url: Api.GetProvinces, |
|||
//baseURL: Host,
|
|||
headers: { |
|||
'X-Requested-With': 'XMLHttpRequest' |
|||
} |
|||
}, { |
|||
apiUrl: '', |
|||
joinTime: false, |
|||
withToken: false, |
|||
withAcceptLanguage: false, |
|||
}); |
|||
}; |
|||
|
|||
export const getPosition = () => { |
|||
return defHttp.get<Position>({ |
|||
url: Api.GetPosition, |
|||
//baseURL: Host,
|
|||
headers: { |
|||
'X-Requested-With': 'XMLHttpRequest', |
|||
} |
|||
}, { |
|||
apiUrl: '', |
|||
joinTime: false, |
|||
withToken: false, |
|||
withAcceptLanguage: false, |
|||
}); |
|||
} |
|||
|
|||
export const getCitys = (provinceCode: string) => { |
|||
return defHttp.get<Position[]>({ |
|||
url: format(Api.GetCitys, {province: provinceCode}), |
|||
//baseURL: Host,
|
|||
headers: { |
|||
'X-Requested-With': 'XMLHttpRequest' |
|||
} |
|||
}, { |
|||
apiUrl: '', |
|||
joinTime: false, |
|||
withToken: false, |
|||
withAcceptLanguage: false, |
|||
}); |
|||
} |
|||
|
|||
export const getWeather = (cityCode: string) => { |
|||
return defHttp.get<WeatherResult>({ |
|||
url: format(Api.GetWeather, {code: cityCode}), |
|||
//baseURL: Host,
|
|||
headers: { |
|||
'X-Requested-With': 'XMLHttpRequest' |
|||
} |
|||
}, { |
|||
apiUrl: '', |
|||
joinTime: false, |
|||
withToken: false, |
|||
withAcceptLanguage: false, |
|||
}); |
|||
} |
|||
@ -0,0 +1,101 @@ |
|||
/* |
|||
天气数据模型 |
|||
数据来源: http://www.nmc.cn (中央气象台)
|
|||
*/ |
|||
|
|||
/** |
|||
* 定位 |
|||
*/ |
|||
export interface Position { |
|||
/** 城市 */ |
|||
city: string; |
|||
/** 代码 */ |
|||
code: string; |
|||
/** 省份 */ |
|||
province: string; |
|||
/** 专用页面 */ |
|||
url: string; |
|||
} |
|||
|
|||
/** |
|||
* 省份 |
|||
*/ |
|||
export interface Province { |
|||
/** 代码 */ |
|||
code: string; |
|||
/** 名称 */ |
|||
name: string; |
|||
/** 专用页面 */ |
|||
url: string; |
|||
} |
|||
|
|||
export interface Air { |
|||
aq: number; |
|||
aqi: number; |
|||
aqiCode: string; |
|||
forecasttime: Date; |
|||
text: string; |
|||
} |
|||
|
|||
export interface Weather { |
|||
airpressure: number; |
|||
feelst: number; |
|||
humidity: number; |
|||
icomfort: number; |
|||
img: string; |
|||
info: string; |
|||
rain: number; |
|||
rcomfort: number; |
|||
temperature: number; |
|||
temperatureDiff: number; |
|||
} |
|||
|
|||
export interface Wind { |
|||
degree: number; |
|||
direct: string; |
|||
power: string; |
|||
speed: number; |
|||
} |
|||
|
|||
export interface PredictDetail { |
|||
date: Date; |
|||
pt: Date; |
|||
day: { weather: Weather; wind: Wind }; |
|||
night: { weather: Weather; wind: Wind }; |
|||
} |
|||
|
|||
export interface Predict { |
|||
detail: PredictDetail[]; |
|||
publish_time: Date; |
|||
station: Position; |
|||
} |
|||
|
|||
export interface Real { |
|||
publish_time: Date; |
|||
station: Position; |
|||
weather: Weather; |
|||
wind: Wind; |
|||
} |
|||
|
|||
export interface Tempchart { |
|||
day_img: string; |
|||
day_text: string; |
|||
max_temp: number; |
|||
min_temp: number; |
|||
night_img: string; |
|||
night_text: string; |
|||
time: Date; |
|||
} |
|||
|
|||
export interface WeatherInfo { |
|||
air: Air; |
|||
predict: Predict; |
|||
real: Real; |
|||
tempchart: Tempchart; |
|||
} |
|||
|
|||
export interface WeatherResult { |
|||
code: number; |
|||
msg: string; |
|||
data: WeatherInfo; |
|||
} |
|||
@ -1,6 +1,25 @@ |
|||
export default { |
|||
dashboard: 'Dashboard', |
|||
about: 'About', |
|||
workbench: 'Workbench', |
|||
workbench: { |
|||
title: 'Workbench', |
|||
header: { |
|||
welcomeMorning: 'Good morning, {0}. Begin your day~', |
|||
welcomeAtoon: 'Good afternoon, {0}, pay attention to rest oh~', |
|||
welcomeAfternoon: 'Good afternoon, {0}, relax in time, can improve work efficiency~', |
|||
welcomeEvening: 'Good evening, {0}. Still at work? The off work~', |
|||
todayWeather: '{city} today {weather}, {temperature} ℃, {wind}, speed {speed}', |
|||
notifier: { |
|||
title: 'notifier', |
|||
count: '({0})', |
|||
} |
|||
}, |
|||
menus: { |
|||
more: 'More', |
|||
addMenu: 'Add new menu', |
|||
manager: 'Manage menu', |
|||
selectMenu: '选择菜单' |
|||
} |
|||
}, |
|||
analysis: 'Analysis', |
|||
}; |
|||
|
|||
@ -1,6 +1,25 @@ |
|||
export default { |
|||
dashboard: 'Dashboard', |
|||
about: '关于', |
|||
workbench: '工作台', |
|||
workbench: { |
|||
title: '工作台', |
|||
header: { |
|||
welcomeMorning: '早安, {0}, 开始您一天的工作吧~', |
|||
welcomeAtoon: '中午好, {0}, 注意休息哦~', |
|||
welcomeAfternoon: '下午好, {0}, 适时放松,可以提高工作效率~', |
|||
welcomeEvening: '晚上好, {0}, 还在工作么?该下班了~', |
|||
todayWeather: '{city} 今日 {weather}, {temperature} ℃, {wind}, 风速 {speed}', |
|||
notifier: { |
|||
title: '通知', |
|||
count: '({0})', |
|||
} |
|||
}, |
|||
menus: { |
|||
more: '更多', |
|||
addMenu: '添加菜单', |
|||
manager: '管理菜单', |
|||
selectMenu: '选择菜单' |
|||
} |
|||
}, |
|||
analysis: '分析页', |
|||
}; |
|||
|
|||
@ -0,0 +1,36 @@ |
|||
import { defineStore } from 'pinia'; |
|||
import { Position, WeatherInfo } from '/@/api/weather/model'; |
|||
import { getPosition, getWeather } from '/@/api/weather'; |
|||
|
|||
interface WeatherState { |
|||
currentCity?: Position; |
|||
weather?: WeatherInfo; |
|||
lastUpdateHour: number; |
|||
} |
|||
|
|||
export const useWeatherStore = defineStore({ |
|||
id: 'weather', |
|||
state: (): WeatherState => ({ |
|||
currentCity: undefined, |
|||
weather: undefined, |
|||
lastUpdateHour: -1, |
|||
}), |
|||
actions: { |
|||
async updateWeather() { |
|||
const hour = new Date().getHours(); |
|||
if (hour - this.lastUpdateHour != 0) { |
|||
const position = await getPosition(); |
|||
const weatherResult = await getWeather(position.code); |
|||
if (weatherResult.code !== 0) { |
|||
return Promise.reject(weatherResult.msg); |
|||
} |
|||
this.currentCity = position; |
|||
this.weather = weatherResult.data; |
|||
this.lastUpdateHour = hour; |
|||
return Promise.resolve(this.weather); |
|||
} else { |
|||
return Promise.resolve(this.weather); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
@ -0,0 +1,76 @@ |
|||
<template> |
|||
<div> |
|||
<Card :title="title" class="menu-card"> |
|||
<template #extra> |
|||
<Button type="link" @click="handleManageMenu">{{ t('routes.dashboard.workbench.menus.more') }}</Button> |
|||
</template> |
|||
<CardGrid v-for="menu in menus" :key="menu.title" class="menu-card-grid"> |
|||
<span class="flex"> |
|||
<Icon :icon="menu.icon" :color="menu.color" :size="menu.size ?? 30" /> |
|||
<span class="text-lg ml-4">{{ menu.title }}</span> |
|||
</span> |
|||
<div v-if="menu.desc" class="flex mt-2 h-10 text-secondary">{{ menu.desc }}</div> |
|||
</CardGrid> |
|||
<CardGrid class="menu-card-grid" @click="handleAddNew"> |
|||
<span class="flex"> |
|||
<Icon icon="ion:add-outline" color="#00BFFF" :size="30" /> |
|||
<span class="text-lg ml-4">{{ t('routes.dashboard.workbench.menus.addMenu') }}</span> |
|||
</span> |
|||
</CardGrid> |
|||
</Card> |
|||
<MenuReference @register="registerReference" @change="handleChange" /> |
|||
</div> |
|||
</template> |
|||
<script lang="ts" setup> |
|||
import { Button, Card } from 'ant-design-vue'; |
|||
import { Icon } from '/@/components/Icon'; |
|||
import { useI18n } from '/@/hooks/web/useI18n'; |
|||
import { useModal } from '/@/components/Modal'; |
|||
import MenuReference from './MenuReference.vue'; |
|||
|
|||
const CardGrid = Card.Grid; |
|||
|
|||
interface Menu { |
|||
title: string; |
|||
desc?: string; |
|||
icon?: string; |
|||
color?: string; |
|||
size?: number; |
|||
} |
|||
|
|||
const emits = defineEmits(['change', 'register']); |
|||
const props = defineProps({ |
|||
title: { |
|||
type: String, |
|||
required: true, |
|||
}, |
|||
menus: { |
|||
type: Array as PropType<Menu[]>, |
|||
default: [], |
|||
} |
|||
}); |
|||
|
|||
const { t } = useI18n(); |
|||
const [registerReference, { openModal: openReferenceModal }] = useModal(); |
|||
|
|||
function handleManageMenu() { |
|||
openReferenceModal(true, { defaultCheckedKeys: props.menus }); |
|||
} |
|||
|
|||
function handleAddNew() { |
|||
openReferenceModal(true, { radio: true }); |
|||
} |
|||
|
|||
function handleChange(menus) { |
|||
console.log(menus); |
|||
emits('change', menus); |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
.menu-card-grid { |
|||
margin: 10px; |
|||
width: 30%; |
|||
cursor: pointer; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,86 @@ |
|||
<template> |
|||
<BasicModal |
|||
v-bind="$attrs" |
|||
@register="registerModal" |
|||
:title="t('routes.dashboard.workbench.menus.manager')" |
|||
:width="500" |
|||
@ok="handleSubmit" |
|||
> |
|||
<Form :model="formModel" ref="formElRef"> |
|||
<Form.Item :label-col="{ span: 3 }" :wrapper-col="{ span: 20 }" :label="t('routes.dashboard.workbench.menus.selectMenu')" name="menus"> |
|||
<ATree |
|||
checkable |
|||
checkStrictly |
|||
:tree-data="menuTreeData" |
|||
:fieldNames="{ |
|||
title: 'displayName', |
|||
key: 'id', |
|||
}" |
|||
v-model:checkedKeys="formModel.menus" |
|||
:selectedKeys="defaultCheckedKeys" |
|||
@check="handleMenuCheck" /> |
|||
</Form.Item> |
|||
</Form> |
|||
</BasicModal> |
|||
</template> |
|||
|
|||
<script lang="ts" setup> |
|||
import { reactive, ref, unref } from 'vue'; |
|||
import { useI18n } from '/@/hooks/web/useI18n'; |
|||
import { Form, Tree } from 'ant-design-vue'; |
|||
import { BasicModal, useModalInner } from '/@/components/Modal'; |
|||
import { getMenuList } from '/@/api/sys/menu'; |
|||
import { listToTree } from '/@/utils/helper/treeHelper'; |
|||
|
|||
const ATree = Tree; |
|||
|
|||
const emits = defineEmits(['change', 'change:keys', 'register']); |
|||
const { t } = useI18n(); |
|||
const formModel = reactive({ |
|||
menus: [] as string[], |
|||
}); |
|||
const formElRef = ref<any>(null); |
|||
const menuTreeData = ref<any[]>([]); |
|||
const radio = ref(false); |
|||
const defaultCheckedKeys = ref<string[]>([]); |
|||
const checkedMenus = ref<any[]>([]); |
|||
const [registerModal, { closeModal }] = useModalInner((props) => { |
|||
init(props); |
|||
fetchMyMenus(); |
|||
}); |
|||
|
|||
function init(props) { |
|||
formModel.menus = []; |
|||
checkedMenus.value = []; |
|||
radio.value = props.radio ?? false; |
|||
defaultCheckedKeys.value = props.defaultCheckedKeys ?? []; |
|||
} |
|||
|
|||
function fetchMyMenus() { |
|||
getMenuList().then((res) => { |
|||
const treeData = listToTree(res.items, { id: 'id', pid: 'parentId' }); |
|||
menuTreeData.value = treeData; |
|||
}) |
|||
} |
|||
|
|||
function handleSubmit() { |
|||
const formEl = unref(formElRef); |
|||
formEl?.validate().then(() => { |
|||
emits('change:keys', formModel.menus); |
|||
emits('change', checkedMenus.value); |
|||
closeModal(); |
|||
}); |
|||
} |
|||
|
|||
function handleMenuCheck(checkedKeys, e) { |
|||
if (checkedKeys.checked.length > 1 && radio.value) { |
|||
const menu = checkedKeys.checked.pop(); |
|||
formModel.menus = [menu!]; |
|||
} |
|||
checkedMenus.value = e.checkedNodes; |
|||
} |
|||
</script> |
|||
|
|||
<style lang="less" scoped> |
|||
|
|||
</style> |
|||
@ -0,0 +1,28 @@ |
|||
using LINGYUN.Platform.Menus; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Abp.UI.Navigation.VueVbenAdmin; |
|||
|
|||
[Dependency(ReplaceServices = true)] |
|||
public class VueVbenAdminStandardMenuConverter : IStandardMenuConverter, ISingletonDependency |
|||
{ |
|||
public StandardMenu Convert(Menu menu) |
|||
{ |
|||
var standardMenu = new StandardMenu |
|||
{ |
|||
Icon = "", |
|||
Name = menu.Name, |
|||
Path = menu.Path, |
|||
DisplayName = menu.DisplayName, |
|||
Description = menu.Description, |
|||
Redirect = menu.Redirect, |
|||
}; |
|||
|
|||
if (menu.ExtraProperties.TryGetValue("icon", out var icon)) |
|||
{ |
|||
standardMenu.Icon = icon.ToString(); |
|||
} |
|||
|
|||
return standardMenu; |
|||
} |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
using System; |
|||
using Volo.Abp.Application.Dtos; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public class UserFavoriteMenuDto : AuditedEntityDto<Guid> |
|||
{ |
|||
public Guid MenuId { get; set; } |
|||
|
|||
public Guid UserId { get; set; } |
|||
|
|||
public string Framework { get; set; } |
|||
|
|||
public string Name { get; set; } |
|||
|
|||
public string DisplayName { get; set; } |
|||
|
|||
public string Path { get; set; } |
|||
|
|||
public string Icon { get; set; } |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
using LINGYUN.Platform.Routes; |
|||
using Volo.Abp.Validation; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
public class UserFavoriteMenuGetListInput |
|||
{ |
|||
[DynamicStringLength(typeof(LayoutConsts), nameof(LayoutConsts.MaxFrameworkLength))] |
|||
public string Framework { get; set; } |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public class UserFavoriteMenuSetInput |
|||
{ |
|||
public string Framework { get; set; } |
|||
|
|||
public List<Guid> MenuIds { get; set; } = new List<Guid>(); |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
using LINGYUN.Platform.Routes; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Platform.Layouts |
|||
{ |
|||
[EventName("platform.layouts.layout")] |
|||
public class LayoutEto : RouteEto |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
using LINGYUN.Platform.Routes; |
|||
using Volo.Abp.EventBus; |
|||
|
|||
namespace LINGYUN.Platform.Menus |
|||
{ |
|||
[EventName("platform.menus.menu")] |
|||
public class MenuEto : RouteEto |
|||
{ |
|||
public string Framework { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Platform.Menus |
|||
{ |
|||
[EventName("platform.menus.role_menu")] |
|||
public class RoleMenuEto : IMultiTenant |
|||
{ |
|||
public Guid? TenantId { get; set; } |
|||
public Guid MenuId { get; set; } |
|||
public string RoleName { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
using System; |
|||
using Volo.Abp.EventBus; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Platform.Menus |
|||
{ |
|||
[EventName("platform.menus.user_menu")] |
|||
public class UserMenuEto : IMultiTenant |
|||
{ |
|||
public Guid? TenantId { get; set; } |
|||
public Guid MenuId { get; set; } |
|||
public Guid UserId { get; set; } |
|||
} |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Platform.Routes |
|||
{ |
|||
public class RoleRouteEto : IMultiTenant |
|||
{ |
|||
public Guid? TenantId { get; set; } |
|||
public Guid RouteId { get; set; } |
|||
public string RoleName { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
namespace LINGYUN.Platform.Routes; |
|||
public class UserFavoriteMenuConsts |
|||
{ |
|||
public static int MaxIconLength { get; set; } = 512; |
|||
} |
|||
@ -1,12 +0,0 @@ |
|||
using System; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Platform.Routes |
|||
{ |
|||
public class UserRouteEto : IMultiTenant |
|||
{ |
|||
public Guid? TenantId { get; set; } |
|||
public Guid RouteId { get; set; } |
|||
public Guid UserId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
[Dependency(TryRegister = true)] |
|||
public class DefaultStandardMenuConverter : IStandardMenuConverter, ISingletonDependency |
|||
{ |
|||
public StandardMenu Convert(Menu menu) |
|||
{ |
|||
return new StandardMenu |
|||
{ |
|||
Icon = "", |
|||
Name = menu.Name, |
|||
Path = menu.Path, |
|||
DisplayName = menu.DisplayName, |
|||
Description = menu.Description, |
|||
Redirect = menu.Redirect, |
|||
}; |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public interface IStandardMenuConverter |
|||
{ |
|||
StandardMenu Convert(Menu menu); |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public interface IUserFavoriteMenuRepository : IBasicRepository<UserFavoriteMenu, Guid> |
|||
{ |
|||
Task<List<UserFavoriteMenu>> GetListByMenuIdAsync( |
|||
Guid menuId, |
|||
CancellationToken cancellationToken = default); |
|||
|
|||
Task<List<UserFavoriteMenu>> GetFavoriteMenusAsync( |
|||
Guid userId, |
|||
string framework = null, |
|||
Guid? menuId = null, |
|||
CancellationToken cancellationToken = default); |
|||
} |
|||
@ -0,0 +1,71 @@ |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.Domain.Entities.Events.Distributed; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
using Volo.Abp.Uow; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public class MenuChangeHandler : |
|||
IDistributedEventHandler<EntityUpdatedEto<MenuEto>>, |
|||
IDistributedEventHandler<EntityDeletedEto<MenuEto>>, |
|||
IDistributedEventHandler<EntityDeletedEto<UserMenuEto>>, |
|||
ITransientDependency |
|||
{ |
|||
private readonly IMenuRepository _menuRepository; |
|||
private readonly IStandardMenuConverter _standardMenuConverter; |
|||
private readonly IUserFavoriteMenuRepository _userFavoriteMenuRepository; |
|||
|
|||
public MenuChangeHandler( |
|||
IMenuRepository menuRepository, |
|||
IStandardMenuConverter standardMenuConverter, |
|||
IUserFavoriteMenuRepository userFavoriteMenuRepository) |
|||
{ |
|||
_menuRepository = menuRepository; |
|||
_standardMenuConverter = standardMenuConverter; |
|||
_userFavoriteMenuRepository = userFavoriteMenuRepository; |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async virtual Task HandleEventAsync(EntityUpdatedEto<MenuEto> eventData) |
|||
{ |
|||
// 菜单变更同步变更收藏菜单
|
|||
var menu = await _menuRepository.GetAsync(eventData.Entity.Id); |
|||
var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync(menu.Id); |
|||
|
|||
var standardMenu = _standardMenuConverter.Convert(menu); |
|||
|
|||
foreach (var favoriteMenu in favoriteMenus) |
|||
{ |
|||
favoriteMenu.Framework = menu.Framework; |
|||
|
|||
favoriteMenu.Name = standardMenu.Name; |
|||
favoriteMenu.Path = standardMenu.Path; |
|||
favoriteMenu.Icon = standardMenu.Icon; |
|||
favoriteMenu.DisplayName = standardMenu.DisplayName; |
|||
} |
|||
|
|||
await _userFavoriteMenuRepository.UpdateManyAsync(favoriteMenus); |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async virtual Task HandleEventAsync(EntityDeletedEto<MenuEto> eventData) |
|||
{ |
|||
// 菜单删除同步删除收藏菜单
|
|||
|
|||
var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync(eventData.Entity.Id); |
|||
|
|||
await _userFavoriteMenuRepository.DeleteManyAsync(favoriteMenus); |
|||
} |
|||
|
|||
[UnitOfWork] |
|||
public async virtual Task HandleEventAsync(EntityDeletedEto<UserMenuEto> eventData) |
|||
{ |
|||
// 用户菜单删除同步删除收藏菜单
|
|||
|
|||
var favoriteMenus = await _userFavoriteMenuRepository.GetListByMenuIdAsync( |
|||
eventData.Entity.UserId); |
|||
|
|||
await _userFavoriteMenuRepository.DeleteManyAsync(favoriteMenus); |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace LINGYUN.Platform.Menus; |
|||
public class StandardMenu |
|||
{ |
|||
public string Icon { get; set; } |
|||
public string Path { get; set; } |
|||
public string Name { get; set; } |
|||
public string DisplayName { get; set; } |
|||
public string Description { get; set; } |
|||
public string Redirect { get; set; } |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using Volo.Abp.Domain.Entities.Auditing; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
|
|||
public class UserFavoriteMenu : AuditedEntity<Guid>, IMultiTenant |
|||
{ |
|||
public virtual Guid? TenantId { get; protected set; } |
|||
|
|||
public virtual Guid MenuId { get; protected set; } |
|||
|
|||
public virtual Guid UserId { get; protected set; } |
|||
|
|||
public virtual string Framework { get; set; } |
|||
|
|||
public virtual string Name { get; set; } |
|||
|
|||
public virtual string DisplayName { get; set; } |
|||
|
|||
public virtual string Path { get; set; } |
|||
|
|||
public virtual string Icon { get; set; } |
|||
|
|||
protected UserFavoriteMenu() { } |
|||
public UserFavoriteMenu( |
|||
Guid id, |
|||
Guid menuId, |
|||
Guid userId, |
|||
string framework, |
|||
string name, |
|||
string displayName, |
|||
string path, |
|||
string icon, |
|||
Guid? tenantId = null) |
|||
: base(id) |
|||
{ |
|||
MenuId = menuId; |
|||
UserId = userId; |
|||
Framework = framework; |
|||
Name = name; |
|||
DisplayName = displayName; |
|||
Path = path; |
|||
Icon = icon; |
|||
TenantId = tenantId; |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
using LINGYUN.Platform.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace LINGYUN.Platform.Menus; |
|||
public class EfCoreUserFavoriteMenuRepository : |
|||
EfCoreRepository<PlatformDbContext, UserFavoriteMenu, Guid>, |
|||
IUserFavoriteMenuRepository |
|||
{ |
|||
public EfCoreUserFavoriteMenuRepository( |
|||
IDbContextProvider<PlatformDbContext> dbContextProvider) |
|||
: base(dbContextProvider) |
|||
{ |
|||
} |
|||
|
|||
public async virtual Task<List<UserFavoriteMenu>> GetListByMenuIdAsync( |
|||
Guid menuId, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
return await (await GetDbSetAsync()) |
|||
.Where(x => x.MenuId == menuId) |
|||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|||
} |
|||
|
|||
public async virtual Task<List<UserFavoriteMenu>> GetFavoriteMenusAsync( |
|||
Guid userId, |
|||
string framework = null, |
|||
Guid? menuId = null, |
|||
CancellationToken cancellationToken = default) |
|||
{ |
|||
return await (await GetDbSetAsync()) |
|||
.Where(x => x.UserId == userId) |
|||
.WhereIf(menuId.HasValue, x => x.MenuId == menuId) |
|||
.WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework) |
|||
.OrderBy(x => x.CreationTime) |
|||
.ToListAsync(GetCancellationToken(cancellationToken)); |
|||
} |
|||
} |
|||
@ -0,0 +1,740 @@ |
|||
// <auto-generated />
|
|||
using System; |
|||
using LY.MicroService.PlatformManagement.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.PlatformManagement.Migrations |
|||
{ |
|||
[DbContext(typeof(PlatformManagementMigrationsDbContext))] |
|||
[Migration("20220923113938_Add-User-Favorite-Menu")] |
|||
partial class AddUserFavoriteMenu |
|||
{ |
|||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|||
{ |
|||
#pragma warning disable 612, 618
|
|||
modelBuilder |
|||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|||
.HasAnnotation("ProductVersion", "6.0.9") |
|||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDatas", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("AllowBeNull") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(true); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("DefaultValue") |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DefaultValue"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(1024) |
|||
.HasColumnType("varchar(1024)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsStatic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(30) |
|||
.HasColumnType("varchar(30)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<int>("ValueType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("DataId"); |
|||
|
|||
b.HasIndex("Name"); |
|||
|
|||
b.ToTable("AppPlatformDataItems", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Layouts.Layout", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid>("DataId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformLayouts", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.Menu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Code") |
|||
.IsRequired() |
|||
.HasMaxLength(23) |
|||
.HasColumnType("varchar(23)") |
|||
.HasColumnName("Code"); |
|||
|
|||
b.Property<string>("Component") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Component"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasColumnType("longtext"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<bool>("IsPublic") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("LayoutId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<Guid?>("ParentId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("Redirect") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Redirect"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.ToTable("AppPlatformMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.RoleMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("RoleName") |
|||
.IsRequired() |
|||
.HasMaxLength(256) |
|||
.HasColumnType("varchar(256)") |
|||
.HasColumnName("RoleName"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("RoleName", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformRoleMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserFavoriteMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<string>("DisplayName") |
|||
.IsRequired() |
|||
.HasMaxLength(128) |
|||
.HasColumnType("varchar(128)") |
|||
.HasColumnName("DisplayName"); |
|||
|
|||
b.Property<string>("Framework") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Framework"); |
|||
|
|||
b.Property<string>("Icon") |
|||
.HasMaxLength(512) |
|||
.HasColumnType("varchar(512)") |
|||
.HasColumnName("Icon"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(64) |
|||
.HasColumnType("varchar(64)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserFavoriteMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Menus.UserMenu", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<Guid>("MenuId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<bool>("Startup") |
|||
.HasColumnType("tinyint(1)"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<Guid>("UserId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("UserId", "MenuId"); |
|||
|
|||
b.ToTable("AppPlatformUserMenus", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => |
|||
{ |
|||
b.Property<Guid>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<string>("ConcurrencyStamp") |
|||
.IsConcurrencyToken() |
|||
.HasMaxLength(40) |
|||
.HasColumnType("varchar(40)") |
|||
.HasColumnName("ConcurrencyStamp"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<Guid?>("DeleterId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("DeleterId"); |
|||
|
|||
b.Property<DateTime?>("DeletionTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("DeletionTime"); |
|||
|
|||
b.Property<string>("Description") |
|||
.HasMaxLength(2048) |
|||
.HasColumnType("varchar(2048)") |
|||
.HasColumnName("Description"); |
|||
|
|||
b.Property<string>("ExtraProperties") |
|||
.HasColumnType("longtext") |
|||
.HasColumnName("ExtraProperties"); |
|||
|
|||
b.Property<bool>("IsDeleted") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("tinyint(1)") |
|||
.HasDefaultValue(false) |
|||
.HasColumnName("IsDeleted"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<int>("Level") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("PlatformType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("Title") |
|||
.IsRequired() |
|||
.HasMaxLength(50) |
|||
.HasColumnType("varchar(50)") |
|||
.HasColumnName("Title"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)") |
|||
.HasColumnName("Version"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("Version"); |
|||
|
|||
b.ToTable("AppPlatformVersion", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => |
|||
{ |
|||
b.Property<int>("Id") |
|||
.ValueGeneratedOnAdd() |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<Guid>("AppVersionId") |
|||
.HasColumnType("char(36)"); |
|||
|
|||
b.Property<DateTime>("CreationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("CreationTime"); |
|||
|
|||
b.Property<Guid?>("CreatorId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("CreatorId"); |
|||
|
|||
b.Property<int>("DownloadCount") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<int>("FileType") |
|||
.HasColumnType("int"); |
|||
|
|||
b.Property<DateTime?>("LastModificationTime") |
|||
.HasColumnType("datetime(6)") |
|||
.HasColumnName("LastModificationTime"); |
|||
|
|||
b.Property<Guid?>("LastModifierId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("LastModifierId"); |
|||
|
|||
b.Property<string>("Name") |
|||
.IsRequired() |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Name"); |
|||
|
|||
b.Property<string>("Path") |
|||
.HasMaxLength(255) |
|||
.HasColumnType("varchar(255)") |
|||
.HasColumnName("Path"); |
|||
|
|||
b.Property<string>("SHA256") |
|||
.IsRequired() |
|||
.HasMaxLength(65) |
|||
.HasColumnType("varchar(65)") |
|||
.HasColumnName("SHA256"); |
|||
|
|||
b.Property<long>("Size") |
|||
.HasColumnType("bigint"); |
|||
|
|||
b.Property<Guid?>("TenantId") |
|||
.HasColumnType("char(36)") |
|||
.HasColumnName("TenantId"); |
|||
|
|||
b.Property<string>("Version") |
|||
.IsRequired() |
|||
.HasMaxLength(20) |
|||
.HasColumnType("varchar(20)") |
|||
.HasColumnName("Version"); |
|||
|
|||
b.HasKey("Id"); |
|||
|
|||
b.HasIndex("AppVersionId"); |
|||
|
|||
b.HasIndex("Path", "Name", "Version") |
|||
.IsUnique(); |
|||
|
|||
b.ToTable("AppPlatformVersionFile", (string)null); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.DataItem", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Datas.Data", null) |
|||
.WithMany("Items") |
|||
.HasForeignKey("DataId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b => |
|||
{ |
|||
b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion") |
|||
.WithMany("Files") |
|||
.HasForeignKey("AppVersionId") |
|||
.OnDelete(DeleteBehavior.Cascade) |
|||
.IsRequired(); |
|||
|
|||
b.Navigation("AppVersion"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Datas.Data", b => |
|||
{ |
|||
b.Navigation("Items"); |
|||
}); |
|||
|
|||
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b => |
|||
{ |
|||
b.Navigation("Files"); |
|||
}); |
|||
#pragma warning restore 612, 618
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace LY.MicroService.PlatformManagement.Migrations |
|||
{ |
|||
public partial class AddUserFavoriteMenu : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "AppPlatformUserFavoriteMenus", |
|||
columns: table => new |
|||
{ |
|||
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
MenuId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
UserId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"), |
|||
Framework = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Name = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
DisplayName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Path = table.Column<string>(type: "varchar(255)", maxLength: 255, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
Icon = table.Column<string>(type: "varchar(512)", maxLength: 512, nullable: true) |
|||
.Annotation("MySql:CharSet", "utf8mb4"), |
|||
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false), |
|||
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"), |
|||
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true), |
|||
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci") |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_AppPlatformUserFavoriteMenus", x => x.Id); |
|||
}) |
|||
.Annotation("MySql:CharSet", "utf8mb4"); |
|||
|
|||
migrationBuilder.CreateIndex( |
|||
name: "IX_AppPlatformUserFavoriteMenus_UserId_MenuId", |
|||
table: "AppPlatformUserFavoriteMenus", |
|||
columns: new[] { "UserId", "MenuId" }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "AppPlatformUserFavoriteMenus"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue