diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml index e936bdbf..3e639770 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Config/SwaggerDoc.xml @@ -181,12 +181,40 @@ - + - 查 + 分页查 + + + 单查 + + + + + + 增 + + + + + + + 更 + + + + + + + + 删 + + + + 账户管理 diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs index 0d6f5b00..1bfad73e 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/ERP/SupplierController.cs @@ -7,8 +7,8 @@ using Yi.Framework.Interface.ERP; namespace Yi.Framework.ApiMicroservice.Controllers.ERP { [ApiController] - [Route("[controller]")] - public class SupplierController:ControllerBase + [Route("api/[controller]/[action]")] + public class SupplierController : ControllerBase { private readonly ILogger _logger; private readonly ISupplierService _supplierService; @@ -19,15 +19,64 @@ namespace Yi.Framework.ApiMicroservice.Controllers.ERP } /// - /// 查 + /// 分页查 /// /// [HttpGet] - public async Task>> GetList() + public async Task PageList([FromQuery] SupplierCreateUpdateInput input, [FromQuery] PageParModel page) { - var result = await _supplierService.GetListAsync(); + var result = await _supplierService.PageListAsync(input, page); + return Result.Success().SetData(result); + } - return Result>.Success().SetData(result); + /// + /// 单查 + /// + /// + [HttpGet] + [Route("{id}")] + public async Task GetById(long id) + { + var result = await _supplierService.GetByIdAsync(id); + return Result.Success().SetData(result); + } + + /// + /// 增 + /// + /// + /// + [HttpPost] + public async Task Create(SupplierCreateUpdateInput input) + { + var result = await _supplierService.CreateAsync(input); + return Result.Success().SetData(result); + } + + /// + /// 更 + /// + /// + /// + /// + [HttpPut] + [Route("{id}")] + public async Task Update(long id, SupplierCreateUpdateInput input) + { + var result = await _supplierService.UpdateAsync(id, input); + return Result.Success().SetData(result); + } + + /// + /// 删 + /// + /// + /// + [HttpDelete] + public async Task Del(List ids) + { + await _supplierService.DeleteAsync(ids); + return Result.Success(); } } } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index ccd667bb..616040b2 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Interface/ERP/ISupplierService.cs b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/ISupplierService.cs index 8e0d9f3b..a9a62ebd 100644 --- a/Yi.Framework.Net6/Yi.Framework.Interface/ERP/ISupplierService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Interface/ERP/ISupplierService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Yi.Framework.Common.Models; using Yi.Framework.DtoModel.ERP.Supplier; using Yi.Framework.Interface.Base.Crud; @@ -10,6 +11,6 @@ namespace Yi.Framework.Interface.ERP { public interface ISupplierService : ICrudAppService { - Task> GetListAsync(); + Task>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page); } } diff --git a/Yi.Framework.Net6/Yi.Framework.Model/RABC/SeedData/DictionaryInfoSeed.cs b/Yi.Framework.Net6/Yi.Framework.Model/RABC/SeedData/DictionaryInfoSeed.cs index 330cd05b..3cd320f2 100644 --- a/Yi.Framework.Net6/Yi.Framework.Model/RABC/SeedData/DictionaryInfoSeed.cs +++ b/Yi.Framework.Net6/Yi.Framework.Model/RABC/SeedData/DictionaryInfoSeed.cs @@ -54,7 +54,7 @@ namespace Yi.Framework.Model.RABC.SeedData { Id = SnowFlakeSingle.Instance.NextId(), DictLabel = "显示", - DictValue = "0", + DictValue = "true", DictType = "sys_show_hide", OrderNum = 100, Remark = "显示菜单", @@ -66,7 +66,7 @@ namespace Yi.Framework.Model.RABC.SeedData { Id = SnowFlakeSingle.Instance.NextId(), DictLabel = "隐藏", - DictValue = "1", + DictValue = "false", DictType = "sys_show_hide", OrderNum = 99, Remark = "隐藏菜单", diff --git a/Yi.Framework.Net6/Yi.Framework.Repository/Yi.Framework.Repository.csproj b/Yi.Framework.Net6/Yi.Framework.Repository/Yi.Framework.Repository.csproj index 239ac7ef..4ba9aaad 100644 --- a/Yi.Framework.Net6/Yi.Framework.Repository/Yi.Framework.Repository.csproj +++ b/Yi.Framework.Net6/Yi.Framework.Repository/Yi.Framework.Repository.csproj @@ -6,10 +6,6 @@ disable - - - - diff --git a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs index 00f1585d..f31d825e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/Base/Crud/AbstractKeyCrudAppService.cs @@ -68,7 +68,8 @@ namespace Yi.Framework.Service.Base.Crud TryToSetTenantId(entity); - await Repository.InsertAsync(entity); + //这边需要进行判断,实体是什么guid还是雪花id + await Repository.InsertReturnSnowflakeIdAsync(entity); var entitydto = await MapToGetOutputDtoAsync(entity); return entitydto; @@ -80,7 +81,7 @@ namespace Yi.Framework.Service.Base.Crud /// /// /// - public virtual Task DeleteAsync(IEnumerable ids) + public virtual Task DeleteAsync(IEnumerable ids) { throw new NotImplementedException(); } @@ -110,7 +111,7 @@ namespace Yi.Framework.Service.Base.Crud /// /// /// - protected virtual Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto) + protected virtual Task UpdateValidAsync(TEntity idEntity, TUpdateInput dto) { return Task.CompletedTask; } diff --git a/Yi.Framework.Net6/Yi.Framework.Service/ERP/SupplierService.cs b/Yi.Framework.Net6/Yi.Framework.Service/ERP/SupplierService.cs index fbd94364..1f9cd40e 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/ERP/SupplierService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/ERP/SupplierService.cs @@ -1,9 +1,11 @@ using AutoMapper; +using SqlSugar; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Yi.Framework.Common.Models; using Yi.Framework.DtoModel.ERP.Supplier; using Yi.Framework.Interface.ERP; using Yi.Framework.Model.ERP.Entitys; @@ -17,10 +19,14 @@ namespace Yi.Framework.Service.ERP public SupplierService(IRepository repository, IMapper mapper) : base(repository, mapper) { } - - public async Task> GetListAsync() + public async Task>> PageListAsync(SupplierCreateUpdateInput input, PageParModel page) { - return await MapToGetListOutputDtosAsync(await Repository.GetListAsync()); + RefAsync totalNumber = 0; + var data = await Repository._DbQueryable + .WhereIF(input.Code is not null,u=>u.Code.Contains(input.Code)) + .WhereIF(input.Name is not null, u => u.Name.Contains(input.Name)) + .ToPageListAsync(page.PageNum, page.PageSize, totalNumber); + return new PageModel> { Total = totalNumber.Value, Data = await MapToGetListOutputDtosAsync(data) }; } } } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/SqlsugarExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/SqlsugarExtension.cs index 421b8397..f2d3ac47 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/SqlsugarExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/AspNetCoreExtensions/SqlsugarExtension.cs @@ -118,6 +118,7 @@ namespace Yi.Framework.WebCore.AspNetCoreExtensions { sb.Append($"\r\n参数:{i.ParameterName},参数值:{i.Value}"); } + sb.Append( $"\r\n 完整SQL:{UtilMethods.GetSqlString(DbType.MySql, s, p)}"); _logger?.LogInformation(sb.ToString()); } diff --git a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs index bbebf049..8b91d51b 100644 --- a/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs +++ b/Yi.Framework.Net6/Yi.Framework.WebCore/MiddlewareExtend/ErrorHandExtension.cs @@ -19,11 +19,12 @@ namespace Yi.Framework.WebCore.MiddlewareExtend public class ErrorHandExtension { private readonly RequestDelegate next; + private readonly ILogger _logger; //private readonly IErrorHandle _errorHandle; - public ErrorHandExtension(RequestDelegate next/*, IErrorHandle errorHandle*/) + public ErrorHandExtension(RequestDelegate next, ILoggerFactory loggerFactory /*, IErrorHandle errorHandle*/) { this.next = next; - //this._logger = loggerFactory.CreateLogger(); + this._logger = loggerFactory.CreateLogger(); //_errorHandle = errorHandle; } @@ -40,6 +41,7 @@ namespace Yi.Framework.WebCore.MiddlewareExtend } catch (Exception ex) { + _logger.LogError("系统错误",ex); //await _errorHandle.Invoer(context, ex); var statusCode = context.Response.StatusCode; if (ex is ArgumentException) diff --git a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue index 1990ffef..83f71ca7 100644 --- a/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue +++ b/Yi.Vue3.X.RuoYi/src/views/system/menu/index.vue @@ -258,7 +258,7 @@ {{ dict.label }} diff --git a/Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js b/Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js new file mode 100644 index 00000000..8694b055 --- /dev/null +++ b/Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js @@ -0,0 +1,45 @@ +import request from '@/utils/request' + +// 分页查询 +export function listData(query) { + return request({ + url: '/supplier/pageList', + method: 'get', + params: query + }) +} + +// id查询 +export function getData(code) { + return request({ + url: '/supplier/getById/' + code, + method: 'get' + }) +} + +// 新增 +export function addData(data) { + return request({ + url: '/supplier/create', + method: 'post', + data: data + }) +} + +// 修改 +export function updateData(id,data) { + return request({ + url: `/supplier/update/${id}`, + method: 'put', + data: data + }) +} + +// 删除 +export function delData(code) { + return request({ + url: '/supplier/del', + method: 'delete', + data:"string"==typeof(code)?[code]:code + }) +} diff --git a/Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue b/Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue new file mode 100644 index 00000000..853ced64 --- /dev/null +++ b/Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue @@ -0,0 +1,396 @@ + + + \ No newline at end of file