feat 添加店铺收货地址
This commit is contained in:
parent
a106678947
commit
7d3f821c1c
@ -15,37 +15,37 @@ namespace ARW.CodeGenerator
|
|||||||
{
|
{
|
||||||
if (queryType.Equals("EQ"))
|
if (queryType.Equals("EQ"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} == parm.{propertyName})";
|
return $"s => s.{ propertyName} == parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("LIKE"))
|
if (queryType.Equals("LIKE"))
|
||||||
{
|
{
|
||||||
return $"it => it.{propertyName}.Contains(parm.{propertyName}))";
|
return $"s => s.{propertyName}.Contains(parm.{propertyName}))";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("GTE"))
|
if (queryType.Equals("GTE"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} >= parm.{propertyName})";
|
return $"s => s.{ propertyName} >= parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("GT"))
|
if (queryType.Equals("GT"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} > parm.{propertyName})";
|
return $"s => s.{ propertyName} > parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("LT"))
|
if (queryType.Equals("LT"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} < parm.{propertyName})";
|
return $"s => s.{ propertyName} < parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("LTE"))
|
if (queryType.Equals("LTE"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} <= parm.{propertyName})";
|
return $"s => s.{ propertyName} <= parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("NE"))
|
if (queryType.Equals("NE"))
|
||||||
{
|
{
|
||||||
return $"it => it.{ propertyName} != parm.{propertyName})";
|
return $"s => s.{ propertyName} != parm.{propertyName})";
|
||||||
}
|
}
|
||||||
if (queryType.Equals("ARWKE"))
|
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})";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址输入对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
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; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址查询对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
public class ShopAddressQueryDto : PagerInfo
|
||||||
|
{
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
public int? ShopAddressType { get; set; }
|
||||||
|
|
||||||
|
public string ids { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址,数据实体对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("tb_shop_address")]
|
||||||
|
public class ShopAddress : BusinessBase
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "ShopAddressId")]
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "shop_address_id")]
|
||||||
|
public int ShopAddressId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "ShopAddressGuid")]
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(IsPrimaryKey = true, ColumnName = "shop_address_guid")]
|
||||||
|
public long ShopAddressGuid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 : 店铺guid
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName = "shop_guid")]
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :地址类型
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "地址类型")]
|
||||||
|
[SugarColumn(ColumnName = "shop_address_type")]
|
||||||
|
public int ShopAddressType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :省id
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "省id")]
|
||||||
|
[SugarColumn(ColumnName = "province_id")]
|
||||||
|
public int ProvinceId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :市id
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "市id")]
|
||||||
|
[SugarColumn(ColumnName = "city_id")]
|
||||||
|
public int CityId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :区id
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "区id")]
|
||||||
|
[SugarColumn(ColumnName = "district_id")]
|
||||||
|
public int DistrictId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :联系人姓名
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "联系人姓名")]
|
||||||
|
[SugarColumn(ColumnName = "shop_address_contact_name")]
|
||||||
|
public string ShopAddressContactName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :联系电话
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "联系电话")]
|
||||||
|
[SugarColumn(ColumnName = "shop_address_contact_number")]
|
||||||
|
public string ShopAddressContactNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :详细地址
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "详细地址")]
|
||||||
|
[SugarColumn(ColumnName = "shop_address_detailed_address")]
|
||||||
|
public string ShopAddressDetailedAddress { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :排序
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "排序")]
|
||||||
|
[SugarColumn(ColumnName = "shop_address_sort")]
|
||||||
|
public int ShopAddressSort { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
120
ARW.Model/Vo/Business/ShopManager/ShopAddresss/ShopAddressVo.cs
Normal file
120
ARW.Model/Vo/Business/ShopManager/ShopAddresss/ShopAddressVo.cs
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using OfficeOpenXml.Attributes;
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ARW.Model.Vo.Business.ShopManager.ShopAddresss
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址展示对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
public class ShopAddressVo
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int ShopAddressId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusIgnore]
|
||||||
|
public long ShopAddressGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 : 店铺guid
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusIgnore]
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :店铺名称
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "店铺")]
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :地址类型
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int ShopAddressType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :地址类型名称
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "地址类型")]
|
||||||
|
public string ShopAddressTypeName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :省id
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int ProvinceId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :市id
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int CityId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :区id
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int DistrictId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :所在地区
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "所在地区")]
|
||||||
|
public string AddressName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :联系人姓名
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "联系人姓名")]
|
||||||
|
public string ShopAddressContactName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :联系电话
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "联系电话")]
|
||||||
|
public string ShopAddressContactNumber { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :详细地址
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "详细地址")]
|
||||||
|
public string ShopAddressDetailedAddress { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :排序
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "排序")]
|
||||||
|
public int ShopAddressSort { get; set; }
|
||||||
|
|
||||||
|
public string CreateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址仓储
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||||
|
public class ShopAddressRepository : BaseRepository<ShopAddress>
|
||||||
|
{
|
||||||
|
#region 业务逻辑代码
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -118,9 +118,22 @@ namespace ARW.Repository.System
|
|||||||
public string GetDictNameByName(string name, string value)
|
public string GetDictNameByName(string name, string value)
|
||||||
{
|
{
|
||||||
var dictData = Context.Queryable<SysDictData>().Where(s => s.DictType == name).ToList();
|
var dictData = Context.Queryable<SysDictData>().Where(s => s.DictType == name).ToList();
|
||||||
|
if (dictData.Count <= 0) throw new Exception(name + "字典不存在");
|
||||||
var res = dictData.Where(s => s.DictValue == value).First();
|
var res = dictData.Where(s => s.DictValue == value).First();
|
||||||
return res.DictLabel;
|
return res.DictLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取字典值
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string GetDictValueByName(string name, string lable)
|
||||||
|
{
|
||||||
|
var dictData = Context.Queryable<SysDictData>().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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址接口实现类
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
[AppService(ServiceType = typeof(IShopAddressService), ServiceLifetime = LifeTime.Transient)]
|
||||||
|
public class ShopAddressServiceImpl : BaseService<ShopAddress>, IShopAddressService
|
||||||
|
{
|
||||||
|
private readonly ShopAddressRepository _ShopAddressRepository;
|
||||||
|
private readonly SysDictDataRepository _SysDictDataRepository;
|
||||||
|
|
||||||
|
public ShopAddressServiceImpl(ShopAddressRepository ShopAddressRepository, SysDictDataRepository sysDictDataRepository)
|
||||||
|
{
|
||||||
|
this._ShopAddressRepository = ShopAddressRepository;
|
||||||
|
_SysDictDataRepository = sysDictDataRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 业务逻辑代码
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询店铺地址分页列表
|
||||||
|
/// </summary>
|
||||||
|
public async Task<PagedInfo<ShopAddressVo>> GetShopAddressList(ShopAddressQueryDto parm)
|
||||||
|
{
|
||||||
|
//开始拼装查询条件d
|
||||||
|
var predicate = Expressionable.Create<ShopAddress>();
|
||||||
|
|
||||||
|
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<Region>((s, d) => s.ProvinceId == d.RegionId)
|
||||||
|
.LeftJoin<Region>((s, d, f) => s.CityId == f.RegionId)
|
||||||
|
.LeftJoin<Region>((s, d, f, g) => s.DistrictId == g.RegionId)
|
||||||
|
.LeftJoin<Shop>((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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺地址
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> AddOrUpdateShopAddress(ShopAddress model)
|
||||||
|
{
|
||||||
|
if (model.ShopAddressId != 0)
|
||||||
|
{
|
||||||
|
var response = await _ShopAddressRepository.UpdateAsync(model);
|
||||||
|
return "修改成功!";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var response = await _ShopAddressRepository.InsertReturnSnowflakeIdAsync(model);
|
||||||
|
return "添加成功!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Excel处理
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Excel数据导出处理
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<ShopAddressVo>> HandleExportData(List<ShopAddressVo> data)
|
||||||
|
{
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
item.ShopAddressTypeName = _SysDictDataRepository.GetDictNameByName("shop_address_type", item.ShopAddressType.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -69,8 +69,8 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
|
|||||||
//开始拼装查询条件d
|
//开始拼装查询条件d
|
||||||
var predicate = Expressionable.Create<Shop>();
|
var predicate = Expressionable.Create<Shop>();
|
||||||
|
|
||||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ShopName), it => it.ShopName.Contains(parm.ShopName));
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ShopName), s => s.ShopName.Contains(parm.ShopName));
|
||||||
predicate = predicate.AndIF(parm.ShopAuditStatus != null, it => it.ShopAuditStatus == parm.ShopAuditStatus);
|
predicate = predicate.AndIF(parm.ShopAuditStatus != null, s => s.ShopAuditStatus == parm.ShopAuditStatus);
|
||||||
var query = _ShopRepository
|
var query = _ShopRepository
|
||||||
.Queryable()
|
.Queryable()
|
||||||
.LeftJoin<SysUser>((s, c) => s.ShopUserId == c.UserId)
|
.LeftJoin<SysUser>((s, c) => s.ShopUserId == c.UserId)
|
||||||
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址接口类
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
public interface IShopAddressService : IBaseService<ShopAddress>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取店铺地址分页列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PagedInfo<ShopAddressVo>> GetShopAddressList(ShopAddressQueryDto parm);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺地址
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<string> AddOrUpdateShopAddress(ShopAddress parm);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Excel导出
|
||||||
|
/// </summary>
|
||||||
|
Task<List<ShopAddressVo>> HandleExportData(List<ShopAddressVo> data);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -43,7 +43,6 @@ namespace ARW.WebApi.Controllers.Business.Custom.Regions
|
|||||||
/// <param name="parm">查询参数</param>
|
/// <param name="parm">查询参数</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("getRegionTreeList")]
|
[HttpGet("getRegionTreeList")]
|
||||||
[ActionPermissionFilter(Permission = "business:region:treelist")]
|
|
||||||
public async Task<IActionResult> GetRegionList([FromQuery] RegionQueryDto parm)
|
public async Task<IActionResult> GetRegionList([FromQuery] RegionQueryDto parm)
|
||||||
{
|
{
|
||||||
var res = await _RegionService.GetRegionTreeList(parm);
|
var res = await _RegionService.GetRegionTreeList(parm);
|
||||||
|
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺地址控制器
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-15
|
||||||
|
/// </summary>
|
||||||
|
[Verify]
|
||||||
|
[Route("business/[controller]")]
|
||||||
|
public class ShopAddressController : BaseController
|
||||||
|
{
|
||||||
|
private readonly IShopAddressService _ShopAddressService;
|
||||||
|
private readonly IShopService _ShopService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 依赖注入
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ShopAddressService">店铺地址服务</param>
|
||||||
|
public ShopAddressController(IShopAddressService ShopAddressService, IShopService shopService)
|
||||||
|
{
|
||||||
|
_ShopAddressService = ShopAddressService;
|
||||||
|
_ShopService = shopService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取店铺地址列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm">查询参数</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getShopAddressList")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shopaddress:list")]
|
||||||
|
public async Task<IActionResult> 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺地址
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("addOrUpdateShopAddress")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shopaddress:addOrUpdate")]
|
||||||
|
[Log(Title = "添加或修改店铺地址", BusinessType = BusinessType.ADDORUPDATE)]
|
||||||
|
public async Task<IActionResult> AddOrUpdateShopAddress([FromBody] ShopAddressDto parm)
|
||||||
|
{
|
||||||
|
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||||
|
|
||||||
|
var modal = new ShopAddress();
|
||||||
|
if (parm.ShopAddressId != 0) modal = parm.Adapt<ShopAddress>().ToUpdate(HttpContext);
|
||||||
|
else modal = parm.Adapt<ShopAddress>().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);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除店铺地址
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[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("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出店铺地址
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Log(Title = "店铺地址导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||||||
|
[HttpGet("exportShopAddress")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shopaddress:export")]
|
||||||
|
public async Task<IActionResult> 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<ShopAddressVo>();
|
||||||
|
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 });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -77,7 +77,7 @@ $if(genTable.TplCategory == "tree")
|
|||||||
$end
|
$end
|
||||||
$if(replaceDto.ShowBtnAdd)
|
$if(replaceDto.ShowBtnAdd)
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" v-hasPermi="['${replaceDto.PermissionPrefix}:addOrUpdateKey']" plain icon="plus" @click="AddDialogVisible = true">
|
<el-button type="primary" v-hasPermi="['${replaceDto.PermissionPrefix}:addOrUpdate']" plain icon="plus" @click="AddDialogVisible = true">
|
||||||
{{ ${t}t('btn.add') }}
|
{{ ${t}t('btn.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
Loading…
Reference in New Issue
Block a user