Commit 0e85ee53 authored by liudong1993's avatar liudong1993

1

parent d8357e37
bin/ bin/
obj/ obj/
.vs/ .vs/
EduSpider.WebApi/EduSpider.WebApi.csproj.user
EduSpider.WebApi/Properties/PublishProfiles/FolderProfile.pubxml.user
...@@ -14,6 +14,11 @@ namespace EduSpider.Model.Extend ...@@ -14,6 +14,11 @@ namespace EduSpider.Model.Extend
/// </summary> /// </summary>
public int StuNum { get; set; } public int StuNum { get; set; }
/// <summary>
/// 导入失败数量
/// </summary>
public int FailNum { get; set; }
/// <summary> /// <summary>
/// 总分数 /// 总分数
/// </summary> /// </summary>
......
...@@ -40,9 +40,9 @@ namespace EduSpider.Repository ...@@ -40,9 +40,9 @@ namespace EduSpider.Repository
where += $@" and e.{nameof(RB_Exam_Extend.CreateBy)} ={demodel.CreateBy}"; where += $@" and e.{nameof(RB_Exam_Extend.CreateBy)} ={demodel.CreateBy}";
} }
string sql = $@"select e.*,es.StuNum,es.TScore FROM rb_exam e string sql = $@"select e.*,es.StuNum,es.TScore,es.FailNum FROM rb_exam e
LEFT JOIN ( LEFT JOIN (
SELECT e.ExamId,COUNT(0) as StuNum,SUM(e.TScore) as TScore FROM rb_exam_score e GROUP BY e.ExamId SELECT e.ExamId,COUNT(0) as StuNum,SUM(e.TScore) as TScore,sum(case when e.StuId=0 then 1 else 0 end) as FailNum FROM rb_exam_score e GROUP BY e.ExamId
) es on e.ExamId = es.ExamId ) es on e.ExamId = es.ExamId
where {where} order by e.ExamId desc"; where {where} order by e.ExamId desc";
return GetPage<RB_Exam_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList(); return GetPage<RB_Exam_Extend>(pageIndex, pageSize, out count, sql, parameters).ToList();
......
...@@ -40,6 +40,7 @@ namespace EduSpider.WebApi.Controllers ...@@ -40,6 +40,7 @@ namespace EduSpider.WebApi.Controllers
x.ExamName, x.ExamName,
x.CourseId, x.CourseId,
x.StuNum, x.StuNum,
x.FailNum,
x.TScore, x.TScore,
AvgScore = x.StuNum > 0 ? Math.Round(x.TScore / x.StuNum, 2, MidpointRounding.AwayFromZero) : 0, AvgScore = x.StuNum > 0 ? Math.Round(x.TScore / x.StuNum, 2, MidpointRounding.AwayFromZero) : 0,
CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm") CreateTime = x.CreateTime.ToString("yyyy-MM-dd HH:mm")
......
...@@ -45,10 +45,12 @@ namespace EduSpider.WebApi.Controllers ...@@ -45,10 +45,12 @@ namespace EduSpider.WebApi.Controllers
string password = jobj.GetString("Password"); string password = jobj.GetString("Password");
string UnionId = jobj.GetString("UnionId"); string UnionId = jobj.GetString("UnionId");
string OpenId = jobj.GetString("OpenId"); string OpenId = jobj.GetString("OpenId");
int AccountType = jobj.GetInt("AccountType", 1);
var model = AccountService.GetAccountList(new RB_Account_Extend() var model = AccountService.GetAccountList(new RB_Account_Extend()
{ {
Account = account.Trim() Account = account.Trim(),
AccountType = (Utility.Enum.AccountTypeEnum)AccountType
}).FirstOrDefault(); }).FirstOrDefault();
if (model == null) if (model == null)
{ {
...@@ -117,10 +119,13 @@ namespace EduSpider.WebApi.Controllers ...@@ -117,10 +119,13 @@ namespace EduSpider.WebApi.Controllers
{ {
return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 }); return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 });
} }
int AccountType = jobj.GetInt("AccountType", 1);
var model = AccountService.GetAccountList(new RB_Account_Extend() var model = AccountService.GetAccountList(new RB_Account_Extend()
{ {
Account = account.Trim() Account = account.Trim(),
})?.FirstOrDefault(); AccountType = (Utility.Enum.AccountTypeEnum)AccountType
}).FirstOrDefault();
if (model == null) if (model == null)
{ {
return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 }); return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 });
...@@ -293,10 +298,13 @@ namespace EduSpider.WebApi.Controllers ...@@ -293,10 +298,13 @@ namespace EduSpider.WebApi.Controllers
{ {
return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 }); return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 });
} }
int AccountType = parms.GetInt("AccountType", 1);
var model = AccountService.GetAccountList(new RB_Account_Extend() var model = AccountService.GetAccountList(new RB_Account_Extend()
{ {
Account = account.Trim() Account = account.Trim(),
})?.FirstOrDefault(); AccountType = (Utility.Enum.AccountTypeEnum)AccountType
}).FirstOrDefault();
if (model == null) if (model == null)
{ {
return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 }); return ApiResult.Failed(message: "手机号码登录失败、跳转至账号登录", new { Error = -1 });
......
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