From dba67d71277d190d1d82cdab677b5e871a21d61f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com>
Date: Mon, 2 Jan 2023 23:32:40 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BE=9B=E5=BA=94=E5=95=86?=
=?UTF-8?q?=E5=AE=9A=E4=B9=89=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Config/SwaggerDoc.xml | 32 +-
.../Controllers/ERP/SupplierController.cs | 61 ++-
.../yi-sqlsugar-dev.db | Bin 307200 -> 307200 bytes
.../ERP/ISupplierService.cs | 3 +-
.../RABC/SeedData/DictionaryInfoSeed.cs | 4 +-
.../Yi.Framework.Repository.csproj | 4 -
.../Base/Crud/AbstractKeyCrudAppService.cs | 7 +-
.../ERP/SupplierService.cs | 12 +-
.../AspNetCoreExtensions/SqlsugarExtension.cs | 1 +
.../MiddlewareExtend/ErrorHandExtension.cs | 6 +-
.../src/views/system/menu/index.vue | 2 +-
Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js | 45 ++
.../src/views/ERP/supplier/index.vue | 396 ++++++++++++++++++
13 files changed, 549 insertions(+), 24 deletions(-)
create mode 100644 Yi.Vue3.x.RuoYi/src/api/erp/supplierApi.js
create mode 100644 Yi.Vue3.x.RuoYi/src/views/ERP/supplier/index.vue
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 ccd667bb1fd1ab2b8c760873cf74e795d59f2584..616040b2de43658f59db95d2ab445ee6f45ee0a2 100644
GIT binary patch
delta 1572
zcma)6TTC2P7(TPJJG-;D8K}#OfV3nHU}5&mnaj?OTI~`wqEb_1(Fc^d*HxJimA
zY1Tin<06=97++~G@(zP?Dh!w_OgB?Xg}s+j#lJzy-EC#5>QWy70%*{`yMI8xx#6!t
z5DE2=uZL(qLMkt)D8$J~4nkS!%)Y;}KDT^(VkR@5NG)u9Ww!zVg8H}jeENI$A9lZC
zGx+=_-$~4O_^$`+3-|<)3k9JdLb>D4hm*IH6DHqLlBEvnWA`3Np}$vKN#q&P?PC!<
zp37s5cf9$d59Y%xK<0Sojz=sk;LRdAy!bf_pjn(fGJ*dD%p&oP9~WG{h%Dox-Yh15
z+Q68)w^w_K^lGm~ynO5eU>2FzyldWRZvb5IeC&DJopqmfSGhiOJ@35hoOUYo4Z4G-
z92Xr&?Z4Yc><>{_sSe6!o3e@4@2ziHE6IywljToK(h?%RBu)?>y@+k9icmgkp944y
zlO3SC(&3;9>{Ui6L;GLB^4r0Qe-G0r1cF&2K(BEwEn)fo
zOzVrpVr{S1=#P(&0+x0q?U1an(k}WsHt!clyfwJ10pC^w`4xHU
z*o(Wh5wG&{o-0vB0tW>c5+!kWJCVU?D;}qvIz$I3bH=iYoP^*hF;+5uiUq%}oXadv
zXA)=D7tXIwp1~M3HXM!iXpup+M~e+@t?M3DK^6J@)k&Y?E0o|(iT_mi-xB$aM?n>e
z9Ntb|4hhjnf3ydioo}`in-$n90$N{Z+z(WWX4HklMWRllj`Iit<
zg`g_&IGQ5lA+H4rF-Ed>gpBSm2!Aq%w?dMHkj52)j06^dpejNRDFV+c(uw+Q(2*@0
z5;&OdhtJ}tGTZaR^Gf{C40^1y8bd3&mb;i0gpI*(RXV+6_v$Hdqx%q5jF+09sUIJ2n
zw-NA25GC0>(USuMTt|OzlO<1AQC-qJd+82-VPd0QLzpg`Udqg*_RwYPa6gbZ_x&A%pW}n`zNrDUv3^Hu%
z82GpHXYot&9p@|EEcC&EZL)$u&gOOBjqV?X6bK^;<
{
- 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