diff --git a/ARW.CodeGenerator/CodeGenerateTemplate.cs b/ARW.CodeGenerator/CodeGenerateTemplate.cs
index 319ebf6..98376f6 100644
--- a/ARW.CodeGenerator/CodeGenerateTemplate.cs
+++ b/ARW.CodeGenerator/CodeGenerateTemplate.cs
@@ -15,37 +15,37 @@ namespace ARW.CodeGenerator
{
if (queryType.Equals("EQ"))
{
- return $"it => it.{ propertyName} == parm.{propertyName})";
+ return $"s => s.{ propertyName} == parm.{propertyName})";
}
if (queryType.Equals("LIKE"))
{
- return $"it => it.{propertyName}.Contains(parm.{propertyName}))";
+ return $"s => s.{propertyName}.Contains(parm.{propertyName}))";
}
if (queryType.Equals("GTE"))
{
- return $"it => it.{ propertyName} >= parm.{propertyName})";
+ return $"s => s.{ propertyName} >= parm.{propertyName})";
}
if (queryType.Equals("GT"))
{
- return $"it => it.{ propertyName} > parm.{propertyName})";
+ return $"s => s.{ propertyName} > parm.{propertyName})";
}
if (queryType.Equals("LT"))
{
- return $"it => it.{ propertyName} < parm.{propertyName})";
+ return $"s => s.{ propertyName} < parm.{propertyName})";
}
if (queryType.Equals("LTE"))
{
- return $"it => it.{ propertyName} <= parm.{propertyName})";
+ return $"s => s.{ propertyName} <= parm.{propertyName})";
}
if (queryType.Equals("NE"))
{
- return $"it => it.{ propertyName} != parm.{propertyName})";
+ return $"s => s.{ propertyName} != parm.{propertyName})";
}
if (queryType.Equals("ARWKE"))
{
- return $"it => it.{ propertyName}.Contains(parm.{propertyName}))";
+ return $"s => s.{ propertyName}.Contains(parm.{propertyName}))";
}
- return $"it => it.{ propertyName} == parm.{propertyName})";
+ return $"s => s.{ propertyName} == parm.{propertyName})";
}
}
diff --git a/ARW.Model/Dto/Business/ShopManager/ShopAddresss/ShopAddressDto.cs b/ARW.Model/Dto/Business/ShopManager/ShopAddresss/ShopAddressDto.cs
new file mode 100644
index 0000000..704b642
--- /dev/null
+++ b/ARW.Model/Dto/Business/ShopManager/ShopAddresss/ShopAddressDto.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.ShopManager.ShopAddresss;
+using Infrastructure;
+
+namespace ARW.Model.Dto.Business.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址输入对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ public class ShopAddressDto
+ {
+
+ public int ShopAddressId { get; set; }
+
+ public long ShopAddressGuid { get; set; }
+
+ public long ShopGuid { get; set; }
+
+
+ [Required(ErrorMessage = "地址类型不能为空")]
+ public int ShopAddressType { get; set; }
+
+ [Required(ErrorMessage = "省id不能为空")]
+ public int ProvinceId { get; set; }
+
+ [Required(ErrorMessage = "市id不能为空")]
+ public int CityId { get; set; }
+
+ [Required(ErrorMessage = "区id不能为空")]
+ public int DistrictId { get; set; }
+
+ [Required(ErrorMessage = "联系人姓名不能为空")]
+ public string ShopAddressContactName { get; set; }
+
+ [Required(ErrorMessage = "联系电话不能为空")]
+ public string ShopAddressContactNumber { get; set; }
+
+ [Required(ErrorMessage = "详细地址不能为空")]
+ public string ShopAddressDetailedAddress { get; set; }
+
+ [Required(ErrorMessage = "排序不能为空")]
+ public int ShopAddressSort { get; set; }
+
+
+
+
+
+ }
+
+
+ ///
+ /// 店铺地址查询对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ public class ShopAddressQueryDto : PagerInfo
+ {
+ public long ShopGuid { get; set; }
+ public int? ShopAddressType { get; set; }
+
+ public string ids { get; set; }
+ }
+
+
+
+
+}
diff --git a/ARW.Model/Models/Business/ShopManager/ShopAddresss/ShopAddress.cs b/ARW.Model/Models/Business/ShopManager/ShopAddresss/ShopAddress.cs
new file mode 100644
index 0000000..047c280
--- /dev/null
+++ b/ARW.Model/Models/Business/ShopManager/ShopAddresss/ShopAddress.cs
@@ -0,0 +1,122 @@
+using System;
+using System.Collections.Generic;
+using SqlSugar;
+using OfficeOpenXml.Attributes;
+using Newtonsoft.Json;
+
+namespace ARW.Model.Models.Business.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址,数据实体对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ [SugarTable("tb_shop_address")]
+ public class ShopAddress : BusinessBase
+ {
+
+ ///
+ /// 描述 :
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "ShopAddressId")]
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "shop_address_id")]
+ public int ShopAddressId { get; set; }
+
+
+ ///
+ /// 描述 :
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "ShopAddressGuid")]
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(IsPrimaryKey = true, ColumnName = "shop_address_guid")]
+ public long ShopAddressGuid { get; set; }
+
+ ///
+ /// 描述 : 店铺guid
+ /// 空值 : false
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [SugarColumn(ColumnName = "shop_guid")]
+ public long ShopGuid { get; set; }
+
+ ///
+ /// 描述 :地址类型
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "地址类型")]
+ [SugarColumn(ColumnName = "shop_address_type")]
+ public int ShopAddressType { get; set; }
+
+
+ ///
+ /// 描述 :省id
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "省id")]
+ [SugarColumn(ColumnName = "province_id")]
+ public int ProvinceId { get; set; }
+
+
+ ///
+ /// 描述 :市id
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "市id")]
+ [SugarColumn(ColumnName = "city_id")]
+ public int CityId { get; set; }
+
+
+ ///
+ /// 描述 :区id
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "区id")]
+ [SugarColumn(ColumnName = "district_id")]
+ public int DistrictId { get; set; }
+
+
+ ///
+ /// 描述 :联系人姓名
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "联系人姓名")]
+ [SugarColumn(ColumnName = "shop_address_contact_name")]
+ public string ShopAddressContactName { get; set; }
+
+
+ ///
+ /// 描述 :联系电话
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "联系电话")]
+ [SugarColumn(ColumnName = "shop_address_contact_number")]
+ public string ShopAddressContactNumber { get; set; }
+
+
+ ///
+ /// 描述 :详细地址
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "详细地址")]
+ [SugarColumn(ColumnName = "shop_address_detailed_address")]
+ public string ShopAddressDetailedAddress { get; set; }
+
+
+ ///
+ /// 描述 :排序
+ /// 空值 : false
+ ///
+ [EpplusTableColumn(Header = "排序")]
+ [SugarColumn(ColumnName = "shop_address_sort")]
+ public int ShopAddressSort { get; set; }
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/ARW.Model/Vo/Business/ShopManager/ShopAddresss/ShopAddressVo.cs b/ARW.Model/Vo/Business/ShopManager/ShopAddresss/ShopAddressVo.cs
new file mode 100644
index 0000000..0257fee
--- /dev/null
+++ b/ARW.Model/Vo/Business/ShopManager/ShopAddresss/ShopAddressVo.cs
@@ -0,0 +1,120 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Business.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址展示对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ public class ShopAddressVo
+ {
+
+
+ ///
+ /// 描述 :
+ ///
+ [EpplusIgnore]
+ public int ShopAddressId { get; set; }
+
+
+ ///
+ /// 描述 :
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusIgnore]
+ public long ShopAddressGuid { get; set; }
+
+
+ ///
+ /// 描述 : 店铺guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusIgnore]
+ public long ShopGuid { get; set; }
+
+
+ ///
+ /// 描述 :店铺名称
+ ///
+ [EpplusTableColumn(Header = "店铺")]
+ public string ShopName { get; set; }
+
+ ///
+ /// 描述 :地址类型
+ ///
+ [EpplusIgnore]
+ public int ShopAddressType { get; set; }
+
+
+ ///
+ /// 描述 :地址类型名称
+ ///
+ [EpplusTableColumn(Header = "地址类型")]
+ public string ShopAddressTypeName { get; set; }
+
+
+ ///
+ /// 描述 :省id
+ ///
+ [EpplusIgnore]
+ public int ProvinceId { get; set; }
+
+
+ ///
+ /// 描述 :市id
+ ///
+ [EpplusIgnore]
+ public int CityId { get; set; }
+
+
+ ///
+ /// 描述 :区id
+ ///
+ [EpplusIgnore]
+ public int DistrictId { get; set; }
+
+
+ ///
+ /// 描述 :所在地区
+ ///
+ [EpplusTableColumn(Header = "所在地区")]
+ public string AddressName { get; set; }
+
+
+ ///
+ /// 描述 :联系人姓名
+ ///
+ [EpplusTableColumn(Header = "联系人姓名")]
+ public string ShopAddressContactName { get; set; }
+
+
+ ///
+ /// 描述 :联系电话
+ ///
+ [EpplusTableColumn(Header = "联系电话")]
+ public string ShopAddressContactNumber { get; set; }
+
+
+ ///
+ /// 描述 :详细地址
+ ///
+ [EpplusTableColumn(Header = "详细地址")]
+ public string ShopAddressDetailedAddress { get; set; }
+
+
+ ///
+ /// 描述 :排序
+ ///
+ [EpplusTableColumn(Header = "排序")]
+ public int ShopAddressSort { get; set; }
+
+ public string CreateTime { get; set; }
+
+
+ }
+}
diff --git a/ARW.Repository/Business/ShopManager/ShopAddresss/ShopAddressRepository.cs b/ARW.Repository/Business/ShopManager/ShopAddresss/ShopAddressRepository.cs
new file mode 100644
index 0000000..dd2f4a0
--- /dev/null
+++ b/ARW.Repository/Business/ShopManager/ShopAddresss/ShopAddressRepository.cs
@@ -0,0 +1,20 @@
+using System;
+using Infrastructure.Attribute;
+using ARW.Repository.System;
+using ARW.Model.Models.Business.ShopManager.ShopAddresss;
+
+namespace ARW.Repository.Business.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址仓储
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ [AppService(ServiceLifetime = LifeTime.Transient)]
+ public class ShopAddressRepository : BaseRepository
+ {
+ #region 业务逻辑代码
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ARW.Repository/System/SysDictDataRepository.cs b/ARW.Repository/System/SysDictDataRepository.cs
index 0c5e3b6..b930b45 100644
--- a/ARW.Repository/System/SysDictDataRepository.cs
+++ b/ARW.Repository/System/SysDictDataRepository.cs
@@ -118,9 +118,22 @@ namespace ARW.Repository.System
public string GetDictNameByName(string name, string value)
{
var dictData = Context.Queryable().Where(s => s.DictType == name).ToList();
+ if (dictData.Count <= 0) throw new Exception(name + "字典不存在");
var res = dictData.Where(s => s.DictValue == value).First();
return res.DictLabel;
}
+ ///
+ /// 获取字典值
+ ///
+ ///
+ public string GetDictValueByName(string name, string lable)
+ {
+ var dictData = Context.Queryable().Where(s => s.DictType == name).ToList();
+ if (dictData.Count <= 0) throw new Exception(name + "字典不存在");
+ var res = dictData.Where(s => s.DictLabel == lable).First();
+ return res.DictValue;
+ }
+
}
}
diff --git a/ARW.Service/Business/BusinessService/ShopManager/ShopAddresss/ShopAddressService.cs b/ARW.Service/Business/BusinessService/ShopManager/ShopAddresss/ShopAddressService.cs
new file mode 100644
index 0000000..f6508a3
--- /dev/null
+++ b/ARW.Service/Business/BusinessService/ShopManager/ShopAddresss/ShopAddressService.cs
@@ -0,0 +1,125 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Infrastructure;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Repository.Business.ShopManager.ShopAddresss;
+using ARW.Service.Business.IBusinessService.ShopManager.ShopAddresss;
+using ARW.Model.Dto.Business.ShopManager.ShopAddresss;
+using ARW.Model.Models.Business.ShopManager.ShopAddresss;
+using ARW.Model.Vo.Business.ShopManager.ShopAddresss;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Repository.System;
+using ARW.Model.Models.Business.ShopManager.Shops;
+
+namespace ARW.Service.Business.BusinessService.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址接口实现类
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ [AppService(ServiceType = typeof(IShopAddressService), ServiceLifetime = LifeTime.Transient)]
+ public class ShopAddressServiceImpl : BaseService, IShopAddressService
+ {
+ private readonly ShopAddressRepository _ShopAddressRepository;
+ private readonly SysDictDataRepository _SysDictDataRepository;
+
+ public ShopAddressServiceImpl(ShopAddressRepository ShopAddressRepository, SysDictDataRepository sysDictDataRepository)
+ {
+ this._ShopAddressRepository = ShopAddressRepository;
+ _SysDictDataRepository = sysDictDataRepository;
+ }
+
+ #region 业务逻辑代码
+
+
+ ///
+ /// 查询店铺地址分页列表
+ ///
+ public async Task> GetShopAddressList(ShopAddressQueryDto parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(parm.ShopGuid != 0, s => s.ShopGuid == parm.ShopGuid);
+ predicate = predicate.AndIF(parm.ShopAddressType != null, s => s.ShopAddressType == parm.ShopAddressType);
+ var query = _ShopAddressRepository
+ .Queryable()
+ .LeftJoin((s, d) => s.ProvinceId == d.RegionId)
+ .LeftJoin((s, d, f) => s.CityId == f.RegionId)
+ .LeftJoin((s, d, f, g) => s.DistrictId == g.RegionId)
+ .LeftJoin((s, d, f, g, c) => s.ShopGuid == c.ShopGuid)
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.ShopAddressSort, OrderByType.Asc)
+ .Select((s, d, f, g, c) => new ShopAddressVo
+ {
+ ShopGuid = s.ShopGuid,
+ ShopName = c.ShopName,
+ ShopAddressId = s.ShopAddressId,
+ ShopAddressGuid = s.ShopAddressGuid,
+ ShopAddressType = s.ShopAddressType,
+ AddressName = d.RegionName + "/" + f.RegionName + "/" + g.RegionName,
+ ProvinceId = s.ProvinceId,
+ CityId = s.CityId,
+ DistrictId = s.DistrictId,
+ ShopAddressContactName = s.ShopAddressContactName,
+ ShopAddressContactNumber = s.ShopAddressContactNumber,
+ ShopAddressDetailedAddress = s.ShopAddressDetailedAddress,
+ ShopAddressSort = s.ShopAddressSort,
+ CreateTime = s.Create_time.ToString("yyyy-MM-dd HH:mm")
+ });
+
+
+ return await query.ToPageAsync(parm);
+ }
+
+ ///
+ /// 添加或修改店铺地址
+ ///
+ public async Task AddOrUpdateShopAddress(ShopAddress model)
+ {
+ if (model.ShopAddressId != 0)
+ {
+ var response = await _ShopAddressRepository.UpdateAsync(model);
+ return "修改成功!";
+ }
+ else
+ {
+
+ var response = await _ShopAddressRepository.InsertReturnSnowflakeIdAsync(model);
+ return "添加成功!";
+ }
+ }
+
+ #region Excel处理
+
+
+ ///
+ /// Excel数据导出处理
+ ///
+ public async Task> HandleExportData(List data)
+ {
+ foreach (var item in data)
+ {
+ item.ShopAddressTypeName = _SysDictDataRepository.GetDictNameByName("shop_address_type", item.ShopAddressType.ToString());
+ }
+
+ return data;
+ }
+
+ #endregion
+
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
index 02c1b9f..f2b3f6c 100644
--- a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
+++ b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
@@ -69,8 +69,8 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
//开始拼装查询条件d
var predicate = Expressionable.Create();
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ShopName), it => it.ShopName.Contains(parm.ShopName));
- predicate = predicate.AndIF(parm.ShopAuditStatus != null, it => it.ShopAuditStatus == parm.ShopAuditStatus);
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ShopName), s => s.ShopName.Contains(parm.ShopName));
+ predicate = predicate.AndIF(parm.ShopAuditStatus != null, s => s.ShopAuditStatus == parm.ShopAuditStatus);
var query = _ShopRepository
.Queryable()
.LeftJoin((s, c) => s.ShopUserId == c.UserId)
diff --git a/ARW.Service/Business/IBusinessService/ShopManager/ShopAddresss/IShopAddressService.cs b/ARW.Service/Business/IBusinessService/ShopManager/ShopAddresss/IShopAddressService.cs
new file mode 100644
index 0000000..194f864
--- /dev/null
+++ b/ARW.Service/Business/IBusinessService/ShopManager/ShopAddresss/IShopAddressService.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Business.ShopManager.ShopAddresss;
+using ARW.Model.Models.Business.ShopManager.ShopAddresss;
+using ARW.Model.Vo.Business.ShopManager.ShopAddresss;
+
+namespace ARW.Service.Business.IBusinessService.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址接口类
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ public interface IShopAddressService : IBaseService
+ {
+ ///
+ /// 获取店铺地址分页列表
+ ///
+ ///
+ ///
+ Task> GetShopAddressList(ShopAddressQueryDto parm);
+
+
+ ///
+ /// 添加或修改店铺地址
+ ///
+ ///
+ ///
+ Task AddOrUpdateShopAddress(ShopAddress parm);
+
+
+
+ ///
+ /// Excel导出
+ ///
+ Task> HandleExportData(List data);
+
+
+ }
+}
diff --git a/ARW.WebApi/Controllers/Business/Custom/Regions/RegionController.cs b/ARW.WebApi/Controllers/Business/Custom/Regions/RegionController.cs
index 7255e2d..a879ab7 100644
--- a/ARW.WebApi/Controllers/Business/Custom/Regions/RegionController.cs
+++ b/ARW.WebApi/Controllers/Business/Custom/Regions/RegionController.cs
@@ -43,7 +43,6 @@ namespace ARW.WebApi.Controllers.Business.Custom.Regions
/// 查询参数
///
[HttpGet("getRegionTreeList")]
- [ActionPermissionFilter(Permission = "business:region:treelist")]
public async Task GetRegionList([FromQuery] RegionQueryDto parm)
{
var res = await _RegionService.GetRegionTreeList(parm);
diff --git a/ARW.WebApi/Controllers/Business/ShopManager/ShopAddresss/ShopAddressController.cs b/ARW.WebApi/Controllers/Business/ShopManager/ShopAddresss/ShopAddressController.cs
new file mode 100644
index 0000000..a5a707c
--- /dev/null
+++ b/ARW.WebApi/Controllers/Business/ShopManager/ShopAddresss/ShopAddressController.cs
@@ -0,0 +1,150 @@
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Enums;
+using Infrastructure.Model;
+using Mapster;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using ARW.Admin.WebApi.Extensions;
+using ARW.Admin.WebApi.Filters;
+using ARW.Common;
+using ARW.Model.Dto.Business.ShopManager.ShopAddresss;
+using ARW.Service.Business.IBusinessService.ShopManager.ShopAddresss;
+using ARW.Admin.WebApi.Controllers;
+using ARW.Model.Models.Business.ShopManager.ShopAddresss;
+using ARW.Model.Vo.Business.ShopManager.ShopAddresss;
+using Microsoft.AspNetCore.Authorization;
+using ARW.Admin.WebApi.Framework;
+using ARW.Service.Business.IBusinessService.ShopManager.Shops;
+
+namespace ARW.WebApi.Controllers.Business.ShopManager.ShopAddresss
+{
+ ///
+ /// 店铺地址控制器
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-15
+ ///
+ [Verify]
+ [Route("business/[controller]")]
+ public class ShopAddressController : BaseController
+ {
+ private readonly IShopAddressService _ShopAddressService;
+ private readonly IShopService _ShopService;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 店铺地址服务
+ public ShopAddressController(IShopAddressService ShopAddressService, IShopService shopService)
+ {
+ _ShopAddressService = ShopAddressService;
+ _ShopService = shopService;
+ }
+
+
+ ///
+ /// 获取店铺地址列表
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getShopAddressList")]
+ [ActionPermissionFilter(Permission = "business:shopaddress:list")]
+ public async Task GetShopAddressList([FromQuery] ShopAddressQueryDto parm)
+ {
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ if (user.UserId != 1)
+ {
+ var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
+ if (shop == null) throw new Exception("当前用户没有店铺");
+ parm.ShopGuid= shop.ShopGuid;
+ }
+
+ var res = await _ShopAddressService.GetShopAddressList(parm);
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 添加或修改店铺地址
+ ///
+ ///
+ ///
+ [HttpPost("addOrUpdateShopAddress")]
+ [ActionPermissionFilter(Permission = "business:shopaddress:addOrUpdate")]
+ [Log(Title = "添加或修改店铺地址", BusinessType = BusinessType.ADDORUPDATE)]
+ public async Task AddOrUpdateShopAddress([FromBody] ShopAddressDto parm)
+ {
+ if (parm == null) { throw new CustomException("请求参数错误"); }
+
+ var modal = new ShopAddress();
+ if (parm.ShopAddressId != 0) modal = parm.Adapt().ToUpdate(HttpContext);
+ else modal = parm.Adapt().ToCreate(HttpContext);
+
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ if (user.UserId != 1)
+ {
+ var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId);
+ if (shop == null) throw new Exception("当前用户没有店铺");
+ modal.ShopGuid = shop.ShopGuid;
+ }
+
+ var res = await _ShopAddressService.AddOrUpdateShopAddress(modal);
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 删除店铺地址
+ ///
+ ///
+ [HttpDelete("{ids}")]
+ [ActionPermissionFilter(Permission = "business:shopaddress:delete")]
+ [Log(Title = "店铺地址删除", BusinessType = BusinessType.DELETE)]
+ public IActionResult Delete(string ids)
+ {
+ long[] idsArr = Tools.SpitLongArrary(ids);
+ if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
+ var response = _ShopAddressService.Delete(idsArr);
+ return SUCCESS("删除成功!");
+ }
+
+
+ ///
+ /// 导出店铺地址
+ ///
+ ///
+ [Log(Title = "店铺地址导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
+ [HttpGet("exportShopAddress")]
+ [ActionPermissionFilter(Permission = "business:shopaddress:export")]
+ public async Task ExportExcel([FromQuery] ShopAddressQueryDto parm)
+ {
+ parm.PageSize = 10000;
+ var list = await _ShopAddressService.GetShopAddressList(parm);
+ var data = list.Result;
+
+ // 选中数据
+ if (!string.IsNullOrEmpty(parm.ids))
+ {
+ int[] idsArr = Tools.SpitIntArrary(parm.ids);
+ var selectDataList = new List();
+ foreach (var item in idsArr)
+ {
+ var select_data = data.Where(s => s.ShopAddressId == item).First();
+ selectDataList.Add(select_data);
+ }
+ data = selectDataList;
+ }
+
+
+
+ // 导出数据处理
+ var handleData = await _ShopAddressService.HandleExportData(data);
+
+ string sFileName = ExportExcel(handleData, "ShopAddress", "店铺地址列表");
+ return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
+ }
+
+
+
+
+ }
+}
diff --git a/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt b/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
index a2f8187..ae1e9c4 100644
--- a/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
+++ b/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
@@ -77,7 +77,7 @@ $if(genTable.TplCategory == "tree")
$end
$if(replaceDto.ShowBtnAdd)
-
+
{{ ${t}t('btn.add') }}