Commit a6c94c82 authored by 黄奎's avatar 黄奎

新增商会实体类

parent 073e2aa2
using Mall.Common.Enum;
using System;
using VT.FW.DB;
namespace Mall.Model.Entity.TradePavilion
{
/// <summary>
/// 联系人实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Contract
{
/// <summary>
/// 主键
/// </summary>
public int Id { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Name { get; set; }
/// <summary>
/// 电话
/// </summary>
public string Tel { get; set; }
/// <summary>
/// 头像
/// </summary>
public string HeadIcon { get; set; }
/// <summary>
/// 背景图
/// </summary>
public string BgImg { get; set; }
/// <summary>
/// 职位
/// </summary>
public string Position { get; set; }
/// <summary>
/// 介绍
/// </summary>
public string Intro { get; set; }
/// <summary>
/// 商户号id
/// </summary>
public int TenantId { get; set; }
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 修改人
/// </summary>
public int UpdateBy { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime UpdateDate { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
}
}
using Mall.Model.Entity.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Model.Extend.TradePavilion
{
/// <summary>
/// 联系人扩展实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Contract_Extend : RB_Contract
{
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
using Mall.Model.Extend.TradePavilion;
using Mall.Repository.TradePavilion;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Mall.Module.TradePavilion
{
/// <summary>
/// 联系人处理类
/// </summary>
public class ContractModule
{
/// <summary>
/// 联系人仓储层对象
/// </summary>
private readonly RB_ContractRepository contractRepository = new RB_ContractRepository();
/// <summary>
/// 获取联系人人也列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Contract_Extend> GetContractPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_Contract_Extend query)
{
return contractRepository.GetContractPageListRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取联系人实体
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Contract_Extend GetContractModule(object Id)
{
return contractRepository.GetEntity<RB_Contract_Extend>(Id);
}
/// <summary>
/// 新增修改联系人
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetContractModule(RB_Contract_Extend model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Contract_Extend.Name),model.Name },
{nameof(RB_Contract_Extend.Tel),model.Tel },
{nameof(RB_Contract_Extend.HeadIcon),model.HeadIcon },
{nameof(RB_Contract_Extend.BgImg),model.BgImg },
{nameof(RB_Contract_Extend.Position),model.Position },
{nameof(RB_Contract_Extend.Intro),model.Intro },
{nameof(RB_Contract_Extend.UpdateBy),model.UpdateBy },
{nameof(RB_Contract_Extend.UpdateDate),model.UpdateDate },
};
flag = contractRepository.Update(fileds, new WhereHelper(nameof(RB_Contract_Extend.Id), model.Id));
}
else
{
var newId = contractRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 更新联系人状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status"></param>
/// <returns></returns>
public bool RemoveContractModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Contract_Extend.Status),Status },
};
bool flag = contractRepository.Update(fileds, new WhereHelper(nameof(RB_Contract_Extend.Id), Id));
return flag;
}
}
}
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
using Mall.Common.Enum;
using Mall.Model.Entity.TradePavilion;
using Mall.Model.Extend.TradePavilion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Mall.Repository.TradePavilion
{
/// <summary>
/// 联系人仓储层
/// </summary>
public class RB_ContractRepository : BaseRepository<RB_Contract>
{
/// <summary>
/// 获取联系人人也列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public List<RB_Contract_Extend> GetContractPageListRepository(int pageIndex, int pageSize, out long rowsCount, RB_Contract_Extend query)
{
rowsCount = 0;
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT *
FROM RB_Contract
WHERE 1=1
");
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Contract_Extend.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Contract_Extend>();
}
else
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Contract_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Contract_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat(" AND {0} LIKE @Name ", nameof(RB_Contract_Extend.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
}
return GetPage<RB_Contract_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Mall.CacheManager.User;
using Mall.Common.API;
using Mall.Common.Plugin;
using Mall.Model.Extend.TradePavilion;
using Mall.Module.TradePavilion;
using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Mall.WebApi.Controllers.TradePavilion
{
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class ContractController : BaseController
{
/// <summary>
/// 联系人处理类对象
/// </summary>
private readonly ContractModule module = new ContractModule();
/// <summary>
/// 获取联系人分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetContractPageList()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_Contract_Extend>(RequestParm.msg.ToString());
query.MallBaseId = RequestParm.MallBaseId;
query.TenantId = RequestParm.TenantId;
var list = module.GetContractPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
if (list != null && list.Count > 0)
{
foreach (var item in list)
{
if (item.CreateBy > 0)
{
item.CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.Account ?? "";
}
}
}
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 新增修改联系人
/// </summary>
/// <returns></returns>
public ApiResult SetContract()
{
var extModel = JsonConvert.DeserializeObject<RB_Contract_Extend>(RequestParm.msg.ToString());
extModel.Status = Common.Enum.DateStateEnum.Normal;
extModel.MallBaseId = RequestParm.MallBaseId;
extModel.TenantId = RequestParm.TenantId;
Int32.TryParse(RequestParm.uid, out int Uid);
extModel.CreateBy = Uid;
extModel.CreateDate = DateTime.Now;
var flag = module.SetContractModule(extModel);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
/// <summary>
/// 获取角色实体
/// </summary>
/// <returns></returns>
public ApiResult GetContract()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var extModel = module.GetContractModule(Id);
return ApiResult.Success(data: extModel);
}
/// <summary>
/// 删除联系人
/// </summary>
/// <returns></returns>
public ApiResult RemoveContract()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
var Id = parms.GetInt("Id", 0);
var Status = parms.GetInt("Status", 0);
var flag = module.RemoveContractModule(Id, Status);
return flag ? ApiResult.Success() : ApiResult.Failed();
}
}
}
......@@ -53,7 +53,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mall.EducationClient", "Mal
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mall.Module.Education", "Mall.Module.Education\Mall.Module.Education.csproj", "{B076F66B-B75E-43DE-B305-764BF3638A91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mall.Module.Reserve", "Mall.Module.Reserve\Mall.Module.Reserve.csproj", "{449E8584-B4D1-4796-81EE-F7D70536C91D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mall.Module.Reserve", "Mall.Module.Reserve\Mall.Module.Reserve.csproj", "{449E8584-B4D1-4796-81EE-F7D70536C91D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mall.Module.TradePavilion", "Mall.Module.TradePavilion\Mall.Module.TradePavilion.csproj", "{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -145,6 +147,10 @@ Global
{449E8584-B4D1-4796-81EE-F7D70536C91D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{449E8584-B4D1-4796-81EE-F7D70536C91D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{449E8584-B4D1-4796-81EE-F7D70536C91D}.Release|Any CPU.Build.0 = Release|Any CPU
{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -166,6 +172,7 @@ Global
{B665F9E2-C1D6-418C-9A1A-D777E3157799} = {646382A6-0092-441C-B202-ED8C3DE015B5}
{B076F66B-B75E-43DE-B305-764BF3638A91} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
{449E8584-B4D1-4796-81EE-F7D70536C91D} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
{3982D5CA-D5BF-45FD-BCDA-FF6694D409D3} = {034DEA5B-083C-46EC-9D3F-C8273C59C218}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {450F460D-A6AE-4FE3-948A-34E5FB8DBD7C}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment