committed by
GitHub
69 changed files with 3397 additions and 155 deletions
@ -0,0 +1,114 @@ |
|||||
|
import { defAbpHttp } from '/@/utils/http/abp'; |
||||
|
import { UserFavoriteMenuDto, UserFavoriteMenuCreateDto, UserFavoriteMenuUpdateDto } from './model'; |
||||
|
|
||||
|
const remoteService = { |
||||
|
name: 'Platform', |
||||
|
controller: 'UserFavoriteMenu', |
||||
|
replace: { |
||||
|
framework: 'Vue Vben Admin', |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
export const create = (userId: string, input: UserFavoriteMenuCreateDto) => { |
||||
|
input.framework = remoteService.replace.framework; |
||||
|
return defAbpHttp.request<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'CreateAsync', |
||||
|
params: { |
||||
|
userId: userId, |
||||
|
}, |
||||
|
data: { |
||||
|
input: input, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const createMyFavoriteMenu = (input: UserFavoriteMenuCreateDto) => { |
||||
|
input.framework = remoteService.replace.framework; |
||||
|
return defAbpHttp.request<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'CreateMyFavoriteMenuAsync', |
||||
|
data: { |
||||
|
input: input, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const del = (userId: string, menuId: string) => { |
||||
|
return defAbpHttp.request<void>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'DeleteAsync', |
||||
|
params: { |
||||
|
userId: userId, |
||||
|
}, |
||||
|
data: { |
||||
|
input: { |
||||
|
menuId: menuId, |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const delMyFavoriteMenu = (menuId: string) => { |
||||
|
return defAbpHttp.request<void>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'DeleteMyFavoriteMenuAsync', |
||||
|
data: { |
||||
|
input: { |
||||
|
menuId: menuId, |
||||
|
}, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const update = (userId: string, input: UserFavoriteMenuUpdateDto) => { |
||||
|
return defAbpHttp.request<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'UpdateAsync', |
||||
|
params: { |
||||
|
userId: userId, |
||||
|
}, |
||||
|
data: { |
||||
|
input: input, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const updateMyFavoriteMenu = (input: UserFavoriteMenuUpdateDto) => { |
||||
|
return defAbpHttp.request<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'UpdateMyFavoriteMenuAsync', |
||||
|
data: { |
||||
|
input: input, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const getList = (userId: string) => { |
||||
|
return defAbpHttp.listRequest<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'GetListAsync', |
||||
|
params: { |
||||
|
userId: userId, |
||||
|
framework: remoteService.replace.framework, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
export const getMyFavoriteMenuList = () => { |
||||
|
return defAbpHttp.listRequest<UserFavoriteMenuDto>({ |
||||
|
service: remoteService.name, |
||||
|
controller: remoteService.controller, |
||||
|
action: 'GetMyFavoriteMenuListAsync', |
||||
|
params: { |
||||
|
framework: remoteService.replace.framework, |
||||
|
}, |
||||
|
}); |
||||
|
}; |
||||
@ -0,0 +1,28 @@ |
|||||
|
import { AuditedEntityDto, EntityDto, IHasConcurrencyStamp } from '/@/api/model/baseModel'; |
||||
|
|
||||
|
export interface UserFavoriteMenuDto extends AuditedEntityDto, EntityDto<string> { |
||||
|
menuId: string; |
||||
|
userId: string; |
||||
|
aliasName?: string; |
||||
|
color?: string; |
||||
|
framework: string; |
||||
|
name: string; |
||||
|
displayName: string; |
||||
|
path?: string; |
||||
|
icon?: string; |
||||
|
} |
||||
|
|
||||
|
interface UserFavoriteMenuCreateOrUpdateDto { |
||||
|
menuId: string; |
||||
|
color?: string; |
||||
|
aliasName?: string; |
||||
|
icon?: string; |
||||
|
} |
||||
|
|
||||
|
export interface UserFavoriteMenuCreateDto extends UserFavoriteMenuCreateOrUpdateDto { |
||||
|
framework: string; |
||||
|
} |
||||
|
|
||||
|
export interface UserFavoriteMenuUpdateDto extends UserFavoriteMenuCreateOrUpdateDto, IHasConcurrencyStamp { |
||||
|
} |
||||
|
|
||||
@ -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,30 @@ |
|||||
export default { |
export default { |
||||
dashboard: 'Dashboard', |
dashboard: 'Dashboard', |
||||
about: 'About', |
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: { |
||||
|
favoriteMenu: '常用', |
||||
|
more: 'More', |
||||
|
addMenu: 'Add new menu', |
||||
|
manager: 'Manage menu', |
||||
|
selectMenu: 'Select menu', |
||||
|
selectColor: 'Select color', |
||||
|
deleteMenu: 'Delete menu', |
||||
|
defineAliasName: 'Alias name', |
||||
|
defineIcon: 'Icon' |
||||
|
} |
||||
|
}, |
||||
analysis: 'Analysis', |
analysis: 'Analysis', |
||||
}; |
}; |
||||
|
|||||
@ -1,6 +1,30 @@ |
|||||
export default { |
export default { |
||||
dashboard: 'Dashboard', |
dashboard: '仪表盘', |
||||
about: '关于', |
about: '关于', |
||||
workbench: '工作台', |
workbench: { |
||||
|
title: '工作台', |
||||
|
header: { |
||||
|
welcomeMorning: '早安, {0}, 开始您一天的工作吧~', |
||||
|
welcomeAtoon: '中午好, {0}, 注意休息哦~', |
||||
|
welcomeAfternoon: '下午好, {0}, 适时放松,可以提高工作效率~', |
||||
|
welcomeEvening: '晚上好, {0}, 还在工作么?该下班了~', |
||||
|
todayWeather: '{city} 今日 {weather}, {temperature} ℃, {wind}, 风速 {speed}', |
||||
|
notifier: { |
||||
|
title: '通知', |
||||
|
count: '({0})', |
||||
|
} |
||||
|
}, |
||||
|
menus: { |
||||
|
favoriteMenu: '常用', |
||||
|
more: '更多', |
||||
|
addMenu: '添加菜单', |
||||
|
manager: '管理菜单', |
||||
|
selectMenu: '选择菜单', |
||||
|
selectColor: '选择颜色', |
||||
|
deleteMenu: '移除菜单', |
||||
|
defineAliasName: '自定义别名', |
||||
|
defineIcon: '自定义图标' |
||||
|
} |
||||
|
}, |
||||
analysis: '分析页', |
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,108 @@ |
|||||
|
<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" |
||||
|
@click="handleNavigationTo(menu)" |
||||
|
@contextmenu="(e) => handleContext(e, menu)" |
||||
|
> |
||||
|
<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 { Card } from 'ant-design-vue'; |
||||
|
import { Icon } from '/@/components/Icon'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
import { useGo } from '/@/hooks/web/usePage'; |
||||
|
import { useMessage } from '/@/hooks/web/useMessage'; |
||||
|
import { useContextMenu } from '/@/hooks/web/useContextMenu'; |
||||
|
import { useModal } from '/@/components/Modal'; |
||||
|
import { Menu } from './menuProps'; |
||||
|
import MenuReference from './MenuReference.vue'; |
||||
|
|
||||
|
const CardGrid = Card.Grid; |
||||
|
|
||||
|
const emits = defineEmits(['change', 'delete', 'register']); |
||||
|
defineProps({ |
||||
|
title: { |
||||
|
type: String, |
||||
|
required: true, |
||||
|
}, |
||||
|
menus: { |
||||
|
type: Array as PropType<Menu[]>, |
||||
|
default: [], |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const go = useGo(); |
||||
|
const { t } = useI18n(); |
||||
|
const { createConfirm } = useMessage(); |
||||
|
const [createContextMenu] = useContextMenu(); |
||||
|
const [registerReference, { openModal: openReferenceModal }] = useModal(); |
||||
|
|
||||
|
function handleContext(e: MouseEvent, menu: Menu) { |
||||
|
createContextMenu({ |
||||
|
event: e, |
||||
|
items: [ |
||||
|
{ |
||||
|
label: t('routes.dashboard.workbench.menus.deleteMenu'), |
||||
|
icon: 'ant-design:delete-outlined', |
||||
|
disabled: menu.hasDefault, |
||||
|
handler: () => { |
||||
|
if (!menu.hasDefault) { |
||||
|
createConfirm({ |
||||
|
iconType: 'warning', |
||||
|
title: t('AbpUi.AreYouSure'), |
||||
|
content: t('AbpUi.ItemWillBeDeletedMessage'), |
||||
|
okCancel: true, |
||||
|
onOk: () => { |
||||
|
emits('delete', menu); |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
], |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
function handleAddNew() { |
||||
|
openReferenceModal(true, {}); |
||||
|
} |
||||
|
|
||||
|
function handleNavigationTo(menu: Menu) { |
||||
|
if (menu.path) { |
||||
|
go(menu.path); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
function handleChange(menu) { |
||||
|
emits('change', menu); |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped> |
||||
|
.menu-card-grid { |
||||
|
margin: 10px; |
||||
|
width: 30%; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,107 @@ |
|||||
|
<template> |
||||
|
<BasicModal |
||||
|
v-bind="$attrs" |
||||
|
@register="registerModal" |
||||
|
:title="t('routes.dashboard.workbench.menus.manager')" |
||||
|
:width="500" |
||||
|
@ok="handleSubmit" |
||||
|
> |
||||
|
<Form :model="formModel" ref="formElRef" :label-col="{ span: 6 }" :wrapper-col="{ span: 17 }"> |
||||
|
<Form.Item :label="t('routes.dashboard.workbench.menus.selectMenu')" name="menuId"> |
||||
|
<VTreeSelect |
||||
|
allowClear |
||||
|
treeIcon |
||||
|
:tree-data="menuTreeData" |
||||
|
:fieldNames="{ |
||||
|
label: 'displayName', |
||||
|
value: 'id', |
||||
|
}" |
||||
|
v-model:value="formModel.menuId" |
||||
|
@select="handleMenuChange" |
||||
|
> |
||||
|
<template #title="item"> |
||||
|
<VIcon v-if="item.meta?.icon" :icon="item.meta.icon" /> |
||||
|
<span>{{ item.meta?.title ?? item.displayName }}</span> |
||||
|
</template> |
||||
|
</VTreeSelect> |
||||
|
</Form.Item> |
||||
|
<Form.Item :label="t('routes.dashboard.workbench.menus.selectColor')" name="color"> |
||||
|
<VColorPicker v-model:pureColor="formModel.color" format="hex" /> |
||||
|
<span>({{ formModel.color }})</span> |
||||
|
</Form.Item> |
||||
|
<Form.Item :label="t('routes.dashboard.workbench.menus.defineAliasName')" name="aliasName"> |
||||
|
<VInput v-model:value="formModel.aliasName" autocomplete="off" /> |
||||
|
</Form.Item> |
||||
|
<Form.Item :label="t('routes.dashboard.workbench.menus.defineIcon')" name="icon"> |
||||
|
<IconPicker v-model:value="formModel.icon" /> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</BasicModal> |
||||
|
</template> |
||||
|
|
||||
|
<script lang="ts" setup> |
||||
|
import { reactive, ref, unref } from 'vue'; |
||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
import { Form, Input, TreeSelect } from 'ant-design-vue'; |
||||
|
import { ColorPicker } from "vue3-colorpicker"; |
||||
|
import { Icon } from '/@/components/Icon'; |
||||
|
import { BasicModal, useModalInner } from '/@/components/Modal'; |
||||
|
import { IconPicker } from '/@/components/Icon'; |
||||
|
import { getMenuList } from '/@/api/sys/menu'; |
||||
|
import { listToTree } from '/@/utils/helper/treeHelper'; |
||||
|
|
||||
|
const VTreeSelect = TreeSelect; |
||||
|
const VColorPicker = ColorPicker; |
||||
|
const VIcon = Icon; |
||||
|
const VInput = Input; |
||||
|
|
||||
|
const emits = defineEmits(['change', 'register']); |
||||
|
const { t } = useI18n(); |
||||
|
const formModel = reactive({ |
||||
|
menuId: '', |
||||
|
icon: '', |
||||
|
color: '#000000', |
||||
|
aliasName: '', |
||||
|
}); |
||||
|
const formElRef = ref<any>(null); |
||||
|
const menuTreeData = ref<any[]>([]); |
||||
|
const radio = ref(false); |
||||
|
const defaultCheckedKeys = ref<string[]>([]); |
||||
|
const [registerModal, { closeModal }] = useModalInner((props) => { |
||||
|
init(props); |
||||
|
fetchMyMenus(); |
||||
|
}); |
||||
|
|
||||
|
function init(props) { |
||||
|
formModel.icon = ''; |
||||
|
formModel.menuId = ''; |
||||
|
formModel.aliasName = ''; |
||||
|
formModel.color = '#000000'; |
||||
|
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 handleMenuChange(_, item) { |
||||
|
formModel.icon = item.meta?.icon; |
||||
|
formModel.aliasName = item.meta?.title ?? item.displayName; |
||||
|
} |
||||
|
|
||||
|
function handleSubmit() { |
||||
|
const formEl = unref(formElRef); |
||||
|
formEl?.validate().then(() => { |
||||
|
emits('change', formModel); |
||||
|
closeModal(); |
||||
|
}); |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less"> |
||||
|
@import 'vue3-colorpicker/style.css'; |
||||
|
</style> |
||||
@ -0,0 +1,49 @@ |
|||||
|
import { useI18n } from '/@/hooks/web/useI18n'; |
||||
|
|
||||
|
export interface Menu { |
||||
|
id: string, |
||||
|
title: string; |
||||
|
desc?: string; |
||||
|
icon?: string; |
||||
|
color?: string; |
||||
|
size?: number; |
||||
|
path?: string; |
||||
|
hasDefault?: boolean; |
||||
|
} |
||||
|
|
||||
|
export function useDefaultMenus() { |
||||
|
const { t } = useI18n(); |
||||
|
|
||||
|
const defaultMenus: Menu[] = [{ |
||||
|
id: '0', |
||||
|
title: t('layout.header.home'), |
||||
|
icon: 'ion:home-outline', |
||||
|
color: '#1fdaca', |
||||
|
path: '/', |
||||
|
hasDefault: true, |
||||
|
},{ |
||||
|
id: '1', |
||||
|
title: t('routes.dashboard.dashboard'), |
||||
|
icon: 'ion:grid-outline', |
||||
|
color: '#bf0c2c', |
||||
|
path: '/dashboard/workbench', |
||||
|
hasDefault: true, |
||||
|
},{ |
||||
|
id: '2', |
||||
|
title: t('routes.basic.accountSetting'), |
||||
|
icon: 'ant-design:setting-outlined', |
||||
|
color: '#3fb27f', |
||||
|
path: '/account/settings', |
||||
|
hasDefault: true, |
||||
|
},{ |
||||
|
id: '3', |
||||
|
title: t('routes.basic.accountCenter'), |
||||
|
icon: 'ant-design:profile-outlined', |
||||
|
color: '#4daf1bc9', |
||||
|
path: '/account/center', |
||||
|
hasDefault: true, |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
return defaultMenus; |
||||
|
} |
||||
@ -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,13 @@ |
|||||
|
using LINGYUN.Platform.Routes; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Validation; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
public class UserFavoriteMenuCreateDto : UserFavoriteMenuCreateOrUpdateDto |
||||
|
{ |
||||
|
[Required] |
||||
|
[DynamicStringLength(typeof(LayoutConsts), nameof(LayoutConsts.MaxFrameworkLength))] |
||||
|
|
||||
|
public string Framework { get; set; } |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using Volo.Abp.Validation; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
public abstract class UserFavoriteMenuCreateOrUpdateDto |
||||
|
{ |
||||
|
[Required] |
||||
|
public Guid MenuId { get; set; } |
||||
|
|
||||
|
[DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxColorLength))] |
||||
|
public string Color { get; set; } |
||||
|
|
||||
|
[DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxAliasNameLength))] |
||||
|
public string AliasName { get; set; } |
||||
|
|
||||
|
[DynamicStringLength(typeof(UserFavoriteMenuConsts), nameof(UserFavoriteMenuConsts.MaxIconLength))] |
||||
|
public string Icon { get; set; } |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
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 AliasName { get; set; } |
||||
|
|
||||
|
public string Color { 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,9 @@ |
|||||
|
using System; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
public class UserFavoriteMenuRemoveInput |
||||
|
{ |
||||
|
[Required] |
||||
|
public Guid MenuId { get; set; } |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.Domain.Entities; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
public class UserFavoriteMenuUpdateDto : UserFavoriteMenuCreateOrUpdateDto, IHasConcurrencyStamp |
||||
|
{ |
||||
|
|
||||
|
public string ConcurrencyStamp { get; set; } |
||||
|
} |
||||
@ -0,0 +1,25 @@ |
|||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
public interface IUserFavoriteMenuAppService : IApplicationService |
||||
|
{ |
||||
|
Task<UserFavoriteMenuDto> CreateAsync(Guid userId, UserFavoriteMenuCreateDto input); |
||||
|
|
||||
|
Task<UserFavoriteMenuDto> CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input); |
||||
|
|
||||
|
Task<UserFavoriteMenuDto> UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input); |
||||
|
|
||||
|
Task<UserFavoriteMenuDto> UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input); |
||||
|
|
||||
|
Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input); |
||||
|
|
||||
|
Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input); |
||||
|
|
||||
|
Task<ListResultDto<UserFavoriteMenuDto>> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input); |
||||
|
|
||||
|
Task<ListResultDto<UserFavoriteMenuDto>> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input); |
||||
|
} |
||||
@ -0,0 +1,172 @@ |
|||||
|
using LINGYUN.Platform.Permissions; |
||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
using Volo.Abp.Users; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
[Authorize] |
||||
|
public class UserFavoriteMenuAppService : PlatformApplicationServiceBase, IUserFavoriteMenuAppService |
||||
|
{ |
||||
|
protected IStandardMenuConverter StandardMenuConverter => LazyServiceProvider.LazyGetRequiredService<IStandardMenuConverter>(); |
||||
|
protected IMenuRepository MenuRepository { get; } |
||||
|
protected IUserFavoriteMenuRepository UserFavoriteMenuRepository { get; } |
||||
|
|
||||
|
public UserFavoriteMenuAppService( |
||||
|
IMenuRepository menuRepository, |
||||
|
IUserFavoriteMenuRepository userFavoriteMenuRepository) |
||||
|
{ |
||||
|
MenuRepository = menuRepository; |
||||
|
UserFavoriteMenuRepository = userFavoriteMenuRepository; |
||||
|
} |
||||
|
|
||||
|
[Authorize(PlatformPermissions.Menu.ManageUserFavorites)] |
||||
|
public async virtual Task<UserFavoriteMenuDto> CreateAsync(Guid userId, UserFavoriteMenuCreateDto input) |
||||
|
{ |
||||
|
if (!await UserFavoriteMenuRepository.CheckExistsAsync(input.Framework, userId, input.MenuId)) |
||||
|
{ |
||||
|
throw new BusinessException(PlatformErrorCodes.UserDuplicateFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
var menu = await MenuRepository.GetAsync(input.MenuId); |
||||
|
var standardMenu = StandardMenuConverter.Convert(menu); |
||||
|
var userFavoriteMenu = new UserFavoriteMenu( |
||||
|
GuidGenerator.Create(), |
||||
|
input.MenuId, |
||||
|
userId, |
||||
|
input.Framework, |
||||
|
standardMenu.Name, |
||||
|
standardMenu.DisplayName, |
||||
|
standardMenu.Path, |
||||
|
standardMenu.Icon, |
||||
|
input.Color, |
||||
|
input.AliasName, |
||||
|
CurrentTenant.Id); |
||||
|
|
||||
|
userFavoriteMenu = await UserFavoriteMenuRepository.InsertAsync(userFavoriteMenu); |
||||
|
|
||||
|
await CurrentUnitOfWork.SaveChangesAsync(); |
||||
|
|
||||
|
return ObjectMapper.Map<UserFavoriteMenu, UserFavoriteMenuDto>(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<UserFavoriteMenuDto> CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input) |
||||
|
{ |
||||
|
var userId = CurrentUser.GetId(); |
||||
|
if (!await UserFavoriteMenuRepository.CheckExistsAsync(input.Framework, userId, input.MenuId)) |
||||
|
{ |
||||
|
throw new BusinessException(PlatformErrorCodes.UserDuplicateFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
var menu = await MenuRepository.GetAsync(input.MenuId); |
||||
|
var standardMenu = StandardMenuConverter.Convert(menu); |
||||
|
var userFavoriteMenu = new UserFavoriteMenu( |
||||
|
GuidGenerator.Create(), |
||||
|
input.MenuId, |
||||
|
userId, |
||||
|
input.Framework, |
||||
|
standardMenu.Name, |
||||
|
standardMenu.DisplayName, |
||||
|
standardMenu.Path, |
||||
|
standardMenu.Icon, |
||||
|
input.Color, |
||||
|
input.AliasName, |
||||
|
CurrentTenant.Id); |
||||
|
|
||||
|
userFavoriteMenu = await UserFavoriteMenuRepository.InsertAsync(userFavoriteMenu); |
||||
|
|
||||
|
await CurrentUnitOfWork.SaveChangesAsync(); |
||||
|
|
||||
|
return ObjectMapper.Map<UserFavoriteMenu, UserFavoriteMenuDto>(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
[Authorize(PlatformPermissions.Menu.ManageUserFavorites)] |
||||
|
public async virtual Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input) |
||||
|
{ |
||||
|
var userFavoriteMenu = await GetUserMenuAsync(userId, input.MenuId); |
||||
|
|
||||
|
await UserFavoriteMenuRepository.DeleteAsync(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input) |
||||
|
{ |
||||
|
var userFavoriteMenu = await GetUserMenuAsync(CurrentUser.GetId(), input.MenuId); |
||||
|
|
||||
|
await UserFavoriteMenuRepository.DeleteAsync(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
[Authorize(PlatformPermissions.Menu.ManageUserFavorites)] |
||||
|
public async virtual Task<ListResultDto<UserFavoriteMenuDto>> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input) |
||||
|
{ |
||||
|
var userFacoriteMenus = await UserFavoriteMenuRepository.GetFavoriteMenusAsync( |
||||
|
userId, input.Framework); |
||||
|
|
||||
|
return new ListResultDto<UserFavoriteMenuDto>( |
||||
|
ObjectMapper.Map<List<UserFavoriteMenu>, List<UserFavoriteMenuDto>>(userFacoriteMenus)); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<ListResultDto<UserFavoriteMenuDto>> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input) |
||||
|
{ |
||||
|
var userFacoriteMenus = await UserFavoriteMenuRepository.GetFavoriteMenusAsync( |
||||
|
CurrentUser.GetId(), input.Framework); |
||||
|
|
||||
|
return new ListResultDto<UserFavoriteMenuDto>( |
||||
|
ObjectMapper.Map<List<UserFavoriteMenu>, List<UserFavoriteMenuDto>>(userFacoriteMenus)); |
||||
|
} |
||||
|
|
||||
|
[Authorize(PlatformPermissions.Menu.ManageUserFavorites)] |
||||
|
public async virtual Task<UserFavoriteMenuDto> UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input) |
||||
|
{ |
||||
|
var userFavoriteMenu = await GetUserMenuAsync(userId, input.MenuId); |
||||
|
|
||||
|
UpdateByInput(userFavoriteMenu, input); |
||||
|
|
||||
|
userFavoriteMenu = await UserFavoriteMenuRepository.UpdateAsync(userFavoriteMenu); |
||||
|
|
||||
|
await CurrentUnitOfWork.SaveChangesAsync(); |
||||
|
|
||||
|
return ObjectMapper.Map<UserFavoriteMenu, UserFavoriteMenuDto>(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<UserFavoriteMenuDto> UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input) |
||||
|
{ |
||||
|
var userFavoriteMenu = await GetUserMenuAsync(CurrentUser.GetId(), input.MenuId); |
||||
|
|
||||
|
UpdateByInput(userFavoriteMenu, input); |
||||
|
|
||||
|
userFavoriteMenu = await UserFavoriteMenuRepository.UpdateAsync(userFavoriteMenu); |
||||
|
|
||||
|
await CurrentUnitOfWork.SaveChangesAsync(); |
||||
|
|
||||
|
return ObjectMapper.Map<UserFavoriteMenu, UserFavoriteMenuDto>(userFavoriteMenu); |
||||
|
} |
||||
|
|
||||
|
protected async virtual Task<UserFavoriteMenu> GetUserMenuAsync(Guid userId, Guid menuId) |
||||
|
{ |
||||
|
var userFavoriteMenu = await UserFavoriteMenuRepository.FindByUserMenuAsync(userId, menuId); |
||||
|
|
||||
|
return userFavoriteMenu ?? throw new BusinessException(PlatformErrorCodes.UserFavoriteMenuNotFound); |
||||
|
} |
||||
|
|
||||
|
protected virtual void UpdateByInput(UserFavoriteMenu userFavoriteMenu, UserFavoriteMenuCreateOrUpdateDto input) |
||||
|
{ |
||||
|
if (!string.Equals(userFavoriteMenu.Color, input.Color, StringComparison.CurrentCultureIgnoreCase)) |
||||
|
{ |
||||
|
userFavoriteMenu.Color = Check.Length(input.Color, nameof(UserFavoriteMenuCreateOrUpdateDto.Color), UserFavoriteMenuConsts.MaxColorLength); |
||||
|
} |
||||
|
|
||||
|
if (!string.Equals(userFavoriteMenu.AliasName, input.AliasName, StringComparison.CurrentCultureIgnoreCase)) |
||||
|
{ |
||||
|
userFavoriteMenu.AliasName = Check.Length(input.AliasName, nameof(UserFavoriteMenuCreateOrUpdateDto.AliasName), UserFavoriteMenuConsts.MaxAliasNameLength); |
||||
|
} |
||||
|
|
||||
|
if (!string.Equals(userFavoriteMenu.Icon, input.Icon, StringComparison.CurrentCultureIgnoreCase)) |
||||
|
{ |
||||
|
userFavoriteMenu.Icon = Check.Length(input.Icon, nameof(UserFavoriteMenuCreateOrUpdateDto.Icon), UserFavoriteMenuConsts.MaxIconLength); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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,9 @@ |
|||||
|
using LINGYUN.Platform.Routes; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
public class UserFavoriteMenuConsts |
||||
|
{ |
||||
|
public static int MaxIconLength { get; set; } = 512; |
||||
|
public static int MaxColorLength { get; set; } = 30; |
||||
|
public static int MaxAliasNameLength { get; set; } = RouteConsts.MaxDisplayNameLength; |
||||
|
} |
||||
@ -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; } |
|
||||
} |
|
||||
} |
|
||||
@ -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,31 @@ |
|||||
|
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<bool> CheckExistsAsync( |
||||
|
string framework, |
||||
|
Guid userId, |
||||
|
Guid menuId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
Task<UserFavoriteMenu> FindByUserMenuAsync( |
||||
|
Guid userId, |
||||
|
Guid menuId, |
||||
|
CancellationToken cancellationToken = default); |
||||
|
|
||||
|
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,57 @@ |
|||||
|
using LINGYUN.Platform.Routes; |
||||
|
using System; |
||||
|
using Volo.Abp; |
||||
|
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 AliasName { get; set; } |
||||
|
|
||||
|
public virtual string Color { get; 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, |
||||
|
string color, |
||||
|
string aliasName = null, |
||||
|
Guid? tenantId = null) |
||||
|
: base(id) |
||||
|
{ |
||||
|
MenuId = menuId; |
||||
|
UserId = userId; |
||||
|
Framework = Check.NotNullOrWhiteSpace(framework, nameof(framework), LayoutConsts.MaxFrameworkLength); |
||||
|
Name = Check.NotNullOrWhiteSpace(name, nameof(name), RouteConsts.MaxNameLength); |
||||
|
DisplayName = Check.NotNullOrWhiteSpace(displayName, nameof(displayName), RouteConsts.MaxDisplayNameLength); |
||||
|
Path = Check.NotNullOrWhiteSpace(path, nameof(path), RouteConsts.MaxPathLength); |
||||
|
Icon = Check.Length(icon, nameof(icon), UserFavoriteMenuConsts.MaxIconLength); |
||||
|
Color = Check.Length(color, nameof(color), UserFavoriteMenuConsts.MaxColorLength); |
||||
|
AliasName = Check.Length(aliasName, nameof(aliasName), UserFavoriteMenuConsts.MaxAliasNameLength); |
||||
|
TenantId = tenantId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,66 @@ |
|||||
|
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)); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<bool> CheckExistsAsync( |
||||
|
string framework, |
||||
|
Guid userId, |
||||
|
Guid menuId, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetDbSetAsync()) |
||||
|
.AnyAsync(x => |
||||
|
x.Framework == framework && x.UserId == userId && x.MenuId == menuId, |
||||
|
GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<UserFavoriteMenu> FindByUserMenuAsync( |
||||
|
Guid userId, |
||||
|
Guid menuId, |
||||
|
CancellationToken cancellationToken = default) |
||||
|
{ |
||||
|
return await (await GetDbSetAsync()) |
||||
|
.Where(x => x.UserId == userId && x.MenuId == menuId) |
||||
|
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
using Microsoft.AspNetCore.Authorization; |
||||
|
using Microsoft.AspNetCore.Mvc; |
||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Menus; |
||||
|
|
||||
|
[Authorize] |
||||
|
[RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)] |
||||
|
[Area("platform")] |
||||
|
[Route("api/platform/menus/favorites")] |
||||
|
public class UserFavoriteMenuController : PlatformControllerBase, IUserFavoriteMenuAppService |
||||
|
{ |
||||
|
protected IUserFavoriteMenuAppService Service { get; } |
||||
|
|
||||
|
public UserFavoriteMenuController(IUserFavoriteMenuAppService service) |
||||
|
{ |
||||
|
Service = service; |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[Route("{userId}")] |
||||
|
public virtual Task<UserFavoriteMenuDto> CreateAsync(Guid userId, UserFavoriteMenuCreateDto input) |
||||
|
{ |
||||
|
return Service.CreateAsync(userId, input); |
||||
|
} |
||||
|
|
||||
|
[HttpPost] |
||||
|
[Route("my-favorite-menu")] |
||||
|
public virtual Task<UserFavoriteMenuDto> CreateMyFavoriteMenuAsync(UserFavoriteMenuCreateDto input) |
||||
|
{ |
||||
|
return Service.CreateMyFavoriteMenuAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpDelete] |
||||
|
[Route("{userId}/{MenuId}")] |
||||
|
public virtual Task DeleteAsync(Guid userId, UserFavoriteMenuRemoveInput input) |
||||
|
{ |
||||
|
return Service.DeleteAsync(userId, input); |
||||
|
} |
||||
|
|
||||
|
[HttpDelete] |
||||
|
[Route("my-favorite-menu/{MenuId}")] |
||||
|
public virtual Task DeleteMyFavoriteMenuAsync(UserFavoriteMenuRemoveInput input) |
||||
|
{ |
||||
|
return Service.DeleteMyFavoriteMenuAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("{userId}")] |
||||
|
public virtual Task<ListResultDto<UserFavoriteMenuDto>> GetListAsync(Guid userId, UserFavoriteMenuGetListInput input) |
||||
|
{ |
||||
|
return Service.GetListAsync(userId, input); |
||||
|
} |
||||
|
|
||||
|
[HttpGet] |
||||
|
[Route("my-favorite-menus")] |
||||
|
public virtual Task<ListResultDto<UserFavoriteMenuDto>> GetMyFavoriteMenuListAsync(UserFavoriteMenuGetListInput input) |
||||
|
{ |
||||
|
return Service.GetMyFavoriteMenuListAsync(input); |
||||
|
} |
||||
|
|
||||
|
[HttpPut] |
||||
|
[Route("{userId}")] |
||||
|
public virtual Task<UserFavoriteMenuDto> UpdateAsync(Guid userId, UserFavoriteMenuUpdateDto input) |
||||
|
{ |
||||
|
return Service.UpdateAsync(userId, input); |
||||
|
} |
||||
|
|
||||
|
[HttpPut] |
||||
|
[Route("my-favorite-menu")] |
||||
|
public virtual Task<UserFavoriteMenuDto> UpdateMyFavoriteMenuAsync(UserFavoriteMenuUpdateDto input) |
||||
|
{ |
||||
|
return Service.UpdateMyFavoriteMenuAsync(input); |
||||
|
} |
||||
|
} |
||||
@ -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"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,751 @@ |
|||||
|
// <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("20220926012110_Add-Color-And-AliasName-With-UserFavoriteMenu")] |
||||
|
partial class AddColorAndAliasNameWithUserFavoriteMenu |
||||
|
{ |
||||
|
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<string>("AliasName") |
||||
|
.HasMaxLength(128) |
||||
|
.HasColumnType("varchar(128)") |
||||
|
.HasColumnName("AliasName"); |
||||
|
|
||||
|
b.Property<string>("Color") |
||||
|
.HasMaxLength(30) |
||||
|
.HasColumnType("varchar(30)") |
||||
|
.HasColumnName("Color"); |
||||
|
|
||||
|
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") |
||||
|
.IsRequired() |
||||
|
.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,71 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
#nullable disable |
||||
|
|
||||
|
namespace LY.MicroService.PlatformManagement.Migrations |
||||
|
{ |
||||
|
public partial class AddColorAndAliasNameWithUserFavoriteMenu : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.UpdateData( |
||||
|
table: "AppPlatformUserFavoriteMenus", |
||||
|
keyColumn: "Path", |
||||
|
keyValue: null, |
||||
|
column: "Path", |
||||
|
value: ""); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Path", |
||||
|
table: "AppPlatformUserFavoriteMenus", |
||||
|
type: "varchar(255)", |
||||
|
maxLength: 255, |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(string), |
||||
|
oldType: "varchar(255)", |
||||
|
oldMaxLength: 255, |
||||
|
oldNullable: true) |
||||
|
.Annotation("MySql:CharSet", "utf8mb4") |
||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "AliasName", |
||||
|
table: "AppPlatformUserFavoriteMenus", |
||||
|
type: "varchar(128)", |
||||
|
maxLength: 128, |
||||
|
nullable: true) |
||||
|
.Annotation("MySql:CharSet", "utf8mb4"); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "Color", |
||||
|
table: "AppPlatformUserFavoriteMenus", |
||||
|
type: "varchar(30)", |
||||
|
maxLength: 30, |
||||
|
nullable: true) |
||||
|
.Annotation("MySql:CharSet", "utf8mb4"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "AliasName", |
||||
|
table: "AppPlatformUserFavoriteMenus"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "Color", |
||||
|
table: "AppPlatformUserFavoriteMenus"); |
||||
|
|
||||
|
migrationBuilder.AlterColumn<string>( |
||||
|
name: "Path", |
||||
|
table: "AppPlatformUserFavoriteMenus", |
||||
|
type: "varchar(255)", |
||||
|
maxLength: 255, |
||||
|
nullable: true, |
||||
|
oldClrType: typeof(string), |
||||
|
oldType: "varchar(255)", |
||||
|
oldMaxLength: 255) |
||||
|
.Annotation("MySql:CharSet", "utf8mb4") |
||||
|
.OldAnnotation("MySql:CharSet", "utf8mb4"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue