From 6675376241e3cf80a7d613e33499201026493160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Fri, 16 Feb 2024 17:16:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=89=8D=E5=90=8E=E7=AB=AF=E8=81=94?= =?UTF-8?q?=E8=B0=83=E4=BB=A3=E7=A0=81=E7=94=9F=E6=88=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../YiCrudAppService.cs | 2 +- .../Repositories/SqlSugarRepository.cs | 2 +- .../Dtos/Field/FieldGetListInput.cs | 2 +- .../Services/CodeGunService.cs | 4 ++- .../Services/FieldService.cs | 2 +- .../Services/TableService.cs | 8 ++++- .../DataSeeds/MenuDataSeed.cs | 32 +++++++++---------- .../YiAbpApplicationModule.cs | 3 +- .../Yi.Abp.Web/Properties/launchSettings.json | 3 +- .../webfirstApi.js => code/codeGunApi.js} | 6 ++-- .../src/api/{webfirst => code}/fieldApi.js | 1 + .../src/api/{webfirst => code}/tableApi.js | 0 .../src/api/{webfirst => code}/templateApi.js | 0 .../views/code/field/components/FieldList.vue | 5 +-- .../src/views/code/field/hooks/useTable.js | 2 +- Yi.RuoYi.Vue3/src/views/code/table/index.vue | 18 +++++------ .../src/views/code/template/index.vue | 16 +++++----- Yi.RuoYi.Vue3/src/views/index.vue | 2 +- .../src/views/system/tenant/index.vue | 2 +- Yi.RuoYi.Vue3/src/views/template.txt | 2 +- 20 files changed, 62 insertions(+), 50 deletions(-) rename Yi.RuoYi.Vue3/src/api/{webfirst/webfirstApi.js => code/codeGunApi.js} (72%) rename Yi.RuoYi.Vue3/src/api/{webfirst => code}/fieldApi.js (97%) rename Yi.RuoYi.Vue3/src/api/{webfirst => code}/tableApi.js (100%) rename Yi.RuoYi.Vue3/src/api/{webfirst => code}/templateApi.js (100%) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs index 874d89d4..d9a8e346 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.Ddd.Application/YiCrudAppService.cs @@ -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(total, output); //throw new NotImplementedException($"【{typeof(TEntity)}】实体的CrudAppService,查询为具体业务,通用查询几乎无实际场景,请重写实现!"); diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs index c94cc338..6e47740f 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/Repositories/SqlSugarRepository.cs @@ -139,7 +139,7 @@ namespace Yi.Framework.SqlSugarCore.Repositories public virtual async Task GetCountAsync(CancellationToken cancellationToken = default) { - return await this.CountAsync(); + return await this.CountAsync(_=>true); } public virtual async Task> GetPagedListAsync(int skipCount, int maxResultCount, string sorting, bool includeDetails = false, CancellationToken cancellationToken = default) diff --git a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application.Contracts/Dtos/Field/FieldGetListInput.cs b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application.Contracts/Dtos/Field/FieldGetListInput.cs index 516dbac1..028213c6 100644 --- a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application.Contracts/Dtos/Field/FieldGetListInput.cs +++ b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application.Contracts/Dtos/Field/FieldGetListInput.cs @@ -9,6 +9,6 @@ namespace Yi.Framework.CodeGun.Application.Contracts.Dtos.Field /// public string? Name { get; set; } - public long? TableId { get; set; } + public Guid? TableId { get; set; } } } diff --git a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/CodeGunService.cs b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/CodeGunService.cs index 809750ea..e126e49d 100644 --- a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/CodeGunService.cs +++ b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/CodeGunService.cs @@ -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 /// 打开目录 /// /// - public async Task PostDir(string path) + [HttpPost("code-gun/dir/{**path}")] + public async Task PostDir([FromRoute]string path) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { diff --git a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/FieldService.cs b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/FieldService.cs index a6560d7b..1af58e90 100644 --- a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/FieldService.cs +++ b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/FieldService.cs @@ -45,7 +45,7 @@ namespace Yi.Framework.CodeGun.Application.Services /// 获取类型枚举 /// /// - [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(); diff --git a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/TableService.cs b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/TableService.cs index 446e05c7..f2129fe4 100644 --- a/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/TableService.cs +++ b/Yi.Abp.Net8/module/code-gun/Yi.Framework.CodeGun.Application/Services/TableService.cs @@ -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 repository) : base(repository) { } + + public override Task> GetListAsync(TableGetListInput input) + { + return base.GetListAsync(input); + } } } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/MenuDataSeed.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/MenuDataSeed.cs index 8e4baa4d..8c19cbcf 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/MenuDataSeed.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/MenuDataSeed.cs @@ -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, diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs index 652d1dac..7dc62e4c 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs @@ -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) )] diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json index d344cba8..44097413 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json @@ -5,7 +5,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + //"ASPNETCORE_ENVIRONMENT": "Staging" }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:19001" diff --git a/Yi.RuoYi.Vue3/src/api/webfirst/webfirstApi.js b/Yi.RuoYi.Vue3/src/api/code/codeGunApi.js similarity index 72% rename from Yi.RuoYi.Vue3/src/api/webfirst/webfirstApi.js rename to Yi.RuoYi.Vue3/src/api/code/codeGunApi.js index b982293b..4eb673c9 100644 --- a/Yi.RuoYi.Vue3/src/api/webfirst/webfirstApi.js +++ b/Yi.RuoYi.Vue3/src/api/code/codeGunApi.js @@ -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' }) } diff --git a/Yi.RuoYi.Vue3/src/api/webfirst/fieldApi.js b/Yi.RuoYi.Vue3/src/api/code/fieldApi.js similarity index 97% rename from Yi.RuoYi.Vue3/src/api/webfirst/fieldApi.js rename to Yi.RuoYi.Vue3/src/api/code/fieldApi.js index 95fe66fa..4f2e4531 100644 --- a/Yi.RuoYi.Vue3/src/api/webfirst/fieldApi.js +++ b/Yi.RuoYi.Vue3/src/api/code/fieldApi.js @@ -50,5 +50,6 @@ export function delData(ids) { return request({ url: `/field/${ids}`, method: 'delete', + params:{id:ids} }) } diff --git a/Yi.RuoYi.Vue3/src/api/webfirst/tableApi.js b/Yi.RuoYi.Vue3/src/api/code/tableApi.js similarity index 100% rename from Yi.RuoYi.Vue3/src/api/webfirst/tableApi.js rename to Yi.RuoYi.Vue3/src/api/code/tableApi.js diff --git a/Yi.RuoYi.Vue3/src/api/webfirst/templateApi.js b/Yi.RuoYi.Vue3/src/api/code/templateApi.js similarity index 100% rename from Yi.RuoYi.Vue3/src/api/webfirst/templateApi.js rename to Yi.RuoYi.Vue3/src/api/code/templateApi.js diff --git a/Yi.RuoYi.Vue3/src/views/code/field/components/FieldList.vue b/Yi.RuoYi.Vue3/src/views/code/field/components/FieldList.vue index 1e8536bb..59f3ee59 100644 --- a/Yi.RuoYi.Vue3/src/views/code/field/components/FieldList.vue +++ b/Yi.RuoYi.Vue3/src/views/code/field/components/FieldList.vue @@ -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( diff --git a/Yi.RuoYi.Vue3/src/views/code/field/hooks/useTable.js b/Yi.RuoYi.Vue3/src/views/code/field/hooks/useTable.js index e1a07005..5e81ab05 100644 --- a/Yi.RuoYi.Vue3/src/views/code/field/hooks/useTable.js +++ b/Yi.RuoYi.Vue3/src/views/code/field/hooks/useTable.js @@ -1,4 +1,4 @@ -import {listData} from "@/api/webfirst/tableApi.js" +import {listData} from "@/api/code/tableApi.js" const useTable=()=>{ const dataList=ref([]); diff --git a/Yi.RuoYi.Vue3/src/views/code/table/index.vue b/Yi.RuoYi.Vue3/src/views/code/table/index.vue index f5581ada..eee081f4 100644 --- a/Yi.RuoYi.Vue3/src/views/code/table/index.vue +++ b/Yi.RuoYi.Vue3/src/views/code/table/index.vue @@ -61,7 +61,7 @@ plain icon="Plus" @click="handleAdd" - v-hasPermi="['webfirst:table:add']" + v-hasPermi="['codeGun:table:add']" >新增 @@ -72,7 +72,7 @@ icon="Edit" :disabled="single" @click="handleUpdate" - v-hasPermi="['webfirst:table:edit']" + v-hasPermi="['codeGun:table:edit']" >修改 @@ -83,7 +83,7 @@ icon="Delete" :disabled="multiple" @click="handleDelete" - v-hasPermi="['webfirst:table:remove']" + v-hasPermi="['codeGun:table:remove']" >删除 @@ -93,7 +93,7 @@ plain icon="Download" @click="handleExport" - v-hasPermi="['webfirst:table:export']" + v-hasPermi="['codeGun:table:export']" >导出 @@ -104,7 +104,7 @@ plain icon="Switch" @click="handleExport" - v-hasPermi="['webfirst:table:export']" + v-hasPermi="['codeGun:table:export']" >同步数据库WebToDb --> @@ -115,7 +115,7 @@ icon="Switch" @click="handleWebToCode" :disabled="ids.length==0" - v-hasPermi="['webfirst:table:export']" + v-hasPermi="['codeGun:table:export']" >代码生成WebToCode @@ -126,7 +126,7 @@ plain icon="Switch" @click="handleCodeToWeb" - v-hasPermi="['webfirst:table:export']" + v-hasPermi="['codeGun:table:export']" >实体同步CodeToWeb @@ -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"); diff --git a/Yi.RuoYi.Vue3/src/views/code/template/index.vue b/Yi.RuoYi.Vue3/src/views/code/template/index.vue index 83e08ea3..5ac3fbf8 100644 --- a/Yi.RuoYi.Vue3/src/views/code/template/index.vue +++ b/Yi.RuoYi.Vue3/src/views/code/template/index.vue @@ -46,7 +46,7 @@ plain icon="Plus" @click="handleAdd" - v-hasPermi="['webfirst:template:add']" + v-hasPermi="['codeGun:template:add']" >新增 @@ -57,7 +57,7 @@ icon="Edit" :disabled="single" @click="handleUpdate" - v-hasPermi="['webfirst:template:edit']" + v-hasPermi="['codeGun:template:edit']" >修改 @@ -68,7 +68,7 @@ icon="Delete" :disabled="multiple" @click="handleDelete" - v-hasPermi="['webfirst:template:remove']" + v-hasPermi="['codeGun:template:remove']" >删除 @@ -78,7 +78,7 @@ plain icon="Download" @click="handleExport" - v-hasPermi="['webfirst:template:export']" + v-hasPermi="['codeGun:template:export']" >导出 @@ -145,14 +145,14 @@ type="text" icon="Edit" @click="handleUpdate(scope.row)" - v-hasPermi="['webfirst:template:edit']" + v-hasPermi="['codeGun:template:edit']" >修改 删除 @@ -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' diff --git a/Yi.RuoYi.Vue3/src/views/index.vue b/Yi.RuoYi.Vue3/src/views/index.vue index 7af5c387..33512a73 100644 --- a/Yi.RuoYi.Vue3/src/views/index.vue +++ b/Yi.RuoYi.Vue3/src/views/index.vue @@ -78,7 +78,7 @@

后端技术

  • .Net6
  • -
  • WebFirst
  • +
  • CodeFirst
  • JWT
  • Sqlsugar
  • Redis
  • diff --git a/Yi.RuoYi.Vue3/src/views/system/tenant/index.vue b/Yi.RuoYi.Vue3/src/views/system/tenant/index.vue index 72c22717..462f3f22 100644 --- a/Yi.RuoYi.Vue3/src/views/system/tenant/index.vue +++ b/Yi.RuoYi.Vue3/src/views/system/tenant/index.vue @@ -6,7 +6,7 @@ 该文件为通用Crud模板文件,按照规范只需要 替换以下变量即可, 租户 : 实体中文名称 system:tenant :crud权限编码 -system/tenant : api文件路径,例如:webfirst/tableApi +system/tenant : api文件路径,例如:codeGun/tableApi --> diff --git a/Yi.RuoYi.Vue3/src/views/template.txt b/Yi.RuoYi.Vue3/src/views/template.txt index 358399fc..c8cc8db0 100644 --- a/Yi.RuoYi.Vue3/src/views/template.txt +++ b/Yi.RuoYi.Vue3/src/views/template.txt @@ -6,7 +6,7 @@ 该文件为通用Crud模板文件,按照规范只需要 替换以下变量即可, @Name@ : 实体中文名称 @per:per@ :crud权限编码 -@api@ : api文件路径,例如:webfirst/tableApi +@api@ : api文件路径,code/tableApi -->