1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Data;
- using System.Collections.Generic;
- using WMS.Info;
- using WMS.Util;
- using System.Linq;
- using SqlSugar;
- namespace WMS.Core
- {
- /// <summary>
- /// 描 述:用户关系
- /// </summary>
- public class ACLUserRelation
- {
- public List<ACL_USERITEM> GetUserList(string objectno, EACLObjType eACLObjType)
- {
- try
- {
- var getAll8 = SysDbCore.GetDbCtx().Queryable<ACL_USERITEM>().Where(it =>
- SqlFunc.Subqueryable<ACL_USERRELATION>().Where(s => s.F_OBJTYPENUM == (int)eACLObjType && s.F_ITEMNO == objectno && s.F_USERNO == it.F_NO).Any()).ToList();
- getAll8.ForEach(it =>
- {
- it.F_PASSWORD = "";
- it.F_DATA = "";
- });
- return getAll8;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- public void SaveEntityList(string objectno, EACLObjType eACLObjType,List<string> UserNos)
- {
- try
- {
- void action(SqlSugarClient ctx)
- {
- ctx.Deleteable<ACL_USERRELATION>().Where(it => it.F_OBJTYPENUM == (int)eACLObjType && it.F_ITEMNO == objectno).ExecuteCommand();
- if (UserNos != null && UserNos.Count > 0)
- {
- foreach (string s in UserNos)
- {
- ctx.Insertable<ACL_USERRELATION>(new ACL_USERRELATION()
- {
- F_ITEMNO = objectno,
- F_NO = Guid.NewGuid().ToString(),
- F_OBJTYPENUM = (int)eACLObjType,
- F_USERNO = s
- }).ExecuteCommand();
- }
- }
- }
- SysDbCore.DbTranExec(action);
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- }
- }
|