初始化项目

This commit is contained in:
2025-11-20 11:03:29 +08:00
commit 86785bb77f
988 changed files with 325041 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System.Diagnostics;
using AUTS_Server.Models;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace AUTS_Server.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly ISqlSugarClient db;
public HomeController(ILogger<HomeController> logger, ISqlSugarClient db)
{
_logger = logger;
this.db = db;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}

View File

@@ -0,0 +1,225 @@
using AUTS_Server.Models;
using AUTS_Server.Service;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using uts_manage;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace AUTS_Server.Controllers
{
[Route("ILogin")]
[ApiController]
public class ILonginController : ControllerBase
{
private readonly ISqlSugarClient db;
private readonly IEncryptionService encryptionService;
public readonly IUserOperationLog userOperationLog;
private readonly ILogHelperForService log;
public ILonginController(ISqlSugarClient db, IEncryptionService encryptionService, IUserOperationLog userOperationLog, ILogHelperForService log)
{
this.db = db;
this.encryptionService = encryptionService;
this.userOperationLog = userOperationLog;
this.log = log;
}
/// <summary>
/// 登录接口
/// </summary>
/// <param name="user"></param>
/// <returns></returns>
[HttpPost]
[Route("Login")]
public Returninfo Longin([FromBody] uts_manage_user user)
{
Returninfo rinfo = new Returninfo();
try
{
//密码加密
user.Password = encryptionService.Encrypt(encryptionService.Encrypt(user.Password));
tbl_uts_manage_user list = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_user>().Where(it => it.UserName == user.UserName && it.Password == user.Password).First();
if (list != null)
{
if (list.IsValid == 1)
{
//获取用户权限
//List<tbl_uts_manage_userauth_operation> listauth = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_userauth_operation>().Where(it => it.UserID == list.ID).ToList();
#region
string userAgent = Request.Headers["User-Agent"].ToString();
string Device;
//var userAgent = Request.UserAgent;
bool
_windows = userAgent.Contains("Windows NT"),
_mac = userAgent.Contains("Macintosh"),
_iphone = userAgent.Contains("iPhone"),
_android = userAgent.Contains("Android")
;
if (_windows)
{
Device = "windows";
}
else if (_mac)
{
Device = "Mac";
}
else if (_iphone)
{
Device = "ios";
}
else if (_android)
{
Device = "Android";
}
else
{
Device = "未知";
}
userOperationLog.UserLog("登录", Device, user.UserName);
#endregion
//return true;
rinfo.status = 200;
rinfo.message = "登录成功";
rinfo.isok = true;
//rinfo.data = list;
}
else
{
rinfo.status = 600;
rinfo.message = "用户被禁用";
rinfo.isok = false;
}
}
else
{
rinfo.status = 600;
rinfo.message = "用户名或密码错误";
rinfo.isok = false;
}
}
catch (Exception ex)
{
rinfo.status = 500;
rinfo.message = "系统异常";
rinfo.isok = false;
log.WriteLine("登录接口异常:" + ex.Message);
}
return rinfo;
}
/// <summary>
/// 修改密码接口
/// </summary>
/// <param name="upwd"></param>
[HttpPost]
[Route("UpdataPassword")]
public Returninfo UpdataPassword([FromBody] uppwd upwd)
{
Returninfo rinfo = new Returninfo();
try
{
upwd.oldpassword = encryptionService.Encrypt(encryptionService.Encrypt(upwd.oldpassword));
tbl_uts_manage_user list = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_user>().First(x => x.UserName == upwd.username && x.Password == upwd.oldpassword);
if (list != null)
{
list.Password = encryptionService.Encrypt(encryptionService.Encrypt(upwd.newpassword));
list.PlaintextPwd = upwd.newpassword;
int count = db.AsTenant().GetConnection(0).Updateable(list).Where(x => x.ID == list.ID).ExecuteCommand();
if (count > 0)
{
rinfo.message = "修改密码成功";
rinfo.isok = true;
rinfo.status = 200;
}
else
{
rinfo.message = "修改密码息失败";
rinfo.isok = false;
rinfo.status = 100;
}
}
else
{
rinfo.message = "没有查找到这个用户的信息";
rinfo.isok = false;
rinfo.status = 404;
}
}
catch (Exception ex)
{
rinfo.message = ex.Message;
rinfo.isok = false;
rinfo.status = 500;
log.WriteLine("修改密码接口异常:"+ex.Message);
}
return rinfo;
}
/// <summary>
/// 重置密码接口
/// </summary>
/// <param name="id"></param>
[HttpPost]
[Route("ResetPassword")]
public Returninfo ResetPassword([FromBody] int id)
{
Returninfo rinfo = new Returninfo();
try
{
tbl_uts_manage_user list = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_user>().First(x => x.ID == id);
if (list != null)
{
list.Password = encryptionService.Encrypt(encryptionService.Encrypt("123456"));
list.PlaintextPwd="123456";
int count = db.AsTenant().GetConnection(0).Updateable(list).Where(x => x.ID == list.ID).ExecuteCommand();
if (count > 0)
{
rinfo.message = "重置密码成功";
rinfo.isok = true;
rinfo.status = 200;
}
else
{
rinfo.message = "重置密码息失败";
rinfo.isok = false;
rinfo.status = 100;
}
}
else
{
rinfo.message = "没有查找到这个用户的信息";
rinfo.isok = false;
rinfo.status = 404;
}
}
catch (Exception ex)
{
rinfo.message = ex.Message;
rinfo.isok = false;
rinfo.status = 500;
log.WriteLine("重置密码接口异常:" + ex.Message);
}
return rinfo;
}
}
public class uts_manage_user
{
public string UserName { get; set; }
public string Password { get; set; }
}
public class uppwd
{
public string newpassword { get; set; }
public string oldpassword { get; set; }
//public int id { get; set; }
public string username { get; set; }
}
}

View File

@@ -0,0 +1,563 @@
using AUTS_Server.Models;
using AUTS_Server.Service;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using ProjectIntegration;
using SqlSugar;
using System.Security.Cryptography;
using uts_bomei;
using uts_manage;
using XAct.Users;
namespace AUTS_Server.Controllers
{
[Route("ITblShipping")]
[ApiController]
public class ITblShippingController : ControllerBase
{
private readonly ISqlSugarClient db;
private readonly ILogHelperForService log;
public ITblShippingController(ISqlSugarClient db, ILogHelperForService log)
{
this.db = db;
this.log = log;
}
/// <summary>
/// 添加或更新出货单
/// </summary>
/// <param name="shipping"></param>
[HttpPost]
[Route("AddOrUpdateShipping")]
public Returninfo AddOrUpdateShipping([FromBody] JudgeTheDatabase shipping)
{
Returninfo rinfo = new Returninfo();
try
{
switch (shipping.JudgeDatabase)
{
case "uts_bomei":
if (shipping.ID == 0)
{
//添加
tbl_shipping tblshipping = shipping;
tblshipping.CreateDateTime = DateTime.Now;
int result = db.AsTenant().GetConnection(4).Insertable<tbl_shipping>(tblshipping).ExecuteCommand();
if (result > 0)
{
//添加成功
rinfo.status = 200;
rinfo.message = "添加成功";
rinfo.isok = true;
}
else
{
//添加失败
rinfo.status = 400;
rinfo.message = "添加失败";
rinfo.isok = false;
}
}
else
{
//修改
tbl_shipping list = db.AsTenant().GetConnection(4).Queryable<tbl_shipping>().Where(it => it.ID == shipping.ID).First();
if (list != null)
{
list.ShippingCode = shipping.ShippingCode;
list.Destination = shipping.Destination;
list.Voucher = shipping.Voucher;
list.Remark = shipping.Remark;
list.UpdateTime = DateTime.Now;
list.Status = shipping.Status;
list.ShippingType = shipping.ShippingType;
list.ProjectID = shipping.ProjectID;
list.QTY = shipping.QTY;
list.MO = shipping.MO;
list.Customer = shipping.Customer;
list.BindedColorBoxQTY = shipping.BindedColorBoxQTY;
list.Loader = shipping.Loader;
list.EndDateTime = shipping.EndDateTime;
list.StartDateTime = shipping.StartDateTime;
list.Creator = shipping.Creator;
list.ShippingCode = shipping.ShippingCode;
list.CreateDateTime = shipping.CreateDateTime;
int result = db.AsTenant().GetConnection(4).Updateable(list).Where(it => it.ID == shipping.ID).ExecuteCommand();
if (result > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "修改成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "修改失败";
rinfo.isok = false;
}
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "没有找到该记录";
rinfo.isok = false;
}
}
break;
case "uts_dtl":
if (shipping.ID == 0)
{
//添加
tbl_shipping tblshipping = shipping;
tblshipping.CreateDateTime = DateTime.Now;
int result = db.AsTenant().GetConnection(3).Insertable<tbl_shipping>(tblshipping).ExecuteCommand();
if (result > 0)
{
//添加成功
rinfo.status = 200;
rinfo.message = "添加成功";
rinfo.isok = true;
}
else
{
//添加失败
rinfo.status = 400;
rinfo.message = "添加失败";
rinfo.isok = false;
}
}
else
{
//修改
tbl_shipping list = db.AsTenant().GetConnection(3).Queryable<tbl_shipping>().Where(it => it.ID == shipping.ID).First();
if (list != null)
{
list.ShippingCode = shipping.ShippingCode;
list.Destination = shipping.Destination;
list.Voucher = shipping.Voucher;
list.Remark = shipping.Remark;
list.UpdateTime = DateTime.Now;
list.Status = shipping.Status;
list.ShippingType = shipping.ShippingType;
list.ProjectID = shipping.ProjectID;
list.QTY = shipping.QTY;
list.MO = shipping.MO;
list.Customer = shipping.Customer;
list.BindedColorBoxQTY = shipping.BindedColorBoxQTY;
list.Loader = shipping.Loader;
list.EndDateTime = shipping.EndDateTime;
list.StartDateTime = shipping.StartDateTime;
list.Creator = shipping.Creator;
list.ShippingCode = shipping.ShippingCode;
list.CreateDateTime = shipping.CreateDateTime;
int result = db.AsTenant().GetConnection(3).Updateable(list).Where(it => it.ID == shipping.ID).ExecuteCommand();
if (result > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "修改成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "修改失败";
rinfo.isok = false;
}
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
}
break;
case "uts_inhaos":
if (shipping.ID == 0)
{
//添加
tbl_shipping tblshipping = shipping;
tblshipping.CreateDateTime = DateTime.Now;
int result = db.AsTenant().GetConnection(2).Insertable<tbl_shipping>(tblshipping).ExecuteCommand();
if (result > 0)
{
//添加成功
rinfo.status = 200;
rinfo.message = "添加成功";
rinfo.isok = true;
}
else
{
//添加失败
rinfo.status = 400;
rinfo.message = "添加失败";
rinfo.isok = false;
}
}
else
{
//修改
tbl_shipping list = db.AsTenant().GetConnection(2).Queryable<tbl_shipping>().Where(it => it.ID == shipping.ID).First();
if (list != null)
{
list.ShippingCode = shipping.ShippingCode;
list.Destination = shipping.Destination;
list.Voucher = shipping.Voucher;
list.Remark = shipping.Remark;
list.UpdateTime = DateTime.Now;
list.Status = shipping.Status;
list.ShippingType = shipping.ShippingType;
list.ProjectID = shipping.ProjectID;
list.QTY = shipping.QTY;
list.MO = shipping.MO;
list.Customer = shipping.Customer;
list.BindedColorBoxQTY = shipping.BindedColorBoxQTY;
list.Loader = shipping.Loader;
list.EndDateTime = shipping.EndDateTime;
list.StartDateTime = shipping.StartDateTime;
list.Creator = shipping.Creator;
list.ShippingCode = shipping.ShippingCode;
list.CreateDateTime = shipping.CreateDateTime;
int result = db.AsTenant().GetConnection(2).Updateable(list).Where(it => it.ID == shipping.ID).ExecuteCommand();
if (result > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "修改成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "修改失败";
rinfo.isok = false;
}
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
}
break;
case "uts_zongqing":
if (shipping.ID == 0)
{
//添加
tbl_shipping tblshipping = shipping;
tblshipping.CreateDateTime = DateTime.Now;
int result = db.AsTenant().GetConnection(1).Insertable<tbl_shipping>(tblshipping).ExecuteCommand();
if (result > 0)
{
//添加成功
rinfo.status = 200;
rinfo.message = "添加成功";
rinfo.isok = true;
}
else
{
//添加失败
rinfo.status = 400;
rinfo.message = "添加失败";
rinfo.isok = false;
}
}
else
{
//修改
tbl_shipping list = db.AsTenant().GetConnection(1).Queryable<tbl_shipping>().Where(it => it.ID == shipping.ID).First();
if (list != null)
{
list.ShippingCode = shipping.ShippingCode;
list.Destination = shipping.Destination;
list.Voucher = shipping.Voucher;
list.Remark = shipping.Remark;
list.UpdateTime = DateTime.Now;
list.Status = shipping.Status;
list.ShippingType = shipping.ShippingType;
list.ProjectID = shipping.ProjectID;
list.QTY = shipping.QTY;
list.MO = shipping.MO;
list.Customer = shipping.Customer;
list.BindedColorBoxQTY = shipping.BindedColorBoxQTY;
list.Loader = shipping.Loader;
list.EndDateTime = shipping.EndDateTime;
list.StartDateTime = shipping.StartDateTime;
list.Creator = shipping.Creator;
list.ShippingCode = shipping.ShippingCode;
list.CreateDateTime = shipping.CreateDateTime;
int result = db.AsTenant().GetConnection(1).Updateable(list).Where(it => it.ID == shipping.ID).ExecuteCommand();
if (result > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "修改成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "修改失败";
rinfo.isok = false;
}
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
}
break;
default:
rinfo.status = 400;
rinfo.message = "没有找到该数据库";
rinfo.isok = false;
break;
}
}
catch (Exception ex)
{
rinfo.status = 400;
rinfo.message = "系统异常";
rinfo.isok = false;
log.WriteLine("添加修改"+shipping.JudgeDatabase + "出货单信息失败,错误信息为:" + ex.Message);
}
return rinfo;
}
/// <summary>
/// 删除出货单接口
/// </summary>
/// <param name="determine"></param>
/// <returns></returns>
[HttpPost]
[Route("DeleteShipping")]
public Returninfo DeleteShipping([FromBody] DetermineTheDatabase determine)
{
Returninfo rinfo = new Returninfo();
try
{
switch (determine.JudgeDatabase)
{
case "uts_bomei":
tbl_shipping blist = db.AsTenant().GetConnection(4).Queryable<tbl_shipping>().Where(x => x.ID == determine.id).First();
if (blist != null)
{
int countss = db.AsTenant().GetConnection(4).Deleteable(blist).Where(x => x.ID == blist.ID).ExecuteCommand();
if (countss > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "删除成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "删除失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
break;
case "uts_dtl":
tbl_shipping dlist = db.AsTenant().GetConnection(3).Queryable<tbl_shipping>().Where(x => x.ID == determine.id).First();
if (dlist != null)
{
int countss = db.AsTenant().GetConnection(3).Deleteable(dlist).Where(x => x.ID == dlist.ID).ExecuteCommand();
if (countss > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "删除成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "删除失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
break;
case "uts_inhaos":
tbl_shipping ilist = db.AsTenant().GetConnection(2).Queryable<tbl_shipping>().Where(x => x.ID == determine.id).First();
if (ilist != null)
{
int countss = db.AsTenant().GetConnection(2).Deleteable(ilist).Where(x => x.ID == ilist.ID).ExecuteCommand();
if (countss > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "删除成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "删除失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
break;
case "uts_zongqing":
tbl_shipping zlist = db.AsTenant().GetConnection(1).Queryable<tbl_shipping>().Where(x => x.ID == determine.id).First();
if (zlist != null)
{
int countss = db.AsTenant().GetConnection(1).Deleteable(zlist).Where(x => x.ID == zlist.ID).ExecuteCommand();
if (countss > 0)
{
//修改成功
rinfo.status = 200;
rinfo.message = "删除成功";
rinfo.isok = true;
}
else
{
//修改失败
rinfo.status = 400;
rinfo.message = "删除失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 400;
rinfo.message = "没有找到该数据";
rinfo.isok = false;
}
break;
default:
rinfo.status = 400;
rinfo.message = "没有找到该数据库";
rinfo.isok = false;
break;
}
}
catch (Exception ex)
{
rinfo.status = 500;
rinfo.message = "系统异常";
rinfo.isok = false;
log.WriteLine("删除"+ determine.JudgeDatabase + "出货单信息失败,错误信息为:" + ex.Message);
}
return rinfo;
}
[HttpGet("SelectShippingAllinfo")]
public SelectShippingInfo SelectShippingAllinfo([FromBody] SelectShippingAllinfo selectShipping)
{
SelectShippingInfo info = new SelectShippingInfo();
int totalCount = 0;
try
{
switch (selectShipping.JudgeDatabase)
{
case "uts_bomei":
List<tbl_shipping> blist = db.AsTenant().GetConnection(4).Queryable<tbl_shipping>().ToPageList(selectShipping.page, 10, ref totalCount);
info.list = blist;
info.pagecount = (totalCount % 12) == 0 ? (totalCount / 12) : (totalCount / 12) + 1;
info.shippingcount = totalCount;
break;
case "uts_dtl":
List<tbl_shipping> zlist = db.AsTenant().GetConnection(3).Queryable<tbl_shipping>().ToPageList(selectShipping.page, 10, ref totalCount);
info.list = zlist;
info.pagecount = (totalCount % 12) == 0 ? (totalCount / 12) : (totalCount / 12) + 1;
info.shippingcount = totalCount;
break;
case "uts_inhaos":
List<tbl_shipping> ilist = db.AsTenant().GetConnection(2).Queryable<tbl_shipping>().ToPageList(selectShipping.page, 10, ref totalCount);
info.list = ilist;
info.pagecount = (totalCount % 12) == 0 ? (totalCount / 12) : (totalCount / 12) + 1;
info.shippingcount = totalCount;
break;
case "uts_zongqing":
List<tbl_shipping> zqlist = db.AsTenant().GetConnection(1).Queryable<tbl_shipping>().ToPageList(selectShipping.page, 10, ref totalCount);
info.list = zqlist;
info.pagecount = (totalCount % 12) == 0 ? (totalCount / 12) : (totalCount / 12) + 1;
info.shippingcount = totalCount;
break;
default:
info.list = null;
info.pagecount = 0;
info.shippingcount = 0;
break;
}
}
catch (Exception ex)
{
info.list = null;
info.pagecount = 0;
info.shippingcount = 0;
log.WriteLine("查询"+ selectShipping.JudgeDatabase + "出货单信息失败,错误信息为:"+ex.Message);
throw;
}
return info;
}
}
public class JudgeTheDatabase : tbl_shipping
{
//数据库索引
public string JudgeDatabase { get; set; }
}
public class DetermineTheDatabase
{
public int id { get; set; }
//数据库索引
public string JudgeDatabase { get; set; }
}
public class SelectShippingAllinfo
{
public int page { get; set; }
//数据库索引
public string JudgeDatabase { get; set; }
}
public class SelectShippingInfo
{
//原始数据
public List<tbl_shipping> list { get; set; }
//数据总数
public int shippingcount { set; get; }
//分页数
public int pagecount { set; get; }
}
}

View File

@@ -0,0 +1,209 @@
using System.Collections.Generic;
using AUTS_Server.Models;
using AUTS_Server.Service;
using Dm.filter;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using uts_manage;
using XAct.Users;
namespace AUTS_Server.Controllers
{
[Route("IUser")]
[ApiController]
public class IUserController : ControllerBase
{
public readonly IEncryptionService encryptionService;
private readonly ISqlSugarClient db;
private readonly ILogHelperForService log;
public IUserController(IEncryptionService encryptionService, ISqlSugarClient db, ILogHelperForService log)
{
this.encryptionService = encryptionService;
this.db = db;
this.log = log;
}
[HttpPost("AddOrUpdateUser")]
public Returninfo AddOrUpdateUser([FromBody] uts_manage_userinfo user)
{
Returninfo rinfo = new Returninfo();
try
{
if (user.ID == 0)
{
//add
//添加用户默认密码是123456.后续用户自己修改自己的密码
tbl_uts_manage_user tbl =new tbl_uts_manage_user();
tbl.UserName = user.UserName;
tbl.Mobile = user.Mobile;
tbl.WeiXin = user.WeiXin;
tbl.Email = user.Email;
tbl.CompanyID = user.CompanyID;
tbl.IsValid = user.IsValid;
tbl.IsAdmin = user.IsAdmin;
tbl.CreateTime = DateTime.Now;
tbl.SetBarCode = user.SetBarCode;
tbl.AccountBill = user.AccountBill;
tbl.PlaintextPwd = "123456";
tbl.Password = encryptionService.Encrypt(encryptionService.Encrypt(tbl.PlaintextPwd));
int count = db.AsTenant().GetConnection(0).Insertable(tbl).ExecuteCommand();
if (count > 0)
{
rinfo.status = 200;
rinfo.message = "添加成功";
rinfo.isok = true;
}
else
{
rinfo.status = 300;
rinfo.message = "添加失败";
rinfo.isok = false;
}
}
else
{
//修改不修改密码,
tbl_uts_manage_user list = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_user>().First(x => x.ID == user.ID);
if (list != null)
{
list.UserName = user.UserName;
list.Mobile = user.Mobile;
list.WeiXin = user.WeiXin;
list.Email = user.Email;
list.CompanyID = user.CompanyID;
list.IsValid = user.IsValid;
list.IsAdmin = user.IsAdmin;
list.UpdateTime = DateTime.Now;
list.SetBarCode = user.SetBarCode;
list.AccountBill = user.AccountBill;
int count = db.AsTenant().GetConnection(0).Updateable(list).Where(x => x.ID == user.ID).ExecuteCommand();
if (count > 0)
{
rinfo.status = 200;
rinfo.message = "修改成功";
rinfo.isok = true;
}
else
{
rinfo.status = 300;
rinfo.message = "修改失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 404;
}
}
}
catch (Exception ex)
{
rinfo.status = 500;
rinfo.message = "系统异常";
rinfo.isok = false;
log.WriteLine("添加相关用户信息异常,异常信息是:" + ex.Message);
}
return rinfo;
}
/// <summary>
///查询所有用户
/// </summary>
[HttpGet("SelectUserAllinfo")]
public void SelectUserAllinfo([FromBody] int page)
{
int totalCount = 0;
try
{
var list = db.Queryable<tbl_uts_manage_user>()
.LeftJoin<tbl_uts_manage_company>((u, c) => u.CompanyID == c.ID)
.Select((u, c) => new
{
Id = u.ID,
CustomerName = c.CustomerName,
Username = u.UserName,
CreateTime = u.CreateTime,
WeiXin = u.WeiXin,
Mobile = u.Mobile,
Email = u.Email,
IsValid = u.IsValid,
//IsAdmin=u.IsAdmin,
//BarCode=u.BarCode,
//SetBarCode=u.SetBarCode,
}).ToPageList(page, 12, ref totalCount);
}
catch (Exception ex)
{
//rinfo.status = 500;
//rinfo.message = "系统异常";
//rinfo.isok = false;
log.WriteLine("查询用户异常,异常信息是:" + ex.Message);
}
}
[HttpPost("DeleteUser")]
public Returninfo DeleteUser([FromBody] int id)
{
Returninfo rinfo = new Returninfo();
try
{
tbl_uts_manage_user list = db.AsTenant().GetConnection(0).Queryable<tbl_uts_manage_user>().First(x => x.ID == id);
if (list != null)
{
int count = db.AsTenant().GetConnection(0).Deleteable<tbl_uts_manage_user>().Where(x => x.ID == id).ExecuteCommand();
if (count > 0)
{
rinfo.status = 200;
rinfo.message = "删除成功";
rinfo.isok = true;
}
else
{
rinfo.status = 404;
rinfo.message = "删除失败";
rinfo.isok = false;
}
}
else
{
rinfo.status = 404;
rinfo.message = "没有对应的数据";
rinfo.isok = false;
}
}
catch (Exception ex)
{
rinfo.status = 500;
rinfo.message = "系统异常";
rinfo.isok = false;
log.WriteLine("删除用户异常,异常信息是:" + ex.Message);
}
return rinfo;
}
}
public class uts_manage_userinfo
{
public int ID { get; set; }
public int CompanyID { get; set; }
public string UserName { get; set; }
public string ?Password { get; set; }
public DateTime? CreateTime { get; set; }
public string? Mobile { get; set; }
public string? WeiXin { get; set; }
public string? Email { get; set; }
public byte IsValid { get; set; }
public byte IsAdmin { get; set; }
public string? BarCode { get; set; }
public byte SetBarCode { get; set; }
public DateTime? UpdateTime { get; set; }
public byte AccountBill { get; set; }
public string? PlaintextPwd { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
namespace AUTS_Server.Controllers
{
public class LoginController : Controller
{
public IActionResult Index()
{
return View();
}
}
}