using System; using System.Collections.Generic; using System.Linq; using System.Text; using Edu.AOP.CustomerAttribute; using Edu.Model.ViewModel.User; using Edu.Repository.User; namespace Edu.Module.User { public class AccountRemarkModule { /// <summary> /// 行政备注管理处理类对象 /// </summary> private readonly RB_AccountRemarkRepository accountRemarkRepository = new RB_AccountRemarkRepository(); /// <summary> /// 获取行政备注列表 /// </summary> /// <param name="query"></param> /// <returns></returns> public List<RB_AccountRemark_ViewModel> GetAccountRemarkListModule(RB_AccountRemark_ViewModel query) { return accountRemarkRepository.GetList(query); } /// <summary> /// 获取行政备注分页列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="rowsCount"></param> /// <param name="query"></param> /// <returns></returns> public List<RB_AccountRemark_ViewModel> GetAccountRemarkPageListModule(int pageIndex, int pageSize, out long rowsCount, RB_AccountRemark_ViewModel query) { return accountRemarkRepository.GetPageList(pageIndex, pageSize, out rowsCount, query); } /// <summary> /// 获取分页列表 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="rowsCount"></param> /// <param name="demodel"></param> /// <returns></returns> public List<RB_AccountRemark_ViewList> GetPageList(int pageIndex, int pageSize, out long rowsCount, RB_AccountRemark_ViewList demodel) { var list = accountRemarkRepository.GetAccountRemarkPageList(pageIndex, pageSize, out rowsCount, demodel); if (list!=null&& list.Any()) { var childList = accountRemarkRepository.GetListByWhere(demodel); foreach (var item in list) { item.AccountRemarkList = new List<RB_AccountRemark_ViewModel>(); item.AccountRemarkList = childList.Where(x => x.CreateTime.Value.ToString("yyyy-MM-dd") == item.CreateStr).ToList(); } } return list; } /// <summary> /// 添加修改行政备注 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool SetAccountRemarkModule(RB_AccountRemark_ViewModel model) { bool flag; var newId = accountRemarkRepository.Insert(model); model.Id = newId; flag = newId > 0; return flag; } } }