填充代码

This commit is contained in:
zpc 2024-07-19 00:41:57 +08:00
parent 1d8ccfca40
commit 5e69e1249d
40 changed files with 3487 additions and 39 deletions

View File

@ -1,9 +1,9 @@
export default {
"menu.0": "工作台",
"menu.28": "Vxe-Table",
"menu.44": "大数据表格",
// "menu.44": "大数据表格",
"menu.22": "接口文档",
"menu.1": "更多示例",
// "menu.1": "更多示例",
"menu.2": "查看更多组件",
"menu.5": "基础图表",
"menu.13": "会员管理",

View File

@ -0,0 +1,74 @@
import Http from "@/core/utils/Http";
/**
* T_Character_Label服务
*/
export default class T_Character_LabelService {
static urlPrefix = "/api/v1/admin/T_Character_Label";
/**
*
* @param current
* @param pageSize
* @param search
* @param searchSort
* @returns
*/
static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) {
return Http.post(`${this.urlPrefix}/findList`, {
page: current,
size: pageSize,
search,
searchSort
})
}
/**
*
*
* @param ids
* @returns
*/
static deleteList(ids: string[]) {
return Http.post(`${this.urlPrefix}/deleteList`, ids)
}
/**
*
*
* @param id
* @returns
*/
static findForm(id?: string | undefined) {
return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`)
}
/**
*
*
* @param id
* @param formData
* @returns
*/
static saveForm(id: string | undefined, formData: any) {
return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
}
/**
* excel
*
* @param search
* @param searchSort
* @returns
*/
static exportExcel(search: any = {}, searchSort: any[] = []) {
return Http.download(`${this.urlPrefix}/exportExcel`, {
page: -1,
size: -1,
search,
searchSort
});
}
}

View File

@ -0,0 +1,74 @@
import Http from "@/core/utils/Http";
/**
* T_Character服务
*/
export default class T_CharacterService {
static urlPrefix = "/api/v1/admin/T_Character";
/**
*
* @param current
* @param pageSize
* @param search
* @param searchSort
* @returns
*/
static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) {
return Http.post(`${this.urlPrefix}/findList`, {
page: current,
size: pageSize,
search,
searchSort
})
}
/**
*
*
* @param ids
* @returns
*/
static deleteList(ids: string[]) {
return Http.post(`${this.urlPrefix}/deleteList`, ids)
}
/**
*
*
* @param id
* @returns
*/
static findForm(id?: string | undefined) {
return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`)
}
/**
*
*
* @param id
* @param formData
* @returns
*/
static saveForm(id: string | undefined, formData: any) {
return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
}
/**
* excel
*
* @param search
* @param searchSort
* @returns
*/
static exportExcel(search: any = {}, searchSort: any[] = []) {
return Http.download(`${this.urlPrefix}/exportExcel`, {
page: -1,
size: -1,
search,
searchSort
});
}
}

View File

@ -0,0 +1,74 @@
import Http from "@/core/utils/Http";
/**
* TImageConfig服务
*/
export default class TImageConfigService {
static urlPrefix = "/api/v1/admin/TImageConfig";
/**
*
* @param current
* @param pageSize
* @param search
* @param searchSort
* @returns
*/
static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) {
return Http.post(`${this.urlPrefix}/findList`, {
page: current,
size: pageSize,
search,
searchSort
})
}
/**
*
*
* @param ids
* @returns
*/
static deleteList(ids: string[]) {
return Http.post(`${this.urlPrefix}/deleteList`, ids)
}
/**
*
*
* @param id
* @returns
*/
static findForm(id?: string | undefined) {
return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`)
}
/**
*
*
* @param id
* @param formData
* @returns
*/
static saveForm(id: string | undefined, formData: any) {
return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
}
/**
* excel
*
* @param search
* @param searchSort
* @returns
*/
static exportExcel(search: any = {}, searchSort: any[] = []) {
return Http.download(`${this.urlPrefix}/exportExcel`, {
page: -1,
size: -1,
search,
searchSort
});
}
}

View File

@ -0,0 +1,219 @@
<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
import { FormInstance } from "ant-design-vue";
import { useAuthority } from "@/utils/Authority";
import AppIcon from "@/core/components/AppIcon.vue";
import Info from "./Info.vue";
import Tools from "@/core/utils/Tools";
import PageContainer from "@/core/components/PageContainer.vue";
import TableCurd from "@/core/components/curd/TableCurd.vue";
import TCharacterLabelService from "@/services/Apps/T_Character_Labels/TCharacterLabelService";
defineOptions({ name: "t_Character_LabelIndex" });
const state = reactive({
search: {
state: false,
vm: {
name: undefined,
},
sort: [] as any[],
},
loading: false,
page: 1,
size: 10,
total: 100,
columns: [] as any,
data: [] as any,
});
//
const power = useAuthority();
//
const refTableCurd = ref<InstanceType<typeof TableCurd>>();
//
const refInfo = ref<InstanceType<typeof Info>>();
//
const refSearchForm = ref<FormInstance>();
/**
* 初始化
*/
onMounted(() => {
findList();
});
/**
*获取数据
*/
async function findList() {
try{
state.loading = true;
const result = await TCharacterLabelService.findList(state.page, state.size, state.search.vm, state.search.sort);
state.loading = false;
if (result.code != 200) return;
state.page = result.data.page;
state.size = result.data.size;
state.total = result.data.total;
state.columns = result.data.columns;
state.data = result.data.dataSource;
// state.visible = false;
} catch (error) {
state.loading = false;
}
}
/**
* 删除数据
* @param id
*/
async function deleteList(id?: string) {
let ids: string[] = [];
if (id) {
ids.push(id);
} else {
ids = refTableCurd.value?.getSelectedRowKeys() ?? [];
}
if (ids.length == 0) return Tools.message.error("请选择要删除的行!");
try{
state.loading = true;
const result = await TCharacterLabelService.deleteList(ids);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("删除成功!");
findList();
} catch (error) {
state.loading = false;
}
}
/**
* 导出excel
*/
function exportExcel() {
TCharacterLabelService.exportExcel(state.search.vm, state.search.sort);
}
</script>
<template>
<PageContainer>
<TableCurd
ref="refTableCurd"
:config="state"
@change="
(changeTable) => {
state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size;
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList();
}
"
@show-size-change="
({ current, size }) => {
state.page = current == 0 ? 1 : current;
state.size = size;
findList();
}
"
>
<!-- search -->
<template #search>
<a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<a-form-item class="mb-0" name="labelName" label="名称">
<a-input v-model:value="state.search.vm.labelName" placeholder="名称" />
</a-form-item>
</a-col>
<!--button-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8">
<a-button
@click="
state.page = 1;
refSearchForm?.resetFields();
findList();
"
>
重置
</a-button>
<a-button
type="primary"
@click="
state.page = 1;
findList();
"
>
查询
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template>
<!-- toolbar-left -->
<template #toolbar-left>
<a-button @click="state.search.state = !state.search.state" v-if="power.search">
<div v-if="state.search.state"><AppIcon name="UpOutlined" />&nbsp;&nbsp;收起</div>
<div v-else><AppIcon name="DownOutlined" />&nbsp;&nbsp;展开</div>
</a-button>
<a-button type="primary" @click="() => refInfo?.open()" v-if="power.insert">
<template #icon>
<AppIcon name="PlusOutlined" />
</template>
新建
</a-button>
<a-popconfirm title="您确定要删除?" @confirm="deleteList()" okText="确定" cancelText="取消" v-if="power.delete">
<a-button type="primary" danger>
<template #icon>
<AppIcon name="DeleteOutlined" />
</template>
批量删除
</a-button>
</a-popconfirm>
</template>
<!-- toolbar-right -->
<template #toolbar-right>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="exportExcel()">导出 Excel</a-menu-item>
</a-menu>
</template>
<a-button> 更多 <AppIcon name="ellipsis-outlined" /> </a-button>
</a-dropdown>
<!-- 列设置 -->
<a-popover>
<template #content>
<div v-for="item in state.columns.filter((w:any) => w.fieldName.substr(0, 1) != '_')">
<a-checkbox v-model:checked="item.show">{{ item.title }}</a-checkbox>
</div>
</template>
<a-button type="text">
<template #icon><AppIcon name="setting-outlined" /> </template>
</a-button>
</a-popover>
</template>
<!-- table-col -->
<template #table-col>
<template v-for="item,index in state.columns.filter((w:any) => w.fieldName !== 'id' && w.show)" :key="item.fieldName">
<a-table-column :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" />
</template>
<!-- 操作 -->
<a-table-column title="操作" data-index="id" v-if="power.update || power.delete">
<template #default="{ record }">
<a href="javascript:;" @click="() => refInfo?.open(record.id)" v-if="power.update">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="您确定要删除?" @confirm="deleteList(record.id)" okText="确定" cancelText="取消" v-if="power.delete">
<a class="text-danger">删除</a>
</a-popconfirm>
</template>
</a-table-column>
</template>
</TableCurd>
<!-- Info -->
<Info ref="refInfo" :onSuccess="() => findList()" />
</PageContainer>
</template>

View File

@ -0,0 +1,90 @@
<script lang="ts" setup>
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools";
import TCharacterLabelService from "@/services/apps/T_Character_Labels/TCharacterLabelService";
//
const props = defineProps<{ onSuccess: () => void }>();
const state = reactive({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
//
const refForm = ref<FormInstance>();
//
defineExpose({
/**
* 打开表单初始化
* @param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
state.vm.id = key;
}
refForm.value?.resetFields();
//
state.loading = true;
TCharacterLabelService.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try {
state.loading = true;
const result = await TCharacterLabelService.saveForm(state.vm.id, state.vm.form);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
}
</script>
<template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @ok="state.visible = false"
:width="400">
<template #footer>
<a-button type="primary" :loading="state.loading" @click="save()"> 提交</a-button>
<a-button @click="state.visible = false">关闭</a-button>
</template>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="租户id" name="tenantId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.tenantId" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="标签名称" name="labelName" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.labelName" placeholder="请输入" />
</a-form-item>
</a-col>
<a-input type="hidden" v-model:value="state.vm.form.createTime" />
<a-input type="hidden" v-model:value="state.vm.form.updateTime" />
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>

View File

@ -0,0 +1,325 @@
<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
import { FormInstance } from "ant-design-vue";
import { useAuthority } from "@/utils/Authority";
import AppIcon from "@/core/components/AppIcon.vue";
import Info from "./Info.vue";
import Tools from "@/core/utils/Tools";
import PageContainer from "@/core/components/PageContainer.vue";
import TableCurd from "@/core/components/curd/TableCurd.vue";
import T_CharacterService from "@/services/apps/T_Characters/T_CharacterService";
//views/Apps/T_Characters/Index.vue
defineOptions({ name: "T_CharacterIndex" });
const state = reactive({
search: {
state: false,
vm: {
name: undefined,
},
sort: [] as any[],
},
loading: false,
page: 1,
size: 10,
total: 100,
columns: [] as any,
data: [] as any,
});
//
const power = useAuthority();
//
const refTableCurd = ref<InstanceType<typeof TableCurd>>();
//
const refInfo = ref<InstanceType<typeof Info>>();
//
const refSearchForm = ref<FormInstance>();
/**
* 初始化
*/
onMounted(() => {
findList();
});
const x = [
{
"fieldName": "id",
"dataIndex": "id",
"title": "人物id",
"show": true,
"width": "80",
"sorter": true
},
{
"fieldName": "name",
"dataIndex": "name",
"title": "人物名字",
"show": true,
"width": "120",
"sorter": true
},
{
"fieldName": "biography",
"dataIndex": "biography",
"title": "人物简介",
"show": true,
"width": "250",
"sorter": true
},
{
"fieldName": "tenantId",
"dataIndex": "tenantId",
"title": "租户Id",
"show": false,
"width": "",
"sorter": true
},
{
"fieldName": "prologue",
"dataIndex": "prologue",
"title": "开场白",
"show": true,
"width": "150",
"sorter": true
},
{
"fieldName": "modelConfigId",
"dataIndex": "modelConfigId",
"title": "模型Id",
"show": true,
"width": "120",
"sorter": true
},
{
"fieldName": "visibility",
"dataIndex": "visibility",
"title": "公开/私密",
"show": false,
"width": "",
"sorter": true
},
{
"fieldName": "createTime",
"dataIndex": "createTime",
"title": "创建时间",
"show": false,
"width": "",
"sorter": true
},
{
"fieldName": "updateTime",
"dataIndex": "updateTime",
"title": "更新时间",
"show": false,
"width": "",
"sorter": true
},
{
"fieldName": "gender",
"dataIndex": "gender",
"title": "性别",
"show": true,
"width": "100",
"sorter": true
},
{
"fieldName": "system",
"dataIndex": "system",
"title": "人物初始设定",
"show": true,
"width": "300",
"sorter": true
},
{
"fieldName": "bgImg",
"dataIndex": "bgImg",
"title": "背景图片",
"show": true,
"width": "80",
"sorter": true
},
{
"fieldName": "iconImg",
"dataIndex": "iconImg",
"title": "角色头像",
"show": true,
"width": "80",
"sorter": true
}
];
/**
*获取数据
*/
async function findList() {
try {
state.loading = true;
const result = await T_CharacterService.findList(state.page, state.size, state.search.vm, state.search.sort);
state.loading = false;
if (result.code != 200) return;
state.page = result.data.page;
state.size = result.data.size;
state.total = result.data.total;
console.log(result.data.columns);
state.columns = x;//result.data.columns;
state.data = result.data.dataSource;
// state.visible = false;
} catch (error) {
state.loading = false;
}
}
/**
* 删除数据
* @param id
*/
async function deleteList(id?: string) {
let ids: string[] = [];
if (id) {
ids.push(id);
} else {
ids = refTableCurd.value?.getSelectedRowKeys() ?? [];
}
if (ids.length == 0) return Tools.message.error("请选择要删除的行!");
try {
state.loading = true;
const result = await T_CharacterService.deleteList(ids);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("删除成功!");
findList();
} catch (error) {
state.loading = false;
}
}
/**
* 导出excel
*/
function exportExcel() {
T_CharacterService.exportExcel(state.search.vm, state.search.sort);
}
</script>
<template>
<PageContainer>
<TableCurd :bordered="true" ref="refTableCurd" :config="state" :scroll="true" @change="(changeTable) => {
state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size;
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList();
}
" @show-size-change="({ current, size }) => {
state.page = current == 0 ? 1 : current;
state.size = size;
findList();
}
">
<!-- search -->
<template #search>
<a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<a-form-item class="mb-0" name="name" label="名称">
<a-input v-model:value="state.search.vm.name" placeholder="名称" />
</a-form-item>
</a-col>
<!--button-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8">
<a-button @click="
state.page = 1;
refSearchForm?.resetFields();
findList();
">
重置
</a-button>
<a-button type="primary" @click="
state.page = 1;
findList();
">
查询
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template>
<!-- toolbar-left -->
<template #toolbar-left>
<a-button @click="state.search.state = !state.search.state" v-if="power.search">
<div v-if="state.search.state">
<AppIcon name="UpOutlined" />&nbsp;&nbsp;收起
</div>
<div v-else>
<AppIcon name="DownOutlined" />&nbsp;&nbsp;展开
</div>
</a-button>
<a-button type="primary" @click="() => refInfo?.open()" v-if="power.insert">
<template #icon>
<AppIcon name="PlusOutlined" />
</template>
新建
</a-button>
<a-popconfirm title="您确定要删除?" @confirm="deleteList()" okText="确定" cancelText="取消" v-if="power.delete">
<a-button type="primary" danger>
<template #icon>
<AppIcon name="DeleteOutlined" />
</template>
批量删除
</a-button>
</a-popconfirm>
</template>
<!-- toolbar-right -->
<template #toolbar-right>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="exportExcel()">导出 Excel</a-menu-item>
</a-menu>
</template>
<a-button> 更多
<AppIcon name="ellipsis-outlined" />
</a-button>
</a-dropdown>
<!-- 列设置 -->
<a-popover>
<template #content>
<div v-for="item in state.columns.filter((w: any) => w.fieldName.substr(0, 1) != '_')">
<a-checkbox v-model:checked="item.show">{{ item.title }}</a-checkbox>
</div>
</template>
<a-button type="text">
<template #icon>
<AppIcon name="setting-outlined" />
</template>
</a-button>
</a-popover>
</template>
<!-- table-col -->
<template #table-col>
<template v-for="item, index in state.columns.filter((w: any) => w.fieldName !== 'id' && w.show)"
:key="item.fieldName">
<a-table-column :title="item.title" :width="500" :data-index="item.fieldName"
:sorter="item.sort ? { multiple: index + 1 } : false" />
</template>
<!-- 操作 -->
<a-table-column title="操作" data-index="id" :width="230" v-if="power.update || power.delete">
<template #default="{ record }">
<a href="javascript:;" @click="() => refInfo?.open(record.id)" v-if="power.update">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="您确定要删除?" @confirm="deleteList(record.id)" okText="确定" cancelText="取消"
v-if="power.delete">
<a class="text-danger">删除</a>
</a-popconfirm>
</template>
</a-table-column>
</template>
</TableCurd>
<!-- Info -->
<Info ref="refInfo" :onSuccess="() => findList()" />
</PageContainer>
</template>

View File

@ -0,0 +1,137 @@
<script lang="ts" setup>
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools";
import T_CharacterService from "@/services/apps/T_Characters/T_CharacterService";
//
const props = defineProps<{ onSuccess: () => void }>();
const state = reactive({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
//
const refForm = ref<FormInstance>();
//
defineExpose({
/**
* 打开表单初始化
* @param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
state.vm.id = key;
}
refForm.value?.resetFields();
//
state.loading = true;
T_CharacterService.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try{
state.loading = true;
const result = await T_CharacterService.saveForm(state.vm.id, state.vm.form);
state.loading = false;
if (result.code !=200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
}
</script>
<template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @ok="state.visible = false" :width="400">
<template #footer>
<a-button type="primary" :loading="state.loading" @click="save()"> 提交</a-button>
<a-button @click="state.visible = false">关闭</a-button>
</template>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="人物名字" name="name" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.name" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="人物简介" name="biography" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.biography" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="租户Id" name="tenantId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.tenantId" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="开场白" name="prologue" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.prologue" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="模型Id" name="modelConfigId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.modelConfigId" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="公开/私密 0公开 1私密" name="visibility" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.visibility" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="创建时间" name="createTime" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.createTime" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="更新时间" name="updateTime" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.updateTime" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="性别0男1女2其他" name="gender" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.gender" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="人物初始设定" name="system" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.system" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="背景图片" name="bgImg" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.bgImg" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="角色头像是id" name="iconImg" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.iconImg" placeholder="请输入" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>

View File

@ -0,0 +1,226 @@
<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
import { FormInstance } from "ant-design-vue";
import { useAuthority } from "@/utils/Authority";
import AppIcon from "@/core/components/AppIcon.vue";
import Info from "./Info.vue";
import Tools from "@/core/utils/Tools";
import PageContainer from "@/core/components/PageContainer.vue";
import TableCurd from "@/core/components/curd/TableCurd.vue";
import TImageConfigService from "@/services/apps/T_Image_Configs/TImageConfigService";
defineOptions({ name: "tImageConfigIndex" });
const state = reactive({
search: {
state: false,
vm: {
name: undefined,
},
sort: [] as any[],
},
loading: false,
page: 1,
size: 10,
total: 100,
columns: [] as any,
data: [] as any,
});
//
const power = useAuthority();
//
const refTableCurd = ref<InstanceType<typeof TableCurd>>();
//
const refInfo = ref<InstanceType<typeof Info>>();
//
const refSearchForm = ref<FormInstance>();
/**
* 初始化
*/
onMounted(() => {
findList();
});
/**
*获取数据
*/
async function findList() {
try {
state.loading = true;
const result = await TImageConfigService.findList(state.page, state.size, state.search.vm, state.search.sort);
state.loading = false;
if (result.code != 200) return;
state.page = result.data.page;
state.size = result.data.size;
state.total = result.data.total;
state.columns = result.data.columns;
state.data = result.data.dataSource;
// state.visible = false;
} catch (error) {
state.loading = false;
}
}
/**
* 删除数据
* @param id
*/
async function deleteList(id?: string) {
let ids: string[] = [];
if (id) {
ids.push(id);
} else {
ids = refTableCurd.value?.getSelectedRowKeys() ?? [];
}
if (ids.length == 0) return Tools.message.error("请选择要删除的行!");
try {
state.loading = true;
const result = await TImageConfigService.deleteList(ids);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("删除成功!");
findList();
} catch (error) {
state.loading = false;
}
}
/**
* 导出excel
*/
function exportExcel() {
TImageConfigService.exportExcel(state.search.vm, state.search.sort);
}
</script>
<template>
<PageContainer>
<TableCurd ref="refTableCurd" :config="state" @change="(changeTable) => {
state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size;
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList();
}
" @show-size-change="({ current, size }) => {
state.page = current == 0 ? 1 : current;
state.size = size;
findList();
}
">
<!-- search -->
<template #search>
<a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<a-form-item class="mb-0" name="name" label="名称">
<a-input v-model:value="state.search.vm.name" placeholder="名称" />
</a-form-item>
</a-col>
<!--button-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8">
<a-button @click="
state.page = 1;
refSearchForm?.resetFields();
findList();
">
重置
</a-button>
<a-button type="primary" @click="
state.page = 1;
findList();
">
查询
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template>
<!-- toolbar-left -->
<template #toolbar-left>
<a-button @click="state.search.state = !state.search.state" v-if="power.search">
<div v-if="state.search.state">
<AppIcon name="UpOutlined" />&nbsp;&nbsp;收起
</div>
<div v-else>
<AppIcon name="DownOutlined" />&nbsp;&nbsp;展开
</div>
</a-button>
<a-button type="primary" @click="() => refInfo?.open()" v-if="power.insert">
<template #icon>
<AppIcon name="PlusOutlined" />
</template>
新建
</a-button>
<a-popconfirm title="您确定要删除?" @confirm="deleteList()" okText="确定" cancelText="取消" v-if="power.delete">
<a-button type="primary" danger>
<template #icon>
<AppIcon name="DeleteOutlined" />
</template>
批量删除
</a-button>
</a-popconfirm>
</template>
<!-- toolbar-right -->
<template #toolbar-right>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1" @click="exportExcel()">导出 Excel</a-menu-item>
</a-menu>
</template>
<a-button> 更多
<AppIcon name="ellipsis-outlined" />
</a-button>
</a-dropdown>
<!-- 列设置 -->
<a-popover>
<template #content>
<div v-for="item in state.columns.filter((w: any) => w.fieldName.substr(0, 1) != '_')">
<a-checkbox v-model:checked="item.show">{{ item.title }}</a-checkbox>
</div>
</template>
<a-button type="text">
<template #icon>
<AppIcon name="setting-outlined" />
</template>
</a-button>
</a-popover>
</template>
<!-- table-col -->
<template #table-col>
<template v-for="item, index in state.columns.filter((w: any) => w.fieldName !== 'id' && w.show)"
:key="item.fieldName">
<a-table-column :title="item.title" :data-index="item.fieldName"
:sorter="item.sort ? { multiple: index + 1 } : false" />
</template>
<!-- 操作 -->
<a-table-column title="图片" data-index="id">
<template #default="{ record }">
<img :src="'https://miaoyu-1308826010.cos.ap-shanghai.myqcloud.com/'+record.ossPath+''" style="width:100px;height:100px" />
<!-- <img :src="record.url" style="width:100px;height:100px" /> -->
</template>
</a-table-column>
<!-- 操作 -->
<a-table-column title="操作" data-index="id" v-if="power.update || power.delete">
<template #default="{ record }">
<a href="javascript:;" @click="() => refInfo?.open(record.id)" v-if="power.update">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="您确定要删除?" @confirm="deleteList(record.id)" okText="确定" cancelText="取消"
v-if="power.delete">
<a class="text-danger">删除</a>
</a-popconfirm>
</template>
</a-table-column>
</template>
</TableCurd>
<!-- Info -->
<Info ref="refInfo" :onSuccess="() => findList()" />
</PageContainer>
</template>

View File

@ -0,0 +1,97 @@
<script lang="ts" setup>
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@/core/utils/Tools";
import TImageConfigService from "@/services/apps/T_Image_Configs/TImageConfigService";
//
const props = defineProps<{ onSuccess: () => void }>();
const state = reactive({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
//
const refForm = ref<FormInstance>();
//
defineExpose({
/**
* 打开表单初始化
* @param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
state.vm.id = key;
}
refForm.value?.resetFields();
//
state.loading = true;
TImageConfigService.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try{
state.loading = true;
const result = await TImageConfigService.saveForm(state.vm.id, state.vm.form);
state.loading = false;
if (result.code !=200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
}
</script>
<template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @ok="state.visible = false" :width="400">
<template #footer>
<a-button type="primary" :loading="state.loading" @click="save()"> 提交</a-button>
<a-button @click="state.visible = false">关闭</a-button>
</template>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="租户" name="tenantId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.tenantId" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="图片Id" name="imageId" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.imageId" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="图片名称" name="name" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.name" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="图片地址" name="url" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.url" placeholder="请输入" />
</a-form-item>
</a-col>
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>

View File

@ -20,6 +20,7 @@ export default defineConfig({
base: process.env.NODE_ENV == "production" ? "/client/" : "/",
server: {
port: 5501,
host: true,
proxy: {
"/api/v1": {
target: "http://localhost:5500/",

View File

@ -0,0 +1,111 @@
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
/// <summary>
/// 角色标签表 服务 T_Character_LabelService
/// </summary>
public class T_Character_LabelService : ApplicationService<IRepository<T_Character_Label>>
{
public T_Character_LabelService(IRepository<T_Character_Label> defaultRepository)
: base(defaultRepository)
{
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<PagingView> FindListAsync(PagingSearchInput<T_Character_Label> pagingSearchInput)
{
var query = this._defaultRepository.Select
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.LabelName), w => w.LabelName.Contains(pagingSearchInput.Search.LabelName ?? ""))
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.TenantId,
w.LabelName,
w.CreateTime,
w.UpdateTime,
// w.LastModificationTime,
// w.CreationTime
})
;
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
// result
// .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
// .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
// ;
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w.OperatorName!).SetColumn<SysUser>(w => w.Name!);
return result;
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
public async Task DeleteListAsync(List<int> ids)
{
await this._defaultRepository.DeleteByIdsAsync(ids);
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
public async Task<Dictionary<string, object>> FindFormAsync(int id)
{
var res = new Dictionary<string, object>();
var form = await this._defaultRepository.FindByIdAsync(id);
form = form.NullSafe();
if (form.CreateTime == null || form.CreateTime == DateTime.MinValue)
{
form.CreateTime = DateTime.Now;
}
if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue)
{
form.UpdateTime = DateTime.Now;
}
res[nameof(id)] = id;
res[nameof(form)] = form;
return res;
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="form">form</param>
/// <returns></returns>
public Task SaveFormAsync(T_Character_Label form)
{
form.UpdateTime = DateTime.Now;
if (form.CreateTime == null)
{
form.CreateTime = DateTime.Now;
}
return this._defaultRepository.InsertOrUpdateAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<byte[]> ExportExcelAsync(PagingSearchInput<T_Character_Label> pagingSearchInput)
{
pagingSearchInput.Page = -1;
var tableViewModel = await this.FindListAsync(pagingSearchInput);
return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id");
}
}

View File

@ -0,0 +1,126 @@
using IdGen;
using MiaoYu.Repository.ChatAI.Admin.Entities;
namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
/// <summary>
/// 图片表 服务 TImageConfigService
/// </summary>
public class TImageConfigService : ApplicationService<IRepository<T_Image_Config>>
{
public TImageConfigService(IRepository<T_Image_Config> defaultRepository)
: base(defaultRepository)
{
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<PagingView> FindListAsync(PagingSearchInput<T_Image_Config> pagingSearchInput)
{
var query = this._defaultRepository.Select
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? ""))
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.ImageId,
w.Name,
w.Url,
w.OssPath,
w.Bucket,
w.Region,
w.UpdateAt,
w.TenantId,
//w.LastModificationTime,
//w.CreationTime
})
;
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
// 覆盖值
//result
// .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
// .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
// ;
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w.OperatorName!).SetColumn<SysUser>(w => w.Name!);
return result;
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
public async Task DeleteListAsync(List<int> ids)
{
await this._defaultRepository.DeleteByIdsAsync(ids);
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
public async Task<Dictionary<string, object>> FindFormAsync(int id)
{
var res = new Dictionary<string, object>();
var form = await this._defaultRepository.FindByIdAsync(id);
form = form.NullSafe();
res[nameof(id)] = id;
res[nameof(form)] = form;
return res;
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="form">form</param>
/// <returns></returns>
public async Task<T_Image_Config> SaveFormAsync(T_Image_Config form)
{
form.UpdateAt = DateTime.Now;
form.CreateAt = DateTime.Now;
var isUpdate = false;
if (form.Id != 0)
{
var _tempform = this._defaultRepository.FindById(form.Id);
if (_tempform != null)
{
form.CreateAt = _tempform.CreateAt;
isUpdate = true;
}
}
var x = await this._defaultRepository.InsertOrUpdateAsync(form);
if (x.ImageId == 0 && !isUpdate)
{
x.ImageId = x.Id;
}
await this._defaultRepository.InsertOrUpdateAsync(x);
return x;
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<byte[]> ExportExcelAsync(PagingSearchInput<T_Image_Config> pagingSearchInput)
{
pagingSearchInput.Page = -1;
var tableViewModel = await this.FindListAsync(pagingSearchInput);
return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id");
}
}

View File

@ -0,0 +1,115 @@
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
namespace MiaoYu.Api.Admin.ApplicationServices.Apps;
/// <summary>
/// 人物表 服务 T_CharacterService
/// </summary>
public class T_CharacterService : ApplicationService<IRepository<T_Character>>
{
public T_CharacterService(IRepository<T_Character> defaultRepository)
: base(defaultRepository)
{
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<PagingView> FindListAsync(PagingSearchInput<T_Character> pagingSearchInput)
{
var query = this._defaultRepository.Select
.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.Name), w => w.Name.Contains(pagingSearchInput.Search.Name ?? ""))
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
w.Name,
w.Biography,
w.TenantId,
w.Prologue,
w.ModelConfigId,
w.Visibility,
w.CreateTime,
w.UpdateTime,
w.Gender,
w.System,
w.BgImg,
w.IconImg,
// w.LastModificationTime,
// w.CreationTime
})
;
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
// result
// .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
// .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
// ;
// 设置列
//result.GetColumn(query, w => w.System).Width
//result.GetColumn(query, w => w.OperatorName!).SetColumn<SysUser>(w => w.Name!);
return result;
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
public async Task DeleteListAsync(List<int> ids)
{
await this._defaultRepository.DeleteByIdsAsync(ids);
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
public async Task<Dictionary<string, object>> FindFormAsync(int id)
{
var res = new Dictionary<string, object>();
var form = await this._defaultRepository.FindByIdAsync(id);
form = form.NullSafe();
if (form.CreateTime == null || form.CreateTime == DateTime.MinValue)
{
form.CreateTime = DateTime.Now;
}
if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue)
{
form.UpdateTime = DateTime.Now;
}
res[nameof(id)] = id;
res[nameof(form)] = form;
return res;
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="form">form</param>
/// <returns></returns>
public Task SaveFormAsync(T_Character form)
{
form.UpdateTime = DateTime.Now;
return this._defaultRepository.InsertOrUpdateAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<byte[]> ExportExcelAsync(PagingSearchInput<T_Character> pagingSearchInput)
{
pagingSearchInput.Page = -1;
var tableViewModel = await this.FindListAsync(pagingSearchInput);
return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id");
}
}

View File

@ -7,6 +7,7 @@ public class CodeGenerationService : ICodeGenerationService
{
private readonly string _webRootPath;
private readonly string templateRootPath = "/wwwroot/code_generation/template/";
private readonly string templateRootPath_v4 = "/wwwroot/code_generation/templatev4/";
private readonly string codesRootPath = "/code_generation/codes";
private readonly string zipRootPath = "/code_generation/zip";
@ -92,11 +93,19 @@ public class CodeGenerationService : ICodeGenerationService
/// <returns></returns>
public LowCodeTable FillPathByLowCodeTable(LowCodeTable lowCodeTable)
{
var rootPath = App.WebApplication.Environment.ContentRootPath.Replace("\\" + App.WebApplication.Environment.ApplicationName, "");
if (string.IsNullOrWhiteSpace(lowCodeTable.ModelPath))
{
lowCodeTable.ModelPath = rootPath + $"\\{typeof(AdminRepositoryStartup).Namespace}\\Entities\\Apps";
if (lowCodeTable.DataBase == "MiaoYuChat")
{
lowCodeTable.ModelPath = rootPath + $"\\{typeof(ChatAdminRepositoryStartup).Namespace}\\Entities\\Apps";
}
else
{
lowCodeTable.ModelPath = rootPath + $"\\{typeof(AdminRepositoryStartup).Namespace}\\Entities\\Apps";
}
}
if (string.IsNullOrWhiteSpace(lowCodeTable.ServicePath))
@ -152,8 +161,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenModelAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateModel, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateModel, context));
}
/// <summary>
@ -164,8 +177,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenServiceAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateService, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateService, context));
}
/// <summary>
@ -176,8 +193,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenControllerAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateController, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateController, context));
}
/// <summary>
@ -188,8 +209,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenServiceJsAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateServiceJs, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateServiceJs, context));
}
/// <summary>
@ -200,8 +225,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenIndexAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateIndex, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateIndex, context));
}
/// <summary>
@ -212,8 +241,12 @@ public class CodeGenerationService : ICodeGenerationService
public async Task<string> GenInfoAsync(GenFormDto genFormDto)
{
var context = GetGenContextDto(genFormDto);
return ClearSymbol(await _razorViewRender.RenderAsync(templateRootPath + templateInfo, context));
var _templateRootPath = templateRootPath;
if (context.DataBase == "MiaoYuChat")
{
_templateRootPath = templateRootPath_v4;
}
return ClearSymbol(await _razorViewRender.RenderAsync(_templateRootPath + templateInfo, context));
}
@ -488,6 +521,10 @@ public class CodeGenerationService : ICodeGenerationService
private string FindCodeFileClassName(GenFormDto genFormDto)
{
var tableName = genFormDto.TableName.ToLineConvertHump();
if (genFormDto.TableName.Contains("T_"))
{
tableName = genFormDto.TableName;
}
return genFormDto.Type switch
{
"MiaoYu.Models" => $"{tableName}.cs",
@ -520,13 +557,37 @@ public class CodeGenerationService : ICodeGenerationService
switch (type)
{
case FileTypeEnum.Model:
path = tableInfo.ModelPath + $"/{humpTableName}s";
if (tableInfo.DataBase == "MiaoYuChat")
{
path = tableInfo.ModelPath + $"/";
}
else
{
path = tableInfo.ModelPath + $"/{humpTableName}s";
}
break;
case FileTypeEnum.Service:
path = tableInfo.ServicePath + $"/{humpTableName}s";
if (tableInfo.DataBase == "MiaoYuChat")
{
path = tableInfo.ServicePath + $"/MiaoYuChat";
}
else
{
path = tableInfo.ServicePath + $"/{humpTableName}s";
}
break;
case FileTypeEnum.Controller:
path = tableInfo.ControllerPath + $"/{humpTableName}s";
if (tableInfo.DataBase == "MiaoYuChat")
{
path = tableInfo.ControllerPath + $"/MiaoYuChat";
}
else
{
path = tableInfo.ControllerPath + $"/{humpTableName}s";
}
break;
case FileTypeEnum.ClientIndex:
path = tableInfo.ClientIndexPath + $"/{tableName}s";

View File

@ -1,4 +1,5 @@
using MiaoYu.Repository.ChatAI.Admin.Entities;
using MiaoYu.Repository.Admin.Entities.LowCode;
using MiaoYu.Repository.ChatAI.Admin.Entities;
namespace MiaoYu.Api.Admin.ApplicationServices.DevelopmentTools.LowCode.Impl;
@ -116,6 +117,7 @@ public class LowCodeTableService : ApplicationService<IRepository<LowCodeTable>>
item.Schema = item.Schema.Replace(".MiaoYuChat", "");
lowCodeTable.Schema = item.Schema;
lowCodeTable.DataBase = "MiaoYuChat";
lowCodeTable.EntityName = item.Name;
}
insertList.Add(lowCodeTable);
}
@ -127,6 +129,7 @@ public class LowCodeTableService : ApplicationService<IRepository<LowCodeTable>>
item.Schema = item.Schema.Replace(".MiaoYuChat", "");
table.Schema = item.Schema;
table.DataBase = "MiaoYuChat";
table.EntityName = item.Name;
}
updateList.Add(table);

View File

@ -0,0 +1,100 @@
using MiaoYu.Api.Admin.ApplicationServices.Apps;
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
namespace MiaoYu.Api.Admin.Controllers.Apps;
/// <summary>
/// 角色标签表 控制器
/// </summary>
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "角色标签表")]
public class T_Character_LabelController : AdminControllerBase<T_Character_LabelService>
{
public T_Character_LabelController(T_Character_LabelService defaultService)
: base(defaultService)
{
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")]
[HttpPost]
public Task<PagingView> FindListAsync([FromBody] PagingSearchInput<T_Character_Label> pagingSearchInput)
{
return this._defaultService.FindListAsync(pagingSearchInput);
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
[HttpPost]
public async Task<bool> DeleteListAsync([FromBody] List<int> ids)
{
await this._defaultService.DeleteListAsync(ids);
return true;
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public Task<Dictionary<string, object>> FindFormAsync([FromRoute] int id)
{
return this._defaultService.FindFormAsync(id);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] T_Character_Label form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] T_Character_Label form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")]
[ApiResourceCacheFilter(10)]
[HttpPost]
public async Task ExportExcelAsync([FromBody] PagingSearchInput<T_Character_Label> pagingSearchInput)
{
var data = await this._defaultService.ExportExcelAsync(pagingSearchInput);
var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls";
base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
}
}

View File

@ -0,0 +1,100 @@
using MiaoYu.Api.Admin.ApplicationServices.Apps;
using MiaoYu.Repository.ChatAI.Admin.Entities;
namespace MiaoYu.Api.Admin.Controllers.Apps;
/// <summary>
/// 图片表 控制器
/// </summary>
[ControllerDescriptor(MenuId = "44", DisplayName = "图片表")]
public class TImageConfigController : AdminControllerBase<TImageConfigService>
{
public TImageConfigController(TImageConfigService defaultService)
: base(defaultService)
{
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")]
[HttpPost]
public Task<PagingView> FindListAsync([FromBody] PagingSearchInput<T_Image_Config> pagingSearchInput)
{
return this._defaultService.FindListAsync(pagingSearchInput);
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
[HttpPost]
public async Task<bool> DeleteListAsync([FromBody] List<int> ids)
{
await this._defaultService.DeleteListAsync(ids);
return true;
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public Task<Dictionary<string, object>> FindFormAsync([FromRoute] int id)
{
return this._defaultService.FindFormAsync(id);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] T_Image_Config form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] T_Image_Config form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")]
[ApiResourceCacheFilter(10)]
[HttpPost]
public async Task ExportExcelAsync([FromBody] PagingSearchInput<T_Image_Config> pagingSearchInput)
{
var data = await this._defaultService.ExportExcelAsync(pagingSearchInput);
var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls";
base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
}
}

View File

@ -0,0 +1,100 @@
using MiaoYu.Api.Admin.ApplicationServices.Apps;
using MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
namespace MiaoYu.Api.Admin.Controllers.Apps;
/// <summary>
/// 人物表 控制器
/// </summary>
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "人物表")]
public class T_CharacterController : AdminControllerBase<T_CharacterService>
{
public T_CharacterController(T_CharacterService defaultService)
: base(defaultService)
{
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")]
[HttpPost]
public Task<PagingView> FindListAsync([FromBody] PagingSearchInput<T_Character> pagingSearchInput)
{
return this._defaultService.FindListAsync(pagingSearchInput);
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
[HttpPost]
public async Task<bool> DeleteListAsync([FromBody] List<int> ids)
{
await this._defaultService.DeleteListAsync(ids);
return true;
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public Task<Dictionary<string, object>> FindFormAsync([FromRoute] int id)
{
return this._defaultService.FindFormAsync(id);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] T_Character form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] T_Character form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")]
[ApiResourceCacheFilter(10)]
[HttpPost]
public async Task ExportExcelAsync([FromBody] PagingSearchInput<T_Character> pagingSearchInput)
{
var data = await this._defaultService.ExportExcelAsync(pagingSearchInput);
var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls";
base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
}
}

View File

@ -129,6 +129,126 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService">
<summary>
角色标签表 服务 T_Character_LabelService
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label})">
<summary>
获取列表数据
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService.SaveFormAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label)">
<summary>
保存数据
</summary>
<param name="form">form</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_Character_LabelService.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService">
<summary>
图片表 服务 TImageConfigService
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config})">
<summary>
获取列表数据
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService.SaveFormAsync(MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config)">
<summary>
保存数据
</summary>
<param name="form">form</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.TImageConfigService.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService">
<summary>
人物表 服务 T_CharacterService
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character})">
<summary>
获取列表数据
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.SaveFormAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character)">
<summary>
保存数据
</summary>
<param name="form">form</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.ApplicationServices.Apps.T_CharacterService.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.ApplicationServices.Bases.MemberService">
<summary>
会员服务
@ -1305,6 +1425,147 @@
</summary>
<param name="defaultService">默认服务</param>
</member>
<member name="T:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController">
<summary>
角色标签表 控制器
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label})">
<summary>
获取列表
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.CreateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label)">
<summary>
添加
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.UpdateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label)">
<summary>
编辑
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_Character_LabelController.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController">
<summary>
图片表 控制器
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config})">
<summary>
获取列表
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.CreateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config)">
<summary>
添加
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.UpdateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config)">
<summary>
编辑
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.TImageConfigController.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController">
<summary>
人物表 控制器
</summary>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.FindListAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character})">
<summary>
获取列表
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.DeleteListAsync(System.Collections.Generic.List{System.Int32})">
<summary>
根据id数组删除
</summary>
<param name="ids">ids</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.FindFormAsync(System.Int32)">
<summary>
查询表单数据
</summary>
<param name="id">id</param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.CreateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character)">
<summary>
添加
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.UpdateAsync(MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character)">
<summary>
编辑
</summary>
<param name="form"></param>
<returns></returns>
</member>
<member name="M:MiaoYu.Api.Admin.Controllers.Apps.T_CharacterController.ExportExcelAsync(MiaoYu.Shared.Admin.Models.PagingViews.PagingSearchInput{MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character})">
<summary>
导出Excel
</summary>
<param name="pagingSearchInput"></param>
<returns></returns>
</member>
<member name="T:MiaoYu.Api.Admin.Controllers.Bases.MemberController">
<summary>
会员控制器
@ -2297,6 +2558,19 @@
版本
</summary>
</member>
<member name="M:AspNetCoreGeneratedDocument.wwwroot_code_generation_templatev4_tempModel.GetTypeNew(MiaoYu.Repository.Admin.Entities.LowCode.LowCodeTableInfo)">
<summary>
获取类型 根据 appTableInfo
</summary>
<param name="appTableInfo"></param>
<returns></returns>
</member>
<member name="M:AspNetCoreGeneratedDocument.wwwroot_code_generation_templatev4_tempModel.GetIdType">
<summary>
获取 id 组件所对应的类型
</summary>
<returns></returns>
</member>
<member name="M:AspNetCoreGeneratedDocument.wwwroot_code_generation_template_tempModel.GetTypeNew(MiaoYu.Repository.Admin.Entities.LowCode.LowCodeTableInfo)">
<summary>
获取类型 根据 appTableInfo

View File

@ -6,7 +6,7 @@
<pre>
using @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
using @(Model.Namespace).@(Model.DataBase == "MiaoYuChat" ? "Repository.ChatAI.Admin.Entities.Apps;" : "Repository.EntityFramework.Admin.Entities.Apps;");
using @(Model.Namespace).@(Model.DataBase == "MiaoYuChat" ? "Repository.ChatAI.Admin.Entities.Apps;" : "Repository.EntityFramework.Admin.Entities.Apps;")
namespace @(Model.Namespace).Api.Admin.Controllers.Apps;
/// <summary>

View File

@ -54,11 +54,19 @@ public class @(className)Service : ApplicationService<@("IRepository")<@(classNa
public async Task<@("PagingView")> FindListAsync(PagingSearchInput<@(className)> pagingSearchInput)
{
var query = this._defaultRepository.Select
@if (!string.IsNullOrWhiteSpace(searchKeyWord))
{
<pre>.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))</pre>
}
.OrderByDescending(w => w.CreationTime)
@if (!string.IsNullOrWhiteSpace(searchKeyWord))
{
<pre>.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))</pre>
}
@if (!string.IsNullOrWhiteSpace(searchKeyWord))
{
<pre> .OrderByDescending(w => w.Id)</pre>
}
@if (!string.IsNullOrWhiteSpace(searchKeyWord))
{
<pre> .OrderByDescending(w => w.CreationTime)</pre>
}
.Select(w => new
{
w.Id,
@ -69,13 +77,14 @@ public class @(className)Service : ApplicationService<@("IRepository")<@(classNa
;
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
// 覆盖值
result
.FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
.FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
;
@if (Model.DataBase != "MiaoYuChat")
{
// 覆盖值
<pre> result
.FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
.FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
;</pre>
}
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w.OperatorName!).SetColumn<@("SysUser")>(w => w.Name!);

View File

@ -0,0 +1,259 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var tableName = Model.TableName;
var ignores = new string[] {
"Id",
"CreationTime",
"CreatorUserId",
"LastModificationTime",
"LastModifierUserId" ,
"DeletionTime",
"DeleterUserId",
"IsDeleted"
};
var tableInfos = Model.TableInfos
.Where(w => !ignores.Contains(w.ColumnName))
.OrderBy(w => w.Position)
.ToList()
;
var searchKeyWords = new[] { "Title", "Name", "Phone", "Address", "Email" };
var searchKeyWord = string.Empty;
foreach (var item in searchKeyWords)
{
if (tableInfos.Any(w => w.ColumnName == item))
{
searchKeyWord = item;
break;
}
}
if (string.IsNullOrWhiteSpace(searchKeyWord))
{
searchKeyWord = "请设置检索框";
}
}
<pre>
<script lang="ts" setup>
import { reactive, ref, onMounted } from "vue";
import { FormInstance } from "ant-design-vue";
import { useAuthority } from "@@/utils/Authority";
import AppIcon from "@@/core/components/AppIcon.vue";
import Info from "./Info.vue";
import Tools from "@@/core/utils/Tools";
import PageContainer from "@@/core/components/PageContainer.vue";
import TableCurd from "@@/core/components/curd/TableCurd.vue";
import @(className)Service from "@@/services/apps/@(tableName)s/@(className)Service";
defineOptions({ name: "@(className)Index" });
const state = reactive({
search: {
state: false,
vm: {
name: undefined,
},
sort: [] as any[],
},
loading: false,
page: 1,
size: 10,
total: 100,
columns: [] as any,
data: [] as any,
});
//权限
const power = useAuthority();
//表格
const refTableCurd = ref<InstanceType<typeof TableCurd>>();
//表单操作对象
const refInfo = ref<InstanceType<typeof Info>>();
//检索表单
const refSearchForm = ref<FormInstance>();
/**
* 初始化
*/
onMounted(() => {
findList();
});
/**
*获取数据
*/
async function findList() {
try{
state.loading = true;
const result = await @(className)Service.findList(state.page, state.size, state.search.vm, state.search.sort);
state.loading = false;
if (result.code != 200) return;
state.page = result.data.page;
state.size = result.data.size;
state.total = result.data.total;
state.columns = result.data.columns;
state.data = result.data.dataSource;
// state.visible = false;
} catch (error) {
state.loading = false;
}
}
/**
* 删除数据
* @@param id
*/
async function deleteList(id?: string) {
let ids: string[] = [];
if (id) {
ids.push(id);
} else {
ids = refTableCurd.value?.getSelectedRowKeys() ?? [];
}
if (ids.length == 0) return Tools.message.error("请选择要删除的行!");
try{
state.loading = true;
const result = await @(className)Service.deleteList(ids);
state.loading = false;
if (result.code != 200) return;
Tools.message.success("删除成功!");
findList();
} catch (error) {
state.loading = false;
}
}
/**
* 导出excel
*/
function exportExcel() {
@(className)Service.exportExcel(state.search.vm, state.search.sort);
}
</script>
<template>
<PageContainer>
<TableCurd
ref="refTableCurd"
:config="state"
@@change="
(changeTable) => {
state.page = changeTable.pagination.current ?? 1;
state.size = changeTable.pagination.pageSize ?? state.size;
state.search.sort = changeTable.sorter instanceof Array ? [...changeTable.sorter] : [changeTable.sorter];
findList();
}
"
@@show-size-change="
({ current, size }) => {
state.page = current == 0 ? 1 : current;
state.size = size;
findList();
}
"
>
<!-- search -->
<template #search>
<a-form ref="refSearchForm" :model="state.search.vm" v-if="power.search">
<a-row :gutter="[16, 0]">
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6">
<a-form-item class="mb-0" name="name" label="名称">
<a-input v-model:value="state.search.vm.name" placeholder="名称" />
</a-form-item>
</a-col>
<!--button-->
<a-col :xs="24" :sm="12" :md="8" :lg="6" :xl="6" class="text-right">
<a-space :size="8">
<a-button
@@click="
state.page = 1;
refSearchForm?.resetFields();
findList();
"
>
重置
</a-button>
<a-button
type="primary"
@@click="
state.page = 1;
findList();
"
>
查询
</a-button>
</a-space>
</a-col>
</a-row>
</a-form>
</template>
<!-- toolbar-left -->
<template #toolbar-left>
<a-button @@click="state.search.state = !state.search.state" v-if="power.search">
<div v-if="state.search.state"><AppIcon name="UpOutlined" />&nbsp;&nbsp;收起</div>
<div v-else><AppIcon name="DownOutlined" />&nbsp;&nbsp;展开</div>
</a-button>
<a-button type="primary" @@click="() => refInfo?.open()" v-if="power.insert">
<template #icon>
<AppIcon name="PlusOutlined" />
</template>
新建
</a-button>
<a-popconfirm title="您确定要删除?" @@confirm="deleteList()" okText="确定" cancelText="取消" v-if="power.delete">
<a-button type="primary" danger>
<template #icon>
<AppIcon name="DeleteOutlined" />
</template>
批量删除
</a-button>
</a-popconfirm>
</template>
<!-- toolbar-right -->
<template #toolbar-right>
<a-dropdown>
<template #overlay>
<a-menu>
<a-menu-item key="1" @@click="exportExcel()">导出 Excel</a-menu-item>
</a-menu>
</template>
<a-button> 更多 <AppIcon name="ellipsis-outlined" /> </a-button>
</a-dropdown>
<!-- 列设置 -->
<a-popover>
<template #content>
<div v-for="item in state.columns.filter((w:any) => w.fieldName.substr(0, 1) != '_')">
<a-checkbox v-model:checked="item.show">{{ item.title }}</a-checkbox>
</div>
</template>
<a-button type="text">
<template #icon><AppIcon name="setting-outlined" /> </template>
</a-button>
</a-popover>
</template>
<!-- table-col -->
<template #table-col>
<template v-for="item,index in state.columns.filter((w:any) => w.fieldName !== 'id' && w.show)" :key="item.fieldName">
<a-table-column :title="item.title" :data-index="item.fieldName" :sorter="item.sort ? { multiple: index + 1 } : false" />
</template>
<!-- 操作 -->
<a-table-column title="操作" data-index="id" v-if="power.update || power.delete">
<template #default="{ record }">
<a href="javascript:;" @@click="() => refInfo?.open(record.id)" v-if="power.update">编辑</a>
<a-divider type="vertical" />
<a-popconfirm title="您确定要删除?" @@confirm="deleteList(record.id)" okText="确定" cancelText="取消" v-if="power.delete">
<a class="text-danger">删除</a>
</a-popconfirm>
</template>
</a-table-column>
</template>
</TableCurd>
<!-- Info -->
<Info ref="refInfo" :onSuccess="() => findList()" />
</PageContainer>
</template>
</pre>

View File

@ -0,0 +1,113 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var tableName = Model.TableName;
var ignores = new string[] {
"Id",
"CreationTime",
"CreatorUserId",
"LastModificationTime",
"LastModifierUserId" ,
"DeletionTime",
"DeleterUserId",
"IsDeleted"
};
var tableInfos = Model.TableInfos
.Where(w => !ignores.Contains(w.ColumnName))
.OrderBy(w => w.Position)
.ToList()
;
}
<pre>
<script lang="ts" setup>
import { reactive, ref } from "vue";
import { FormInstance } from "ant-design-vue";
import Tools from "@@/core/utils/Tools";
import @(className)Service from "@@/services/apps/@(tableName)s/@(className)Service";
//定义组件事件
const props = defineProps<{ onSuccess: () => void }>();
const state = reactive({
vm: {
id: "",
form: {} as any,
},
visible: false,
loading: false,
});
//表单实例
const refForm = ref<FormInstance>();
//向父级导出 函数
defineExpose({
/**
* 打开表单初始化
* @@param key
*/
open: (key: string = "") => {
state.visible = true;
if (state.visible) {
state.vm.id = key;
}
refForm.value?.resetFields();
//初始化表单数据
state.loading = true;
@(className)Service.findForm(key).then((res) => {
state.loading = false;
if (res.code != 200) return;
state.vm = res.data;
});
},
});
/**
*保存数据
*/
function save() {
refForm.value?.validate().then(async () => {
try{
state.loading = true;
const result = await @(className)Service.saveForm(state.vm.id, state.vm.form);
state.loading = false;
if (result.code !=200) return;
Tools.message.success("操作成功!");
props.onSuccess();
state.visible = false;
} catch (error) {
state.loading = false;
}
});
}
</script>
<template>
<a-modal v-model:open="state.visible" :title="state.vm.id ? '编辑' : '新建'" centered @@ok="state.visible = false" :width="400">
<template #footer>
<a-button type="primary" :loading="state.loading" @@click="save()"> 提交</a-button>
<a-button @@click="state.visible = false">关闭</a-button>
</template>
<a-spin :spinning="state.loading">
<a-form ref="refForm" layout="vertical" :model="state.vm.form">
<a-row :gutter="[16, 0]">
@foreach (var item in tableInfos)
{
var name = item.ColumnName.ToFirstCharConvertLower();
var title = item.DisplayName ?? item.Describe;
title = string.IsNullOrWhiteSpace(title) ? "请设置列信息 " + item.ColumnName : title;
<a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
<a-form-item label="@(title ?? "请设置列信息 > " + item.ColumnName)" name="@(name)" :rules="[{ required: true, message: '请输入', trigger: 'blur' }]">
<a-input v-model:value="state.vm.form.@(name)" placeholder="请输入" />
</a-form-item>
</a-col>
}
</a-row>
</a-form>
</a-spin>
</a-modal>
</template>
</pre>

View File

@ -0,0 +1,81 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var classNameRemark = Model.DisplayName;
}
<pre>
import Http from "@@/core/utils/Http";
/**
* @(className)服务
*/
export default class @(className)Service {
static urlPrefix = "/api/v1/admin/@className";
/**
* 获取数据列表
* @@param current
* @@param pageSize
* @@param search
* @@param searchSort
* @@returns
*/
static findList(current: number, pageSize: number, search: any = {}, searchSort: any[] = []) {
return Http.post(`${this.urlPrefix}/findList`, {
page: current,
size: pageSize,
search,
searchSort
})
}
/**
* 删除集合数据
*
* @@param ids
* @@returns
*/
static deleteList(ids: string[]) {
return Http.post(`${this.urlPrefix}/deleteList`, ids)
}
/**
* 查询表单
*
* @@param id
* @@returns
*/
static findForm(id?: string | undefined) {
return Http.get(`${this.urlPrefix}/findForm${(id ? '/' + id : '')}`)
}
/**
* 保存表单数据
*
* @@param id
* @@param formData
* @@returns
*/
static saveForm(id: string | undefined, formData: any) {
return Http.post(`${this.urlPrefix}/${id ? 'update' : 'create'}`, formData)
}
/**
* 导出 excel
*
* @@param search
* @@param searchSort
* @@returns
*/
static exportExcel(search: any = {}, searchSort: any[] = []) {
return Http.download(`${this.urlPrefix}/exportExcel`, {
page: -1,
size: -1,
search,
searchSort
});
}
}
</pre>

View File

@ -0,0 +1,109 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var classNameRemark = Model.DisplayName;
}
<pre>
using @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
using @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
namespace @(Model.Namespace).Api.Admin.Controllers.Apps;
/// <summary>
/// @(classNameRemark) 控制器
/// </summary>
[ControllerDescriptor(MenuId = "请设置菜单Id 系统菜单表中查找,如果不设置不受权限保护!", DisplayName = "@(classNameRemark)")]
public class @(className)Controller : AdminControllerBase<@($"{className}Service")>
{
public @(className)Controller(@(className)Service defaultService)
: base(defaultService)
{
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Display, DisplayName = "查看数据")]
[HttpPost]
public Task<@("PagingView")> FindListAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput)
{
return this._defaultService.FindListAsync(pagingSearchInput);
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Delete, DisplayName = "删除数据")]
[HttpPost]
public async Task<@("bool")> DeleteListAsync([FromBody] List<@("int")> ids)
{
await this._defaultService.DeleteListAsync(ids);
return true;
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
[ActionDescriptor(DisplayName = "查看表单")]
[HttpGet("{id?}")]
public Task<@Html.Raw("Dictionary<string, object>")> FindFormAsync([FromRoute] int id)
{
return this._defaultService.FindFormAsync(id);
}
/// <summary>
/// 添加
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Insert, DisplayName = "创建表单")]
[HttpPost]
[ApiCheckModel]
public Task CreateAsync([FromBody] @(className) form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="form"></param>
/// <returns></returns>
[RequestLimitFilter(Duration = 1, LimitCount = 1)]
[ActionDescriptor(PermissionFunctionConsts.Function_Update, DisplayName = "编辑表单")]
[HttpPost]
[ApiCheckModel]
public Task UpdateAsync([FromBody] @(className) form)
{
return this._defaultService.SaveFormAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
[ActionDescriptor(PermissionFunctionConsts.Function_Export, DisplayName = "导出数据")]
[ApiResourceCacheFilter(10)]
[HttpPost]
public async Task ExportExcelAsync([FromBody] PagingSearchInput<@(className)> pagingSearchInput)
{
var data = await this._defaultService.ExportExcelAsync(pagingSearchInput);
var name = $"{PermissionUtil.GetControllerDisplayName(this.GetType())}列表数据 {DateTime.Now.ToString("yyyy-MM-dd")}.xls";
base.HttpContext.DownLoadFile(data, Tools.GetFileContentType[".xls"].ToStr(), name);
}
}
</pre>

View File

@ -0,0 +1,116 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var classNameRemark = Model.DisplayName;
var ignores = new string[] {
"Id",
"CreationTime",
"CreatorUserId",
"LastModificationTime",
"LastModifierUserId" ,
"DeletionTime",
"DeleterUserId",
"IsDeleted",
"TenantId",
};
var tableInfos = Model.TableInfos
.Where(w => !ignores.Contains(w.ColumnName))
.OrderBy(w => w.Position)
.ToList()
;
}
@functions
{
//获取类型 根据 appTableInfo
string GetType(DbColumnInfo appTableInfo)
{
switch (appTableInfo.DbTypeText)
{
case "uniqueidentifier":
return appTableInfo.IsPrimary ? "Guid" : "Guid?";
case "bit":
case "int":
return appTableInfo.IsPrimary ? "int" : "int?";
case "datetime":
return appTableInfo.IsNullable ? "DateTime?" : "DateTime";
case "float":
case "money":
return appTableInfo.IsNullable ? "double?" : "double";
case "decimal":
return appTableInfo.IsNullable ? "decimal?" : "decimal";
default:
return appTableInfo.IsNullable ? appTableInfo.CsType.Name + "?" : appTableInfo.CsType.Name;
}
}
/// <summary>
/// 获取类型 根据 appTableInfo
/// </summary>
/// <param name="appTableInfo"></param>
/// <returns></returns>
string GetTypeNew(LowCodeTableInfo appTableInfo)
{
if (appTableInfo.CsType.ToLower() == "string")
{
return "string?";
}
return appTableInfo.IsNullable ? $"{appTableInfo.CsType}?" : appTableInfo.CsType;
}
/// <summary>
/// 获取 id 组件所对应的类型
/// </summary>
/// <returns></returns>
string GetIdType()
{
var lowCodeTableInfo = Model.TableInfos.Where(w => w.ColumnName == "Id")?.FirstOrDefault();
if (Model.DataBase == "MiaoYuChat")
{
return "DefaultEntityV4";
}
if (lowCodeTableInfo == null) return "DefaultEntity";
if (lowCodeTableInfo.CsType.ToLower().Contains("string"))
return "DefaultEntityStringKey";
if (lowCodeTableInfo.CsType.ToLower().Contains("int"))
return "DefaultEntityIdentityIntKey";
if (lowCodeTableInfo.CsType.ToLower().Contains("guid"))
return "DefaultEntity";
return "DefaultEntity<" + lowCodeTableInfo.CsType + ">";
}
}
<pre>
namespace @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
/// <summary>
/// @(string.IsNullOrWhiteSpace(classNameRemark) ? className : classNameRemark)
/// </summary>
[EntityDescription(FieldIgnored = true)]
public class @className : @(GetIdType())
{
@foreach (var item in tableInfos)
{
<pre>
/// <summary>
/// @(string.IsNullOrWhiteSpace(item.DisplayName) ? item.ColumnName : item.DisplayName) => 备注: @(string.IsNullOrWhiteSpace(item.Describe) ? item.ColumnName : item.Describe)
/// </summary>
public @(GetTypeNew(item)) @item.ColumnName { get; set; }
</pre>
}
}
</pre>

View File

@ -0,0 +1,142 @@
@model GenDbTableDto
@{
var className = Model.EntityName;
var classNameRemark = Model.DisplayName;
var ignores = new string[]
{
"Id",
"CreationTime",
"CreatorUserId",
"LastModificationTime",
"LastModifierUserId",
"DeletionTime",
"DeleterUserId",
"IsDeleted"
};
var tableInfos = Model.TableInfos
.Where(w => !ignores.Contains(w.ColumnName))
.OrderBy(w => w.Position)
.ToList()
;
var searchKeyWords = new[] { "Title", "Name", "Phone", "Address", "Email" };
var searchKeyWord = string.Empty;
foreach (var item in searchKeyWords)
{
if (tableInfos.Any(w => w.ColumnName.Contains(item)))
{
searchKeyWord = item;
break;
}
}
}
<pre>
using @(Model.Namespace).Repository.ChatAI.Admin.Entities.Apps;
namespace @(Model.Namespace).Api.Admin.ApplicationServices.Apps;
/// <summary>
/// @(classNameRemark) 服务 @(className)Service
/// </summary>
public class @(className)Service : ApplicationService<@("IRepository")<@(className)>>
{
public @(className)Service(IRepository<@(className)> defaultRepository)
: base(defaultRepository)
{
}
/// <summary>
/// 获取列表数据
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<@("PagingView")> FindListAsync(PagingSearchInput<@(className)> pagingSearchInput)
{
var query = this._defaultRepository.Select
@if (!string.IsNullOrWhiteSpace(searchKeyWord))
{
<pre>.WhereIf(!string.IsNullOrWhiteSpace(pagingSearchInput.Search?.@(searchKeyWord)), w => w.@(searchKeyWord).Contains(pagingSearchInput.Search.@(searchKeyWord) ?? ""))</pre>
}
.OrderByDescending(w => w.Id)
.Select(w => new
{
w.Id,
@(string.Join(',', tableInfos.Select(w => "w." + w.ColumnName)))@(",")
// w.LastModificationTime,
// w.CreationTime
})
;
var result = await _defaultRepository.AsPagingViewAsync(query, pagingSearchInput);
// result
// .FormatValue(query, w => w.CreationTime, (oldValue) => oldValue.ToString("yyyy-MM-dd"))
// .FormatValue(query, w => w.LastModificationTime, (oldValue) => oldValue?.ToString("yyyy-MM-dd"))
// ;
// 设置列
//result.GetColumn(query, w => w.OperatorName).SetColumn("操作人");
//result.GetColumn(query, w => w.OperatorName!).SetColumn<@("SysUser")>(w => w.Name!);
return result;
}
/// <summary>
/// 根据id数组删除
/// </summary>
/// <param name="ids">ids</param>
/// <returns></returns>
public async Task DeleteListAsync(List<@("int")> ids)
{
await this._defaultRepository.DeleteByIdsAsync(ids);
}
/// <summary>
/// 查询表单数据
/// </summary>
/// <param name="id">id</param>
/// <returns></returns>
public async Task<@("Dictionary")<@("string,object")>> FindFormAsync(int id)
{
var res = new Dictionary<@("string, object")>();
var form = await this._defaultRepository.FindByIdAsync(id);
form = form.NullSafe();
//if (form.CreateTime == null || form.CreateTime == DateTime.MinValue)
//{
// form.CreateTime = DateTime.Now;
//}
//if (form.UpdateTime == null || form.UpdateTime == DateTime.MinValue)
//{
// form.UpdateTime = DateTime.Now;
//}
res[nameof(id)] = id;
res[nameof(form)] = form;
return res;
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="form">form</param>
/// <returns></returns>
public Task SaveFormAsync(@className form)
{
return this._defaultRepository.InsertOrUpdateAsync(form);
}
/// <summary>
/// 导出Excel
/// </summary>
/// <param name="pagingSearchInput"></param>
/// <returns></returns>
public async Task<@("byte[]")> ExportExcelAsync(PagingSearchInput<@(className)> pagingSearchInput)
{
pagingSearchInput.Page = -1;
var tableViewModel = await this.FindListAsync(pagingSearchInput);
return ExcelUtil.ExportExcelByPagingView(tableViewModel, null, "Id");
}
}
</pre>

View File

@ -0,0 +1,29 @@
namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
/// <summary>
/// 角色标签表
/// </summary>
[EntityDescription(FieldIgnored = true)]
public class T_Character_Label : DefaultEntityV4
{
/// <summary>
/// 标签名称 => 备注: 标签名称
/// </summary>
public string? LabelName { get; set; }
/// <summary>
/// 创建时间 => 备注: 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间 => 备注: 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
}

View File

@ -0,0 +1,77 @@
namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
/// <summary>
/// 人物表
/// </summary>
[EntityDescription(FieldIgnored = true)]
public class T_Character : DefaultEntityV4
{
/// <summary>
/// 人物名字 => 备注: 人物名字
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 人物简介 => 备注: 人物简介
/// </summary>
public string? Biography { get; set; }
/// <summary>
/// 开场白 => 备注: 开场白
/// </summary>
public string? Prologue { get; set; }
/// <summary>
/// 模型Id => 备注: 模型Id
/// </summary>
public Int32 ModelConfigId { get; set; }
/// <summary>
/// 公开/私密 0公开 1私密 => 备注: 公开/私密 0公开 1私密
/// </summary>
public Boolean Visibility { get; set; }
/// <summary>
/// 创建时间 => 备注: 创建时间
/// </summary>
public DateTime? CreateTime { get; set; }
/// <summary>
/// 更新时间 => 备注: 更新时间
/// </summary>
public DateTime? UpdateTime { get; set; }
/// <summary>
/// 性别0男1女2其他 => 备注: 性别0男1女2其他
/// </summary>
public Int32 Gender { get; set; }
/// <summary>
/// 人物初始设定 => 备注: 人物初始设定
/// </summary>
public string? System { get; set; }
/// <summary>
/// 背景图片 => 备注: 背景图片
/// </summary>
public Int32? BgImg { get; set; }
/// <summary>
/// 角色头像是id => 备注: 角色头像是id
/// </summary>
public Int32? IconImg { get; set; }
}

View File

@ -0,0 +1,28 @@
namespace MiaoYu.Repository.ChatAI.Admin.Entities.Apps;
/// <summary>
/// 图片表
/// </summary>
public class T_Image_Config : DefaultEntityV4
{
/// <summary>
/// 图片Id => 备注: 图片Id
/// </summary>
public Int32 ImageId { get; set; }
/// <summary>
/// 图片名称 => 备注: 图片名称
/// </summary>
public string? Name { get; set; }
/// <summary>
/// 图片地址 => 备注: 图片地址
/// </summary>
public string? Url { get; set; }
}

View File

@ -35,6 +35,31 @@ namespace MiaoYu.Repository.ChatAI.Admin.Entities
public string Url { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateAt { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateAt { get; set; }
/// <summary>
/// oss存放路径
/// </summary>
public string? OssPath { get; set; }
/// <summary>
/// 存储桶
/// </summary>
public string? Bucket { get; set; }
/// <summary>
/// 地域
/// </summary>
public string? Region { get; set; }
}
}

View File

@ -8,6 +8,10 @@
<DocumentationFile>$(MSBuildProjectName).xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Entities\Apps\T_Image_Config.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Rougamo.Fody" Version="2.3.1" />
</ItemGroup>
@ -20,7 +24,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Entities\" />
<Folder Include="Entities\Apps\" />
</ItemGroup>
</Project>

View File

@ -37,6 +37,86 @@
</summary>
<param name="webApplication"></param>
</member>
<member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label">
<summary>
角色标签表
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label.LabelName">
<summary>
标签名称 => 备注: 标签名称
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label.CreateTime">
<summary>
创建时间 => 备注: 创建时间
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character_Label.UpdateTime">
<summary>
更新时间 => 备注: 更新时间
</summary>
</member>
<member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character">
<summary>
人物表
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.Name">
<summary>
人物名字 => 备注: 人物名字
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.Biography">
<summary>
人物简介 => 备注: 人物简介
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.Prologue">
<summary>
开场白 => 备注: 开场白
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.ModelConfigId">
<summary>
模型Id => 备注: 模型Id
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.Visibility">
<summary>
公开/私密 0公开 1私密 => 备注: 公开/私密 0公开 1私密
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.CreateTime">
<summary>
创建时间 => 备注: 创建时间
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.UpdateTime">
<summary>
更新时间 => 备注: 更新时间
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.Gender">
<summary>
性别0男1女2其他 => 备注: 性别0男1女2其他
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.System">
<summary>
人物初始设定 => 备注: 人物初始设定
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.BgImg">
<summary>
背景图片 => 备注: 背景图片
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.Apps.T_Character.IconImg">
<summary>
角色头像是id => 备注: 角色头像是id
</summary>
</member>
<member name="T:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config">
<summary>
图片表
@ -57,5 +137,30 @@
图片url
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config.CreateAt">
<summary>
创建时间
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config.UpdateAt">
<summary>
修改时间
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config.OssPath">
<summary>
oss存放路径
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config.Bucket">
<summary>
存储桶
</summary>
</member>
<member name="P:MiaoYu.Repository.ChatAI.Admin.Entities.T_Image_Config.Region">
<summary>
地域
</summary>
</member>
</members>
</doc>

View File

@ -21,19 +21,39 @@ namespace MiaoYu.Repository.ChatAI.Admin.Migrations
entity.ToTable(tb => tb.HasComment("图片表"));
entity.Property(e => e.Bucket)
.HasMaxLength(100)
.HasComment("存储桶");
entity.Property(e => e.CreateAt)
.HasComment("创建时间")
.HasColumnType("datetime");
entity.Property(e => e.ImageId).HasComment("图片Id");
entity.Property(e => e.Name)
.HasMaxLength(50)
.HasComment("图片名称");
entity.Property(e => e.OssPath)
.HasMaxLength(200)
.HasComment("oss存放路径");
entity.Property(e => e.Region)
.HasMaxLength(100)
.HasComment("地域");
entity.Property(e => e.TenantId).HasComment("租户");
entity.Property(e => e.UpdateAt)
.HasComment("修改时间")
.HasColumnType("datetime");
entity.Property(e => e.Url)
.HasMaxLength(500)
.HasComment("图片地址");
//添加全局筛选器
//if (this.TenantInfo != null)
//{
// entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId);
//}
});
#pragma warning restore 612, 618
}
}

View File

@ -23,4 +23,5 @@ global using System.ComponentModel.DataAnnotations;
global using System.ComponentModel.DataAnnotations.Schema;
global using System.Reflection;
global using MiaoYu.Core.Logs;
global using System.Text;
global using System.Text;
global using MiaoYu.Core.EntityFramework.Models;

View File

@ -82,7 +82,11 @@ public static class RepositoryBaseExtensions
// 设置列显示名称
pagingView.SetColumnDisplayName();
var tenal = pagingView.Columns.Where(it => it.DataIndex == "tenantId").FirstOrDefault();
if (tenal != null)
{
tenal.Show = false;
}
return pagingView;
}

View File

@ -470,6 +470,11 @@
字段名称
</summary>
</member>
<member name="P:MiaoYu.Shared.Admin.Models.PagingViews.TableColumnView.DataIndex">
<summary>
字段名称
</summary>
</member>
<member name="P:MiaoYu.Shared.Admin.Models.PagingViews.TableColumnView.Title">
<summary>
标题名称

View File

@ -194,6 +194,12 @@ public class PagingView
.Where(w => w.EntityName.ToLower() == MainTableEntityType.Name.ToLower())
.FirstOrDefault();
if (table == null)
{
table = genDbTableDtos?
.Where(w => w.TableName.ToLower() == MainTableEntityType.Name.ToLower())
.FirstOrDefault();
}
if (table == null) return this;
foreach (var column in Columns)

View File

@ -11,6 +11,7 @@ public class TableColumnView
public TableColumnView(string fieldName, string title)
{
DataIndex = fieldName;
FieldName = fieldName;
Title = title;
Show = !fieldName.StartsWith("_");
@ -18,6 +19,7 @@ public class TableColumnView
public TableColumnView(string fieldName, string title, int width)
{
DataIndex = fieldName;
FieldName = fieldName;
Title = title;
Show = !fieldName.StartsWith("_");
@ -26,6 +28,7 @@ public class TableColumnView
public TableColumnView(string fieldName, string title, bool show, int width)
{
DataIndex = fieldName;
FieldName = fieldName;
Title = title;
Show = show;
@ -35,9 +38,14 @@ public class TableColumnView
/// <summary>
/// 字段名称
/// </summary>
[JsonProperty("dataIndex")]
public string FieldName { get; set; }
/// <summary>
/// 字段名称
/// </summary>
[JsonProperty("dataIndex")]
public string DataIndex { get; set; }
/// <summary>
/// 标题名称
/// </summary>