Commit e9577e63 authored by 黄奎's avatar 黄奎

代码修改

parent 4b47c7ce
...@@ -4,6 +4,7 @@ using System.Text; ...@@ -4,6 +4,7 @@ using System.Text;
using Mall.Model.Entity.Miai; using Mall.Model.Entity.Miai;
using Mall.Model.Extend.Miai; using Mall.Model.Extend.Miai;
using System.Linq; using System.Linq;
using VT.FW.DB.Dapper;
namespace Mall.Repository.Miai namespace Mall.Repository.Miai
{ {
...@@ -23,6 +24,7 @@ namespace Mall.Repository.Miai ...@@ -23,6 +24,7 @@ namespace Mall.Repository.Miai
/// <returns></returns> /// <returns></returns>
public List<RB_Miai_Dating_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Miai_Dating_Extend dmodel) public List<RB_Miai_Dating_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Miai_Dating_Extend dmodel)
{ {
var parameters = new DynamicParameters();
string where = $" 1=1 and d.{nameof(RB_Miai_Dating_Extend.Status)}=0"; string where = $" 1=1 and d.{nameof(RB_Miai_Dating_Extend.Status)}=0";
if (dmodel.TenantId > 0) { if (dmodel.TenantId > 0) {
where += $@" and d.{nameof(RB_Miai_Dating_Extend.TenantId)}={dmodel.TenantId}"; where += $@" and d.{nameof(RB_Miai_Dating_Extend.TenantId)}={dmodel.TenantId}";
...@@ -35,16 +37,17 @@ namespace Mall.Repository.Miai ...@@ -35,16 +37,17 @@ namespace Mall.Repository.Miai
{ {
where += $@" and (d.{nameof(RB_Miai_Dating_Extend.ManId)} ={dmodel.UserId} or d.{nameof(RB_Miai_Dating_Extend.WoManId)} ={dmodel.UserId})"; where += $@" and (d.{nameof(RB_Miai_Dating_Extend.ManId)} ={dmodel.UserId} or d.{nameof(RB_Miai_Dating_Extend.WoManId)} ={dmodel.UserId})";
} }
if (!string.IsNullOrEmpty(dmodel.UserName)) if (!string.IsNullOrEmpty(dmodel.UserName)&& dmodel.UserName.Trim()!="")
{ {
where += $@" and (u1.`Name` like '%{dmodel.UserName}%' or u2..`Name` like '%{dmodel.UserName}%')"; where += $@" and (u1.`Name` like @UserName or u2..`Name` like @UserName )";
parameters.Add("UserName", "%" + dmodel.UserName.Trim() + "%");
} }
string sql = $@"select d.*,u1.`Name` as ManName,u1.Photo as ManPhoto,u2.`Name` as WoManName,u2.Photo as WoManPhoto from RB_Miai_Dating d string sql = $@"select d.*,u1.`Name` as ManName,u1.Photo as ManPhoto,u2.`Name` as WoManName,u2.Photo as WoManPhoto from RB_Miai_Dating d
left join rb_member_user u1 on d.ManId = u1.Id left join rb_member_user u1 on d.ManId = u1.Id
left join rb_member_user u2 on d.WoManId = u2.Id left join rb_member_user u2 on d.WoManId = u2.Id
where {where} order by d.Id desc"; where {where} order by d.Id desc";
return GetPage<RB_Miai_Dating_Extend>(pageIndex, pageSize, out rowCount, sql).ToList(); return GetPage<RB_Miai_Dating_Extend>(pageIndex, pageSize, out rowCount, sql, parameters).ToList();
} }
} }
} }
...@@ -838,7 +838,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -838,7 +838,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{ {
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)} in({dmodel.SupplierIds})"; where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)} in({dmodel.SupplierIds})";
} }
if (!string.IsNullOrEmpty(dmodel.Name)) if (!string.IsNullOrEmpty(dmodel.Name) && dmodel.Name.Trim() != "")
{ {
where += $@" and g.{nameof(RB_Goods_Extend.Name)} like @Name "; where += $@" and g.{nameof(RB_Goods_Extend.Name)} like @Name ";
parameters.Add("Name", "%" + dmodel.Name.Trim() + "%"); parameters.Add("Name", "%" + dmodel.Name.Trim() + "%");
......
...@@ -970,7 +970,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -970,7 +970,10 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album); oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album);
} }
}
else
{
oldBaseInfo = new RB_MiAi_BaseInfo_Extend();
} }
return ApiResult.Success("", new return ApiResult.Success("", new
{ {
...@@ -989,19 +992,19 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -989,19 +992,19 @@ namespace Mall.WebApi.Controllers.MallBase
CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
SexStr = (oldBaseInfo != null && oldBaseInfo.Id > 0) ? (oldBaseInfo.Sex == 1 ? "男" : "女") : "", SexStr = (oldBaseInfo != null && oldBaseInfo.Id > 0) ? (oldBaseInfo.Sex == 1 ? "男" : "女") : "",
Birthday = oldBaseInfo.Birthday ?? "", Birthday = oldBaseInfo?.Birthday ?? "",
Sex = oldBaseInfo?.Sex ?? 0, Sex = oldBaseInfo?.Sex ?? 0,
oldBaseInfo?.Height, oldBaseInfo?.Height,
oldBaseInfo?.Weight, oldBaseInfo?.Weight,
EducationType = oldBaseInfo.EducationType ?? 0, EducationType = oldBaseInfo?.EducationType ?? 0,
EducationTypeStr = (oldBaseInfo.EducationType.HasValue && oldBaseInfo.EducationType.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.EducationType) : "", EducationTypeStr = (oldBaseInfo!=null&& oldBaseInfo.EducationType.HasValue && oldBaseInfo.EducationType.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.EducationType) : "",
SchoolInfo = oldBaseInfo.SchoolInfo ?? "", SchoolInfo = oldBaseInfo?.SchoolInfo ?? "",
Age = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetAge(oldBaseInfo.Birthday),//年纪 Age = string.IsNullOrWhiteSpace(oldBaseInfo?.Birthday) ? "" : StringHelper.GetAge(oldBaseInfo.Birthday),//年纪
ShenXiao = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetShengXiao(Convert.ToDateTime((oldBaseInfo.Birthday))),//生肖 ShenXiao = string.IsNullOrWhiteSpace(oldBaseInfo?.Birthday) ? "" : StringHelper.GetShengXiao(Convert.ToDateTime((oldBaseInfo.Birthday))),//生肖
ConoldBaseInfostellation = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetAtomFromBirthday(Convert.ToDateTime((oldBaseInfo.Birthday))),//星座 ConoldBaseInfostellation = string.IsNullOrWhiteSpace(oldBaseInfo?.Birthday) ? "" : StringHelper.GetAtomFromBirthday(Convert.ToDateTime((oldBaseInfo.Birthday))),//星座
MarriageStr = (oldBaseInfo.Marriage.HasValue && oldBaseInfo.Marriage.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.Marriage) : "", MarriageStr = (oldBaseInfo!=null &&oldBaseInfo.Marriage.HasValue && oldBaseInfo?.Marriage.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.Marriage) : "",
Marriage = oldBaseInfo.Marriage ?? 0, Marriage = oldBaseInfo?.Marriage ?? 0,
Job = oldBaseInfo.Job ?? "", Job = oldBaseInfo?.Job ?? "",
WorkUnit = oldBaseInfo?.WorkUnit ?? "", WorkUnit = oldBaseInfo?.WorkUnit ?? "",
YearMoney = oldBaseInfo?.YearMoney ?? 0, YearMoney = oldBaseInfo?.YearMoney ?? 0,
CName = oldBaseInfo.CName ?? "", CName = oldBaseInfo.CName ?? "",
......
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