feat: 前后端联调代码生成接口
This commit is contained in:
@@ -76,7 +76,7 @@ namespace Yi.Framework.Ddd.Application
|
||||
{
|
||||
entites = await Repository.GetListAsync();
|
||||
}
|
||||
var total = await Repository.CountAsync();
|
||||
var total = await Repository.GetCountAsync();
|
||||
var output = await MapToGetListOutputDtosAsync(entites);
|
||||
return new PagedResultDto<TGetListOutputDto>(total, output);
|
||||
//throw new NotImplementedException($"【{typeof(TEntity)}】实体的CrudAppService,查询为具体业务,通用查询几乎无实际场景,请重写实现!");
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Yi.Framework.SqlSugarCore.Repositories
|
||||
|
||||
public virtual async Task<long> GetCountAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
return await this.CountAsync();
|
||||
return await this.CountAsync(_=>true);
|
||||
}
|
||||
|
||||
public virtual async Task<List<TEntity>> GetPagedListAsync(int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default)
|
||||
|
||||
@@ -9,6 +9,6 @@ namespace Yi.Framework.CodeGun.Application.Contracts.Dtos.Field
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
public long? TableId { get; set; }
|
||||
public Guid? TableId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Volo.Abp.Application.Services;
|
||||
using Volo.Abp.Uow;
|
||||
using Yi.Framework.CodeGun.Application.Contracts.IServices;
|
||||
@@ -79,7 +80,8 @@ namespace Yi.Framework.CodeGun.Application.Services
|
||||
/// 打开目录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task PostDir(string path)
|
||||
[HttpPost("code-gun/dir/{**path}")]
|
||||
public async Task PostDir([FromRoute]string path)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Yi.Framework.CodeGun.Application.Services
|
||||
/// 获取类型枚举
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Route("type")]
|
||||
[Route("field/type")]
|
||||
public object GetFieldTypeEnum()
|
||||
{
|
||||
return typeof(FieldTypeEnum).GetFields(BindingFlags.Static | BindingFlags.Public).Select(x => new { lable = x.Name, value = (int)Enum.Parse(typeof(FieldTypeEnum), x.Name) }).ToList();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Volo.Abp.Application.Dtos;
|
||||
using Volo.Abp.Domain.Repositories;
|
||||
using Yi.Framework.CodeGun.Application.Contracts.Dtos.Table;
|
||||
using Yi.Framework.CodeGun.Application.Contracts.IServices;
|
||||
using Yi.Framework.CodeGun.Domain.Entities;
|
||||
@@ -11,5 +12,10 @@ namespace Yi.Framework.CodeGun.Application.Services
|
||||
public TableService(IRepository<TableAggregateRoot, Guid> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override Task<PagedResultDto<TableDto>> GetListAsync(TableGetListInput input)
|
||||
{
|
||||
return base.GetListAsync(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,31 +42,31 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
};
|
||||
entities.Add(system);
|
||||
|
||||
//WebFirst
|
||||
MenuEntity webfirst = new MenuEntity(_guidGenerator.Create(), Guid.Empty)
|
||||
//代码生成
|
||||
MenuEntity code = new MenuEntity(_guidGenerator.Create(), Guid.Empty)
|
||||
{
|
||||
MenuName = "WebFirst",
|
||||
MenuName = "代码生成",
|
||||
MenuType = MenuTypeEnum.Catalogue,
|
||||
Router = "/webfirst",
|
||||
Router = "/code",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
MenuIcon = "build",
|
||||
OrderNum = 91,
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(webfirst);
|
||||
entities.Add(code);
|
||||
|
||||
//数据表管理
|
||||
MenuEntity table = new MenuEntity(_guidGenerator.Create(), webfirst.Id)
|
||||
MenuEntity table = new MenuEntity(_guidGenerator.Create(), code.Id)
|
||||
{
|
||||
MenuName = "数据表管理",
|
||||
PermissionCode = "webfirst:table:list",
|
||||
PermissionCode = "code:table:list",
|
||||
MenuType = MenuTypeEnum.Menu,
|
||||
Router = "table",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
IsCache = true,
|
||||
Component = "webfirst/table/index",
|
||||
Component = "code/table/index",
|
||||
MenuIcon = "online",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
@@ -74,35 +74,35 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
entities.Add(table);
|
||||
|
||||
//字段管理
|
||||
MenuEntity field = new MenuEntity(_guidGenerator.Create(), webfirst.Id)
|
||||
MenuEntity field = new MenuEntity(_guidGenerator.Create(), code.Id)
|
||||
{
|
||||
MenuName = "字段管理",
|
||||
PermissionCode = "webfirst:field:list",
|
||||
PermissionCode = "code:field:list",
|
||||
MenuType = MenuTypeEnum.Menu,
|
||||
Router = "field",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
IsCache = true,
|
||||
Component = "webfirst/field/index",
|
||||
Component = "code/field/index",
|
||||
MenuIcon = "number",
|
||||
OrderNum = 99,
|
||||
ParentId = webfirst.Id,
|
||||
ParentId = code.Id,
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(field);
|
||||
|
||||
|
||||
//模板管理
|
||||
MenuEntity template = new MenuEntity(_guidGenerator.Create(), webfirst.Id)
|
||||
MenuEntity template = new MenuEntity(_guidGenerator.Create(), code.Id)
|
||||
{
|
||||
MenuName = "模板管理",
|
||||
PermissionCode = "webfirst:template:list",
|
||||
PermissionCode = "code:template:list",
|
||||
MenuType = MenuTypeEnum.Menu,
|
||||
Router = "template",
|
||||
IsShow = true,
|
||||
IsLink = false,
|
||||
IsCache = true,
|
||||
Component = "webfirst/template/index",
|
||||
Component = "code/template/index",
|
||||
MenuIcon = "documentation",
|
||||
OrderNum = 98,
|
||||
IsDeleted = false
|
||||
@@ -230,7 +230,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds
|
||||
//ERP
|
||||
MenuEntity erp = new MenuEntity(_guidGenerator.Create())
|
||||
{
|
||||
MenuName = "ERP",
|
||||
MenuName = "ERP(待更新)",
|
||||
MenuType = MenuTypeEnum.Catalogue,
|
||||
Router = "/erp",
|
||||
IsShow = true,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Yi.Abp.Application.Contracts;
|
||||
using Yi.Abp.Domain;
|
||||
using Yi.Framework.Bbs.Application;
|
||||
using Yi.Framework.CodeGun.Application;
|
||||
using Yi.Framework.Ddd.Application;
|
||||
using Yi.Framework.Rbac.Application;
|
||||
using Yi.Framework.TenantManagement.Application;
|
||||
@@ -16,7 +17,7 @@ namespace Yi.Abp.Application
|
||||
typeof(YiFrameworkRbacApplicationModule),
|
||||
typeof(YiFrameworkBbsApplicationModule),
|
||||
typeof(YiFrameworkTenantManagementApplicationModule),
|
||||
|
||||
typeof(YiFrameworkCodeGunApplicationModule),
|
||||
|
||||
typeof(YiFrameworkDddApplicationModule)
|
||||
)]
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
//"ASPNETCORE_ENVIRONMENT": "Staging"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:19001"
|
||||
|
||||
@@ -2,14 +2,14 @@ import request from '@/utils/request'
|
||||
// code to web
|
||||
export function codeToWeb() {
|
||||
return request({
|
||||
url: 'web-first/code-build-web',
|
||||
url: 'code-gun/code-build-web',
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
// code to web
|
||||
export function webToCode(ids) {
|
||||
return request({
|
||||
url: 'web-first/web-build-code',
|
||||
url: 'code-gun/web-build-code',
|
||||
method: 'post',
|
||||
data:ids
|
||||
})
|
||||
@@ -18,7 +18,7 @@ export function webToCode(ids) {
|
||||
// open zhe path
|
||||
export function openPath(path) {
|
||||
return request({
|
||||
url: `web-first/dir/${encodeURIComponent(path)}`,
|
||||
url: `code-gun/dir/${encodeURIComponent(path)}`,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
@@ -50,5 +50,6 @@ export function delData(ids) {
|
||||
return request({
|
||||
url: `/field/${ids}`,
|
||||
method: 'delete',
|
||||
params:{id:ids}
|
||||
})
|
||||
}
|
||||
@@ -224,7 +224,7 @@ import {
|
||||
updateData,
|
||||
delData,
|
||||
getType
|
||||
} from "@/api/webfirst/fieldApi";
|
||||
} from "@/api/code/fieldApi";
|
||||
import { computed, onMounted, defineProps, ref } from "vue";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
@@ -267,7 +267,8 @@ const data = reactive({
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const getFieldTypeEnum=(field)=>{
|
||||
return fieldList.value.filter(x=>x.value==field)[0].lable;
|
||||
return field;
|
||||
// return fieldList.value.filter(x=>x.value==field)[0]?.lable??'未知';
|
||||
}
|
||||
|
||||
watch(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {listData} from "@/api/webfirst/tableApi.js"
|
||||
import {listData} from "@/api/code/tableApi.js"
|
||||
|
||||
const useTable=()=>{
|
||||
const dataList=ref([]);
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['webfirst:table:add']"
|
||||
v-hasPermi="['codeGun:table:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -72,7 +72,7 @@
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['webfirst:table:edit']"
|
||||
v-hasPermi="['codeGun:table:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -83,7 +83,7 @@
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['webfirst:table:remove']"
|
||||
v-hasPermi="['codeGun:table:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -93,7 +93,7 @@
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['webfirst:table:export']"
|
||||
v-hasPermi="['codeGun:table:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -104,7 +104,7 @@
|
||||
plain
|
||||
icon="Switch"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['webfirst:table:export']"
|
||||
v-hasPermi="['codeGun:table:export']"
|
||||
>同步数据库WebToDb</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
@@ -115,7 +115,7 @@
|
||||
icon="Switch"
|
||||
@click="handleWebToCode"
|
||||
:disabled="ids.length==0"
|
||||
v-hasPermi="['webfirst:table:export']"
|
||||
v-hasPermi="['codeGun:table:export']"
|
||||
>代码生成WebToCode</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -126,7 +126,7 @@
|
||||
plain
|
||||
icon="Switch"
|
||||
@click="handleCodeToWeb"
|
||||
v-hasPermi="['webfirst:table:export']"
|
||||
v-hasPermi="['codeGun:table:export']"
|
||||
>实体同步CodeToWeb</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -242,8 +242,8 @@ import {
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/webfirst/tableApi";
|
||||
import { codeToWeb,webToCode } from "@/api/webfirst/webfirstApi";
|
||||
} from "@/api/code/tableApi";
|
||||
import { codeToWeb,webToCode } from "@/api/code/codeGunApi";
|
||||
const { proxy } = getCurrentInstance();
|
||||
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['webfirst:template:add']"
|
||||
v-hasPermi="['codeGun:template:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -57,7 +57,7 @@
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['webfirst:template:edit']"
|
||||
v-hasPermi="['codeGun:template:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -68,7 +68,7 @@
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['webfirst:template:remove']"
|
||||
v-hasPermi="['codeGun:template:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -78,7 +78,7 @@
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['webfirst:template:export']"
|
||||
v-hasPermi="['codeGun:template:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col>
|
||||
@@ -145,14 +145,14 @@
|
||||
type="text"
|
||||
icon="Edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['webfirst:template:edit']"
|
||||
v-hasPermi="['codeGun:template:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
icon="Delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['webfirst:template:remove']"
|
||||
v-hasPermi="['codeGun:template:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
@@ -231,8 +231,8 @@ import {
|
||||
delData,
|
||||
addData,
|
||||
updateData,
|
||||
} from "@/api/webfirst/templateApi";
|
||||
import {openPath} from "@/api/webfirst/webfirstApi";
|
||||
} from "@/api/code/templateApi";
|
||||
import {openPath} from "@/api/code/codeGunApi";
|
||||
import { ref } from "@vue/reactivity";
|
||||
import ReplaceText from './components/ReplaceText'
|
||||
import TempalteTip from './components/TempalteTip.vue'
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
<h4>后端技术</h4>
|
||||
<ul>
|
||||
<li>.Net6</li>
|
||||
<li>WebFirst</li>
|
||||
<li>CodeFirst</li>
|
||||
<li>JWT</li>
|
||||
<li>Sqlsugar</li>
|
||||
<li>Redis</li>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
该文件为通用Crud模板文件,按照规范只需要 替换以下变量即可,
|
||||
租户 : 实体中文名称
|
||||
system:tenant :crud权限编码
|
||||
system/tenant : api文件路径,例如:webfirst/tableApi
|
||||
system/tenant : api文件路径,例如:codeGun/tableApi
|
||||
</div> -->
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="租户名称" prop="name">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
该文件为通用Crud模板文件,按照规范只需要 替换以下变量即可,
|
||||
@Name@ : 实体中文名称
|
||||
@per:per@ :crud权限编码
|
||||
@api@ : api文件路径,例如:webfirst/tableApi
|
||||
@api@ : api文件路径,code/tableApi
|
||||
</div> -->
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
|
||||
<el-form-item label="@Name@名称" prop="name">
|
||||
|
||||
Reference in New Issue
Block a user