using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FineAdmin.IService; using FineAdmin.Model; using FineAdmin.IRepository; using FineAdmin.Common; namespace FineAdmin.Service { public class UserService : BaseService, IUserService { public IUserRepository UserRepository { get; set; } public dynamic GetListByFilter(UserModel filter, PageInfo pageInfo) { pageInfo.prefix = "a."; string _where = " dbsys_user a INNER JOIN dbsys_role b ON a.RoleId=b.Id INNER JOIN dbsys_organize c ON a.DepartmentId=c.Id"; if (!string.IsNullOrEmpty(filter.Account)) { _where += string.Format(" and {0}Account=:Account", pageInfo.prefix); } if (!string.IsNullOrEmpty(filter.RealName)) { _where += string.Format(" and {0}RealName=:RealName", pageInfo.prefix); } if (filter.EnabledMark != null) { _where += string.Format(" and {0}EnabledMark=:EnabledMark", pageInfo.prefix); } _where = CreateTimeWhereStr(filter.StartEndDate, _where, pageInfo.prefix); pageInfo.returnFields = string.Format("{0}Id,{0}Account,{0}RealName,{0}Gender,c.FullName as DepartmentName,b.FullName as RoleName,{0}EnabledMark,{0}CreateTime", pageInfo.prefix); return GetPageUnite(filter, pageInfo, _where); } /// /// 登录 /// /// /// /// public UserModel LoginOn(string username, string password) { return UserRepository.LoginOn(username, password); } /// /// 修改密码 /// /// /// /// public int ModifyUserPwd(ModifyPwd model, int userId) { model.OldPassword = Md5.md5(model.OldPassword, 32); model.Password = Md5.md5(model.Password, 32); return UserRepository.ModifyUserPwd(model, userId); } } }