11111111
This commit is contained in:
@@ -1,89 +0,0 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WaterCloud.Code;
|
||||
using WaterCloud.DataBase;
|
||||
using WaterCloud.Domain.Entity.CustomerOrder;
|
||||
|
||||
namespace WaterCloud.Service.CustomerOrder;
|
||||
|
||||
public class CustomerOrderService : BaseService<CustomerOrderEntity>, IDenpendency
|
||||
{
|
||||
public CustomerOrderService(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<CustomerOrderEntity>> GetList(string keyword = "")
|
||||
{
|
||||
var query = repository.IQueryable();
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
query = query.Where(oo => oo.F_Name.Contains(keyword));
|
||||
|
||||
//普通用户仅可查看自己的数据
|
||||
if (!currentuser.IsAdmin || !currentuser.IsBoss || !currentuser.IsSuperAdmin || !currentuser.IsSenior)
|
||||
query = query.Where(oo => oo.F_CreatorUserId == currentuser.UserId);
|
||||
|
||||
return await query.OrderBy(oo => oo.F_CreatorTime).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<CustomerOrderEntity>> GetPageList(Pagination pagination, string keyword = "")
|
||||
{
|
||||
var query = repository.IQueryable().Where(a => a.F_DeleteMark == false);
|
||||
if (!string.IsNullOrWhiteSpace(keyword))
|
||||
query = query.Where(oo => oo.F_Name.Contains(keyword));
|
||||
|
||||
//普通用户仅可查看自己的数据
|
||||
if (!currentuser.IsAdmin || !currentuser.IsBoss || !currentuser.IsSuperAdmin || !currentuser.IsSenior)
|
||||
query = query.Where(oo => oo.F_CreatorUserId == currentuser.UserId);
|
||||
|
||||
return await query.ToPageListAsync(pagination);
|
||||
}
|
||||
|
||||
public async Task<CustomerOrderEntity> GetForm(string keyValue)
|
||||
{
|
||||
var data = await repository.FindEntity(keyValue);
|
||||
return data;
|
||||
}
|
||||
|
||||
#region 提交数据
|
||||
|
||||
public async Task SubmitForm(CustomerOrderEntity entity, string keyValue)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyValue))
|
||||
{
|
||||
entity.F_DeleteMark = false;
|
||||
entity.Create();
|
||||
await repository.Insert(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((!currentuser.IsAdmin || !currentuser.IsBoss || !currentuser.IsSuperAdmin || !currentuser.IsSenior) &&
|
||||
currentuser.UserId != entity.F_CreatorUserId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entity.Modify(keyValue);
|
||||
await repository.Update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task DeleteForm(string keyValue)
|
||||
{
|
||||
var ids = keyValue.Split(',');
|
||||
var data = await repository.FindEntity(keyValue);
|
||||
if (data == null)
|
||||
return;
|
||||
if ((!currentuser.IsAdmin || !currentuser.IsBoss || !currentuser.IsSuperAdmin || !currentuser.IsSenior) &&
|
||||
currentuser.UserId != data.F_CreatorUserId)
|
||||
throw new Exception("违规删除");
|
||||
|
||||
await repository.Delete(oo=>ids.Contains(oo.F_Id));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
104
WaterCloud.Service/OrderManagement/OrderCustomerService.cs
Normal file
104
WaterCloud.Service/OrderManagement/OrderCustomerService.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using WaterCloud.Code;
|
||||
using SqlSugar;
|
||||
using WaterCloud.DataBase;
|
||||
using WaterCloud.Domain.OrderManagement;
|
||||
|
||||
namespace WaterCloud.Service.OrderManagement
|
||||
{
|
||||
/// <summary>
|
||||
/// 创 建:超级管理员
|
||||
/// 日 期:2025-03-16 01:39
|
||||
/// 描 述:用户订单服务类
|
||||
/// </summary>
|
||||
public class OrderCustomerService : BaseService<OrderCustomerEntity>, IDenpendency
|
||||
{
|
||||
public OrderCustomerService(ISqlSugarClient context) : base(context)
|
||||
{
|
||||
}
|
||||
#region 获取数据
|
||||
public async Task<List<OrderCustomerEntity>> GetList(string keyword = "")
|
||||
{
|
||||
var data = repository.IQueryable();
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
data = data.Where(a => a.F_Name.Contains(keyword)
|
||||
|| a.F_ContactPerson.Contains(keyword));
|
||||
}
|
||||
return await data.Where(a => a.F_DeleteMark == false).OrderBy(a => a.F_CreatorTime , OrderByType.Desc).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<OrderCustomerEntity>> GetLookList(string keyword = "")
|
||||
{
|
||||
var query = repository.IQueryable().Where(a => a.F_DeleteMark == false);
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
//此处需修改
|
||||
query = query.Where(a => a.F_Name.Contains(keyword)
|
||||
|| a.F_ContactPerson.Contains(keyword));
|
||||
}
|
||||
//权限过滤
|
||||
query = GetDataPrivilege("a", "", query);
|
||||
return await query.OrderBy(a => a.F_CreatorTime , OrderByType.Desc).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<OrderCustomerEntity>> GetLookList(SoulPage<OrderCustomerEntity> pagination,string keyword = "",string id="")
|
||||
{
|
||||
var query = repository.IQueryable().Where(a => a.F_DeleteMark == false);
|
||||
if (!string.IsNullOrEmpty(keyword))
|
||||
{
|
||||
query = query.Where(a => a.F_Name.Contains(keyword)
|
||||
|| a.F_ContactPerson.Contains(keyword));
|
||||
}
|
||||
if(!string.IsNullOrEmpty(id))
|
||||
{
|
||||
query= query.Where(a=>a.F_Id==id);
|
||||
}
|
||||
//权限过滤
|
||||
query = GetDataPrivilege("a","",query);
|
||||
return await query.ToPageListAsync(pagination);
|
||||
}
|
||||
|
||||
public async Task<OrderCustomerEntity> GetForm(string keyValue)
|
||||
{
|
||||
var data = await repository.FindEntity(keyValue);
|
||||
return data;
|
||||
}
|
||||
#endregion
|
||||
|
||||
public async Task<OrderCustomerEntity> GetLookForm(string keyValue)
|
||||
{
|
||||
var data = await repository.FindEntity(keyValue);
|
||||
return GetFieldsFilterData(data);
|
||||
}
|
||||
|
||||
#region 提交数据
|
||||
public async Task SubmitForm(OrderCustomerEntity entity, string keyValue)
|
||||
{
|
||||
if(string.IsNullOrEmpty(keyValue))
|
||||
{
|
||||
//初始值添加
|
||||
entity.F_DeleteMark = false;
|
||||
entity.Create();
|
||||
await repository.Insert(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
//此处需修改
|
||||
entity.Modify(keyValue);
|
||||
await repository.Update(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteForm(string keyValue)
|
||||
{
|
||||
var ids = keyValue.Split(',');
|
||||
await repository.Delete(a => ids.Contains(a.F_Id.ToString()));
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user