Commit aba83108 authored by 吴春's avatar 吴春

接口修改

parent 0d4ee57f
...@@ -64,5 +64,10 @@ namespace Edu.Model.ViewModel.StudyAbroad ...@@ -64,5 +64,10 @@ namespace Edu.Model.ViewModel.StudyAbroad
/// 供应商上传合同 /// 供应商上传合同
/// </summary> /// </summary>
public string ContractUrl { get; set; } public string ContractUrl { get; set; }
/// <summary>
/// 留学就业编号查询使用
/// </summary>
public string QIds { get; set; }
} }
} }
...@@ -4,6 +4,7 @@ using Edu.Common.Plugin; ...@@ -4,6 +4,7 @@ using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course; using Edu.Model.ViewModel.Course;
using Edu.Repository.Course; using Edu.Repository.Course;
using Edu.Repository.Log; using Edu.Repository.Log;
using Edu.Repository.StudyAbroad;
using Edu.Repository.User; using Edu.Repository.User;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -48,6 +49,16 @@ namespace Edu.Module.Course ...@@ -48,6 +49,16 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
private readonly CourseModule courseModule = new CourseModule(); private readonly CourseModule courseModule = new CourseModule();
/// <summary>
/// 留学就业仓储层对象
/// </summary>
private readonly RB_StudyAbroadRepository studyAbroadRepository = new RB_StudyAbroadRepository();
/// <summary>
/// 留学就业价格仓储层对象
/// </summary>
private readonly RB_StudyaBroad_PreferentialRepository studyaBroad_PreferentialRepository = new RB_StudyaBroad_PreferentialRepository();
/// <summary> /// <summary>
/// 获取报价单分页列表 /// 获取报价单分页列表
/// </summary> /// </summary>
...@@ -61,11 +72,12 @@ namespace Edu.Module.Course ...@@ -61,11 +72,12 @@ namespace Edu.Module.Course
var list= course_OfferRepository.GetCourseOfferPageRepository(pageIndex, pageSize, out rowsCount, query); var list= course_OfferRepository.GetCourseOfferPageRepository(pageIndex, pageSize, out rowsCount, query);
if (query.IsGetDetails == 1 && list != null && list.Count > 0) if (query.IsGetDetails == 1 && list != null && list.Count > 0)
{ {
string ids = string.Join(",", list.Select(qitem => qitem.Id)); //报价单编号
string offids = string.Join(",", list.Select(qitem => qitem.Id));
var detailsList = new List<RB_Course_OfferDetails_ViewModel>(); var detailsList = new List<RB_Course_OfferDetails_ViewModel>();
if (!string.IsNullOrEmpty(ids)) if (!string.IsNullOrEmpty(offids))
{ {
detailsList = GetCourseOfferDetailsListModule(new RB_Course_OfferDetails_ViewModel() { QOfferIds = ids }); detailsList = GetCourseOfferDetailsListModule(new RB_Course_OfferDetails_ViewModel() { QOfferIds = offids });
} }
foreach (var item in list) foreach (var item in list)
{ {
...@@ -222,18 +234,45 @@ namespace Edu.Module.Course ...@@ -222,18 +234,45 @@ namespace Edu.Module.Course
{ {
string ids = string.Join(",", model.OfferDetails.Select(qitem => qitem.CourseId)); string ids = string.Join(",", model.OfferDetails.Select(qitem => qitem.CourseId));
List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>(); List<RB_Course_ViewModel> courseList = new List<RB_Course_ViewModel>();
if (!string.IsNullOrEmpty(ids)) if (model.OfferType == OfferTypeEnum.Course)
{ {
courseList= courseModule.GetCourseListModule(new RB_Course_ViewModel() if (!string.IsNullOrEmpty(ids))
{ {
IsQPrice = 1, courseList = courseModule.GetCourseListModule(new RB_Course_ViewModel()
QCourseIds = ids, {
Group_Id=model.Group_Id, IsQPrice = 1,
}); QCourseIds = ids,
Group_Id = model.Group_Id,
});
}
foreach (var item in model.OfferDetails)
{
item.SourceData = courseList?.Where(qitem => qitem.CourseId == item.CourseId)?.FirstOrDefault() ?? new RB_Course_ViewModel();
}
} }
foreach (var item in model.OfferDetails) else
{ {
item.SourceData = courseList?.Where(qitem => qitem.CourseId == item.CourseId)?.FirstOrDefault() ?? new RB_Course_ViewModel(); var studyList = studyAbroadRepository.GetStudyAbroadListRepository(new Model.ViewModel.StudyAbroad.RB_StudyAbroad_ViewModel()
{
QIds = ids
});
if (studyList != null && studyList.Count > 0)
{
string studyIds = string.Join(",", studyList.Select(qitem => qitem.Id));
var detailsList = studyaBroad_PreferentialRepository.GetStudyaBroadPreferentialListRepostory(new Model.ViewModel.StudyAbroad.RB_StudyaBroad_Preferential_ViewModel()
{
QStudyabroadIds = studyIds
});
foreach (var item in studyList)
{
item.PreferentialList = detailsList?.Where(qitem => qitem.StudyabroadId == item.Id)?.ToList() ?? new List<Model.ViewModel.StudyAbroad.RB_StudyaBroad_Preferential_ViewModel>();
}
}
foreach (var item in model.OfferDetails)
{
item.SourceData = studyList?.Where(qitem => qitem.Id == item.CourseId)?.FirstOrDefault() ?? new Model.ViewModel.StudyAbroad.RB_StudyAbroad_ViewModel();
}
} }
} }
} }
......
...@@ -23,8 +23,16 @@ namespace Edu.Repository.Course ...@@ -23,8 +23,16 @@ namespace Edu.Repository.Course
var parameters = new DynamicParameters(); var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" builder.AppendFormat(@"
SELECT A.*,IFNULL(B.CourseName,'') AS CourseName,IFNULL(B.SellPrice,0) AS SellPrice SELECT * FROM
FROM RB_Course_OfferDetails AS A LEFT JOIN rb_course AS B ON A.CourseId=B.CourseId (
SELECT A.*,IFNULL(C.CourseName,'') AS CourseName,IFNULL(C.SellPrice,0) AS SellPrice
FROM RB_Course_OfferDetails AS A INNER JOIN rb_course_offer AS B ON A.OfferId=B.Id
INNER JOIN rb_course AS C ON (A.CourseId=C.CourseId AND B.OfferType=1 )
UNION ALL
SELECT A.*,IFNULL(C.`Name`,'') AS CourseName,IFNULL(C.SellPrice,0) AS SellPrice
FROM RB_Course_OfferDetails AS A INNER JOIN rb_course_offer AS B ON A.OfferId=B.Id
INNER JOIN rb_studyabroad AS C ON (A.CourseId=C.Id AND B.OfferType<>1)
) AS A
WHERE 1=1 WHERE 1=1
"); ");
if (query == null) if (query == null)
...@@ -33,10 +41,6 @@ WHERE 1=1 ...@@ -33,10 +41,6 @@ WHERE 1=1
} }
else else
{ {
if (query.CourseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_OfferDetails_ViewModel.CourseId), query.CourseId);
}
if (query.OfferId > 0) if (query.OfferId > 0)
{ {
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_OfferDetails_ViewModel.OfferId), query.OfferId); builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Course_OfferDetails_ViewModel.OfferId), query.OfferId);
......
...@@ -118,6 +118,7 @@ WHERE 1=1 ...@@ -118,6 +118,7 @@ WHERE 1=1
OR (A.DirectorStatus>0 AND A.DirectorId={0}) OR (A.DirectorStatus>0 AND A.DirectorId={0})
)", query.AuditManId); )", query.AuditManId);
} }
return GetPage<RB_StudyAbroad_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList(); return GetPage<RB_StudyAbroad_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
} }
} }
...@@ -152,6 +153,14 @@ WHERE 1=1 ...@@ -152,6 +153,14 @@ WHERE 1=1
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_StudyAbroad_ViewModel.Name)); builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_StudyAbroad_ViewModel.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%"); parameters.Add("Name", "%" + query.Name.Trim() + "%");
} }
if (query.SaleState > 0)
{
builder.AppendFormat(" AND A.{0}={1}", nameof(RB_StudyAbroad_ViewModel.SaleState), (int)query.SaleState);
}
if (!string.IsNullOrEmpty(query.QIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_StudyAbroad_ViewModel.Id), query.QIds);
}
return Get<RB_StudyAbroad_ViewModel>(builder.ToString(), parameters).ToList(); return Get<RB_StudyAbroad_ViewModel>(builder.ToString(), parameters).ToList();
} }
} }
......
...@@ -361,7 +361,8 @@ namespace Edu.WebApi.Controllers.StudyAbroad ...@@ -361,7 +361,8 @@ namespace Edu.WebApi.Controllers.StudyAbroad
{ {
Name = base.ParmJObj.GetStringValue("Name"), Name = base.ParmJObj.GetStringValue("Name"),
Type = base.ParmJObj.GetInt("Type"), Type = base.ParmJObj.GetInt("Type"),
IsQPrice = base.ParmJObj.GetInt("IsQPrice") IsQPrice = base.ParmJObj.GetInt("IsQPrice"),
SaleState=(SaleStateEnum)base.ParmJObj.GetInt("SaleState"),
}; };
query.Group_Id = base.UserInfo.Group_Id; query.Group_Id = base.UserInfo.Group_Id;
query.School_Id = base.UserInfo.School_Id; query.School_Id = base.UserInfo.School_Id;
......
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