You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					70 lines
				
				2.6 KiB
			
		
		
			
		
	
	
					70 lines
				
				2.6 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								using System;
							 | 
						||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						||
| 
								 | 
							
								using FactorySystemCommon;
							 | 
						||
| 
								 | 
							
								using FactorySystemModel.SqlSugarModel;
							 | 
						||
| 
								 | 
							
								using SqlSugar;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace FactorySystemBll
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    public class OperateLogBll
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        public object GetPageList(Dictionary<string, object> inParam, out int totalCount, string orderBy = "a.FID desc")
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            totalCount = 0;
							 | 
						||
| 
								 | 
							
								            int pageIndex = 1, pageSize = 10;
							 | 
						||
| 
								 | 
							
								            List<string> paramName = new List<string>() { "FDeleted!=1" };
							 | 
						||
| 
								 | 
							
								            List<SugarParameter> paramVal = new List<SugarParameter>();
							 | 
						||
| 
								 | 
							
								            if (inParam != null && inParam.Count > 0)
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                foreach (var item in inParam)
							 | 
						||
| 
								 | 
							
								                {
							 | 
						||
| 
								 | 
							
								                    if (item.Key == "FPageIndex" || item.Key == "PageIndex")
							 | 
						||
| 
								 | 
							
								                    {
							 | 
						||
| 
								 | 
							
								                        int.TryParse(item.Value.ToString(), out pageIndex);
							 | 
						||
| 
								 | 
							
								                    }
							 | 
						||
| 
								 | 
							
								                    else if (item.Key == "FPageSize" || item.Key == "PageSize")
							 | 
						||
| 
								 | 
							
								                    {
							 | 
						||
| 
								 | 
							
								                        int.TryParse(item.Value.ToString(), out pageSize);
							 | 
						||
| 
								 | 
							
								                    }
							 | 
						||
| 
								 | 
							
								                    else
							 | 
						||
| 
								 | 
							
								                    {
							 | 
						||
| 
								 | 
							
								                        try
							 | 
						||
| 
								 | 
							
								                        {
							 | 
						||
| 
								 | 
							
								                            //检索,全转成字符串
							 | 
						||
| 
								 | 
							
								                            paramName.Add(item.Key + "=@" + item.Key);
							 | 
						||
| 
								 | 
							
								                            paramVal.Add(new SugarParameter("@" + item.Key, item.Value.ToString()));
							 | 
						||
| 
								 | 
							
								                        }
							 | 
						||
| 
								 | 
							
								                        catch (Exception) { }
							 | 
						||
| 
								 | 
							
								                    }
							 | 
						||
| 
								 | 
							
								                }
							 | 
						||
| 
								 | 
							
								            }
							 | 
						||
| 
								 | 
							
								            SqlSugarClient db = AppSettingsHelper.GetSqlSugar();
							 | 
						||
| 
								 | 
							
								            var temp = db.Queryable<TFS_OperateLog, TUser>((a, b) => new JoinQueryInfos(JoinType.Left, a.FAddUser == b.FID))
							 | 
						||
| 
								 | 
							
								                .Where(string.Join(" and ", paramName), paramVal).OrderBy(orderBy).Select<dynamic>("a.*,b.FName as FOptUser");
							 | 
						||
| 
								 | 
							
								            return temp.ToPageList(pageIndex, pageSize, ref totalCount);
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        /// <summary>
							 | 
						||
| 
								 | 
							
								        /// 保存日志
							 | 
						||
| 
								 | 
							
								        /// </summary>
							 | 
						||
| 
								 | 
							
								        /// <param name="teamId">协同ID</param>
							 | 
						||
| 
								 | 
							
								        /// <param name="type">来源类型</param>
							 | 
						||
| 
								 | 
							
								        /// <param name="desc">描述</param>
							 | 
						||
| 
								 | 
							
								        /// <param name="userId">操作人</param>
							 | 
						||
| 
								 | 
							
								        public static void Add(int teamId, int type, string desc, int userId)
							 | 
						||
| 
								 | 
							
								        {
							 | 
						||
| 
								 | 
							
								            var db = AppSettingsHelper.GetSqlSugar();
							 | 
						||
| 
								 | 
							
								            db.Insertable(new TFS_OperateLog
							 | 
						||
| 
								 | 
							
								            {
							 | 
						||
| 
								 | 
							
								                FTeamID = teamId,
							 | 
						||
| 
								 | 
							
								                FType = type,
							 | 
						||
| 
								 | 
							
								                FDesc = desc,
							 | 
						||
| 
								 | 
							
								                FAddUser = userId,
							 | 
						||
| 
								 | 
							
								                FAddDate = DateTime.Now
							 | 
						||
| 
								 | 
							
								            }).ExecuteCommand();
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |