q
This commit is contained in:
parent
e836c3337f
commit
b2ec2819a9
@ -2,18 +2,20 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
using Microsoft.AspNetCore.Identity;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using Manganese.Array;
|
||||||
|
|
||||||
namespace asg_form.Controllers {
|
namespace asg_form.Controllers {
|
||||||
public class FileDB
|
public class FileDB
|
||||||
{
|
{
|
||||||
public string proj_name { get; set; }
|
public string proj_name { get; set; }
|
||||||
public string proj_no { get; set; }
|
public string proj_no { get; set; }
|
||||||
public string budget_use { get; set; }
|
public string? budget_use { get; set; }
|
||||||
public string budget_name { get; set; }
|
public string? budget_name { get; set; }
|
||||||
public string biz_type { get; set; }
|
public string biz_type { get; set; }
|
||||||
public int budget_id { get; set; }
|
public int? budget_id { get; set; }
|
||||||
public string start_time { get; set; }
|
public string start_time { get; set; }
|
||||||
public decimal budget_money { get; set; }
|
public decimal budget_money { get; set; }
|
||||||
|
public int start_person_id { get; set; }
|
||||||
public string start_person { get; set; }
|
public string start_person { get; set; }
|
||||||
public string now_auth_person { get; set; }
|
public string now_auth_person { get; set; }
|
||||||
public int now_auth_person_id { get; set; }
|
public int now_auth_person_id { get; set; }
|
||||||
@ -34,6 +36,7 @@ namespace asg_form.Controllers {
|
|||||||
public int budgetId { get; set; }
|
public int budgetId { get; set; }
|
||||||
public string startTime { get; set; }
|
public string startTime { get; set; }
|
||||||
public decimal budgetMoney { get; set; }
|
public decimal budgetMoney { get; set; }
|
||||||
|
public int startPersonId { get; set; }
|
||||||
public string startPerson { get; set; }
|
public string startPerson { get; set; }
|
||||||
public string nowAuthPerson { get; set; }
|
public string nowAuthPerson { get; set; }
|
||||||
public int nowAuthPersonId { get; set; }
|
public int nowAuthPersonId { get; set; }
|
||||||
@ -90,6 +93,7 @@ namespace asg_form.Controllers {
|
|||||||
au.supplementary_info = auditinfo.supplementaryInfo;
|
au.supplementary_info = auditinfo.supplementaryInfo;
|
||||||
au.description = auditinfo.description;
|
au.description = auditinfo.description;
|
||||||
au.reason = auditinfo.reason;
|
au.reason = auditinfo.reason;
|
||||||
|
au.start_person_id = auditinfo.startPersonId;
|
||||||
sub.SaveChanges();
|
sub.SaveChanges();
|
||||||
return Ok(new { code = 200, message = "成功修改" });
|
return Ok(new { code = 200, message = "成功修改" });
|
||||||
}
|
}
|
||||||
@ -111,7 +115,8 @@ namespace asg_form.Controllers {
|
|||||||
now_auth_person_id = auditinfo.nowAuthPersonId,
|
now_auth_person_id = auditinfo.nowAuthPersonId,
|
||||||
supplementary_info = auditinfo.supplementaryInfo,
|
supplementary_info = auditinfo.supplementaryInfo,
|
||||||
description = auditinfo.description,
|
description = auditinfo.description,
|
||||||
reason = auditinfo.reason
|
reason = auditinfo.reason,
|
||||||
|
start_person_id = auditinfo.startPersonId,
|
||||||
};
|
};
|
||||||
|
|
||||||
sub.T_Audit.Add(newAudit);
|
sub.T_Audit.Add(newAudit);
|
||||||
@ -127,7 +132,7 @@ namespace asg_form.Controllers {
|
|||||||
[Route("api/v1/admin/AuditFind")]
|
[Route("api/v1/admin/AuditFind")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<ActionResult<object>> auditFind([FromQuery] string archive,string projName,string projNo,string bizType,string startPerson,string budgetUse, short page = 1, short limit = 10)
|
public async Task<ActionResult<object>> auditFind([FromQuery] string archive="",string projName = "", string projNo = "", string bizType = "", string startPerson = "", string budgetUse = "", short page = 1, short limit = 10)
|
||||||
{
|
{
|
||||||
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
string userId = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value;
|
||||||
var user = await userManager.FindByIdAsync(userId);
|
var user = await userManager.FindByIdAsync(userId);
|
||||||
@ -138,8 +143,11 @@ namespace asg_form.Controllers {
|
|||||||
}
|
}
|
||||||
using (TestDbContext sub = new TestDbContext())
|
using (TestDbContext sub = new TestDbContext())
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
var query = sub.T_Audit
|
var query = sub.T_Audit
|
||||||
.Where(n => n.proj_name.Contains(projName) || n.proj_no.Contains(projNo) || n.biz_type.Contains(bizType) || n.start_person.Contains(startPerson) || n.budget_use.Contains(budgetUse));
|
.Where(n => n.proj_name.Contains(projName) || n.proj_no.Contains(projNo) || n.biz_type.Contains(bizType) || n.start_person.Contains(startPerson) || n.budget_use.Contains(budgetUse)).AsQueryable();
|
||||||
|
|
||||||
if (archive == "1")
|
if (archive == "1")
|
||||||
{
|
{
|
||||||
var rows = query
|
var rows = query
|
||||||
@ -149,26 +157,31 @@ namespace asg_form.Controllers {
|
|||||||
int total = query.Count();
|
int total = query.Count();
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
rows = query,
|
rows,
|
||||||
total = total,
|
total,
|
||||||
};
|
};
|
||||||
return Ok(new { code = 200, message = "", data });
|
return Ok(new { code = 200, message = "", data });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var rows = query
|
var rows = query
|
||||||
.Where(n => n.now_auth_person_id == (int)(user.Id))
|
.Where(n =>n.now_auth_person_id ==(int)user.Id)
|
||||||
.Skip((page - 1) * limit)
|
.Skip((page - 1) * limit)
|
||||||
.Take(limit)
|
.Take(limit)
|
||||||
.ToList();
|
.ToList();
|
||||||
int total = query.Count();
|
int total = query.Count();
|
||||||
var data = new
|
var data = new
|
||||||
{
|
{
|
||||||
rows = query,
|
rows,
|
||||||
total = total,
|
total,
|
||||||
};
|
};
|
||||||
return Ok(new { code = 200, message = "", data });
|
return Ok(new { code = 200, message = "", data });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Ok(new { code = 500, message = "服务器错误", ex });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user