This commit is contained in:
王炜翔 2024-10-05 12:05:36 +08:00
parent 3e1995bf3d
commit f2778426b3

View File

@ -84,7 +84,7 @@ namespace asg_form.Controllers.Budget
used_event_id = msg.usedEventId,
use_status = "0",
update_person = msg.updatePerson,
update_time = dateString,
update_time = null,
};
sub.budgetDetails.Add(budget);
await sub.SaveChangesAsync();
@ -185,7 +185,7 @@ namespace asg_form.Controllers.Budget
}
catch (Exception ex)
{
return StatusCode(500, new { code = 500, message = "服务器错误", details = ex.Message });
return Ok(new { code = 500, message = "服务器错误", details = ex.Message });
}
}
@ -211,8 +211,9 @@ namespace asg_form.Controllers.Budget
using (var db = new TestDbContext())
{
var budgetTotals = await (from e in db.events
join b in db.budgetDetails on e.Id equals b.source_event_id
group b by new
join b in db.budgetDetails on e.Id equals b.source_event_id into budgetGroup
from bg in budgetGroup.DefaultIfEmpty()
group bg by new
{
e.Id,
e.name
@ -221,7 +222,7 @@ namespace asg_form.Controllers.Budget
{
sourceEventId = g.Key.Id,
sourceEventName = g.Key.name,
budgetTotalMoney = g.Sum(b => b.budget_money)
budgetTotalMoney = g.Sum(b => b == null ? 0 : b.budget_money)
}).ToListAsync();
return Ok(new