q
This commit is contained in:
		
							parent
							
								
									e836c3337f
								
							
						
					
					
						commit
						b2ec2819a9
					
				@ -2,18 +2,20 @@
 | 
			
		||||
using Microsoft.AspNetCore.Identity;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
using System.Security.Claims;
 | 
			
		||||
using Manganese.Array;
 | 
			
		||||
 | 
			
		||||
namespace asg_form.Controllers {
 | 
			
		||||
    public class FileDB
 | 
			
		||||
    {
 | 
			
		||||
        public string proj_name { get; set; }
 | 
			
		||||
        public string proj_no { get; set; }
 | 
			
		||||
        public string budget_use { get; set; }
 | 
			
		||||
        public string budget_name { get; set; }
 | 
			
		||||
        public string? budget_use { get; set; }
 | 
			
		||||
        public string? budget_name { 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 decimal budget_money { get; set; }
 | 
			
		||||
        public int start_person_id { get; set; }
 | 
			
		||||
        public string start_person { get; set; }
 | 
			
		||||
        public string now_auth_person { get; set; }
 | 
			
		||||
        public int now_auth_person_id { get; set; }
 | 
			
		||||
@ -34,6 +36,7 @@ namespace asg_form.Controllers {
 | 
			
		||||
        public int budgetId { get; set; }
 | 
			
		||||
        public string startTime { get; set; }
 | 
			
		||||
        public decimal budgetMoney { get; set; }
 | 
			
		||||
        public int startPersonId { get; set; }
 | 
			
		||||
        public string startPerson { get; set; }
 | 
			
		||||
        public string nowAuthPerson { get; set; }
 | 
			
		||||
        public int nowAuthPersonId { get; set; }
 | 
			
		||||
@ -90,6 +93,7 @@ namespace asg_form.Controllers {
 | 
			
		||||
                    au.supplementary_info = auditinfo.supplementaryInfo;
 | 
			
		||||
                    au.description = auditinfo.description;
 | 
			
		||||
                    au.reason = auditinfo.reason;
 | 
			
		||||
                    au.start_person_id = auditinfo.startPersonId;
 | 
			
		||||
                    sub.SaveChanges();
 | 
			
		||||
                    return Ok(new { code = 200, message = "成功修改" });
 | 
			
		||||
                }
 | 
			
		||||
@ -111,7 +115,8 @@ namespace asg_form.Controllers {
 | 
			
		||||
                        now_auth_person_id = auditinfo.nowAuthPersonId,
 | 
			
		||||
                        supplementary_info = auditinfo.supplementaryInfo,
 | 
			
		||||
                        description = auditinfo.description,
 | 
			
		||||
                        reason = auditinfo.reason
 | 
			
		||||
                        reason = auditinfo.reason,
 | 
			
		||||
                        start_person_id = auditinfo.startPersonId,
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    sub.T_Audit.Add(newAudit);
 | 
			
		||||
@ -127,7 +132,7 @@ namespace asg_form.Controllers {
 | 
			
		||||
        [Route("api/v1/admin/AuditFind")]
 | 
			
		||||
        [HttpGet]
 | 
			
		||||
        [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;
 | 
			
		||||
            var user = await userManager.FindByIdAsync(userId);
 | 
			
		||||
@ -137,9 +142,12 @@ namespace asg_form.Controllers {
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            using (TestDbContext sub = new TestDbContext())
 | 
			
		||||
            {
 | 
			
		||||
                try
 | 
			
		||||
                {
 | 
			
		||||
                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")
 | 
			
		||||
                {
 | 
			
		||||
                    var rows = query
 | 
			
		||||
@ -149,27 +157,32 @@ namespace asg_form.Controllers {
 | 
			
		||||
                    int total = query.Count();
 | 
			
		||||
                    var data = new
 | 
			
		||||
                    {
 | 
			
		||||
                        rows = query,
 | 
			
		||||
                        total = total,
 | 
			
		||||
                        rows,
 | 
			
		||||
                        total,
 | 
			
		||||
                    };
 | 
			
		||||
                    return Ok(new { code = 200, message = "", data });
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    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)
 | 
			
		||||
                        .Take(limit)
 | 
			
		||||
                        .ToList();
 | 
			
		||||
                        int total = query.Count();
 | 
			
		||||
                    var data = new
 | 
			
		||||
                    {
 | 
			
		||||
                        rows = query,
 | 
			
		||||
                        total = total,
 | 
			
		||||
                        rows,
 | 
			
		||||
                        total,
 | 
			
		||||
                    };
 | 
			
		||||
                    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