コード例 #1
0
        public IEnumerable <Role_ShowDTO> SearchItemsPaged(int?pageNum = null, int?pageSize = null, string name = null)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                string searchSql = RoleService_SQL.SearchAllRoleInfo;

                //查询条件
                if (!string.IsNullOrEmpty(name))
                {
                    searchSql += " and A.NAME = {0}";
                }

                var query = dbContext.Queryable(searchSql, name);

                //分页
                if (pageNum.HasValue && pageSize.HasValue)
                {
                    query = query.Paging(pageNum.Value, pageSize.Value);
                }

                var items = query.ToList <Role>();

                return(null == items ? new List <Role_ShowDTO>() : items.Select(d => CoffeeMapper <Role, Role_ShowDTO> .AutoMap(d, (tout, tin) =>
                {
                    tout.HasApiPermissionIds = tin["HAS_API_PERMIDS"].ToString().Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray();
                    tout.HasMenuIds = tin["HAS_MENUIDS"].ToString().Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray();
                })));
            }
        }
コード例 #2
0
        public Account_ShowDTO MatchLogin(string account, string password)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <AdminUser> commonService = new CommonService <AdminUser>(dbContext);

                var matchAccount = commonService.WhereNoMarkDeleted()
                                   .Select(a => new { a.Id })
                                   .Where(a => a.Account.Equals(account) && a.PasswordHash.Equals(password))
                                   .ToList();
                if (null == matchAccount)
                {
                    throw new PushToUserException("the entered account or password is incorrect");
                }
                else if (1 == matchAccount.Count)
                {
                    var loginUser = dbContext.Queryable(AccountService_SQL.GetLoginUserInfo, matchAccount[0].Id).ToOne <AdminUser>();

                    return(CoffeeMapper <AdminUser, Account_ShowDTO> .AutoMap(loginUser, (tOut, tIn) =>
                    {
                        tOut.Name = tIn["NAME"].ToString();
                        tOut.Roles = tIn["ROLESNAME"].ToString();
                    }));
                }
                else if (matchAccount.Count <= 0)
                {
                    throw new PushToUserException("the entered account or password is incorrect");
                }
                else
                {
                    throw new Exception($"Duplicate Account : [account='{account}', password='******']");
                }
            }
        }
コード例 #3
0
        public void EditOne(Department_AddEditDTO editOne, string updater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Department> commonService = new CommonService <Department>(dbContext);

                bool isExist = commonService.AnyByIdNoMarkDeleted(editOne.Id);
                if (!isExist)
                {
                    throw new PushToUserException("Current Department item is not exist");
                }

                bool hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Name.Equals(editOne.Name) && d.Id != editOne.Id).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A Department item with the same name '{editOne.Name}' already exists");
                }


                Department updateOne = CoffeeMapper <Department_AddEditDTO, Department> .AutoMap(editOne, (_out, _in) =>
                {
                    _out.Updater    = updater;
                    _out.UpdateTime = DateTime.Now;
                });

                dbContext.Update <Department>(d => new { d.Name, d.ParentId, d.RemarkInfo, d.SortNumber, d.Updater, d.UpdateTime }, updateOne)
                .Where(d => d.Id.Equals(updateOne.Id)).Done();
            }
        }
コード例 #4
0
        public void EditOne(Permission_AddEditDTO editOne, string updater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Permission> commonService = new CommonService <Permission>(dbContext);

                bool isExist = commonService.AnyByIdNoMarkDeleted(editOne.Id);
                if (!isExist)
                {
                    throw new PushToUserException("Current api permission item is not exist");
                }

                bool hasExist = commonService.WhereNoMarkDeleted().Where(p => 0 == p.DelFlag && p.Id != editOne.Id && p.ApiUrl.Equals(editOne.ApiUrl)).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A api permission item with the same api url '{editOne.ApiUrl}' already exists");
                }

                Permission updateOne = CoffeeMapper <Permission_AddEditDTO, Permission> .AutoMap(editOne, (_out, _in) =>
                {
                    _out.Updater    = updater;
                    _out.UpdateTime = DateTime.Now;
                });

                dbContext.Update <Permission>(p => new { p.Name, p.ApiType, p.ApiUrl, p.ApiMethod, p.RemarkInfo, p.SortNumber, p.Updater, p.UpdateTime }, updateOne)
                .Where(d => d.Id.Equals(updateOne.Id)).Done();
            }
        }
コード例 #5
0
        public void NoMappingFoundException()
        {
            ClassMappingInstructionHolder mappingInstructions = new ClassMappingInstructionHolder();
            ICoffeeMapper mapper         = new CoffeeMapper(mappingInstructions);
            ExampleClass1 exampleObject1 = GetObject1();

            Assert.ThrowsException <NoMappingFoundException>
                (() => mapper.Map <ExampleClass2>(exampleObject1));
        }
コード例 #6
0
        private static ICoffeeMapper CreateMapperWithExampleMapping()
        {
            ClassMappingInstructionHolder mappingInstructions = new ClassMappingInstructionHolder();

            mappingInstructions.AddMapping <ExampleClass1, ExampleClass2>();
            ICoffeeMapper mapper = new CoffeeMapper(mappingInstructions);

            return(mapper);
        }
コード例 #7
0
        public void EditOne(Account_AddEditDTO editOne, string updater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <AdminUser> commonService = new CommonService <AdminUser>(dbContext);

                bool isExist = commonService.AnyByIdNoMarkDeleted(editOne.Id);
                if (!isExist)
                {
                    throw new PushToUserException("Current account item is not exist");
                }

                bool hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Account.Equals(editOne.Account) && d.Id != editOne.Id).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A admin user item with the same account '{editOne.Account}' already exists");
                }

                try
                {
                    dbContext.DBTransaction.Begin();

                    AdminUser updateAdminUserOne = CoffeeMapper <Account_AddEditDTO, AdminUser> .AutoMap(editOne, (_out, _in) =>
                    {
                        _out.Updater    = updater;
                        _out.UpdateTime = DateTime.Now;
                    });

                    var matchAdminUserInfo = dbContext.Queryable <AdminUserInfo>().Select().Where(a => a.AdminUserId.Equals(editOne.Id)).ToList();

                    if (matchAdminUserInfo.Count != 1)
                    {
                        throw new Exception($"TABLE 'IDSBG_ECARD.B_ADMIN_USER' record which AdminUserId = '{editOne.Id}' is not only one or not exist");
                    }

                    AdminUserInfo updateAdminUserInfoOne = matchAdminUserInfo[0];
                    updateAdminUserInfoOne.Name       = editOne.Name;
                    updateAdminUserInfoOne.RemarkInfo = editOne.Remarks;
                    updateAdminUserInfoOne.Updater    = updater;
                    updateAdminUserInfoOne.UpdateTime = DateTime.Now;

                    dbContext.Update <AdminUserInfo>(updateAdminUserInfoOne);
                    dbContext.Update <AdminUser>(a => new { a.Account, a.RemarkInfo, a.Updater, a.UpdateTime }, updateAdminUserOne)
                    .Where(a => a.Id.Equals(editOne.Id)).Done();

                    dbContext.DBTransaction.Commit();
                }
                catch (Exception ex)
                {
                    dbContext.DBTransaction.Rollback();

                    throw ex;
                }
            }
        }
コード例 #8
0
        public void ClassMappingAutoDiscoversBasicPropertyFromIntToLong()
        {
            ClassMappingInstructionHolder mappingInstructions = new ClassMappingInstructionHolder();

            mappingInstructions.AddMapping <ExampleClassWithIntProperty, ExampleClassWithLongProperty>();
            ICoffeeMapper mapper = new CoffeeMapper(mappingInstructions);
            ExampleClassWithIntProperty  exampleObject1 = GetExampleObjectWithIntProperty();
            ExampleClassWithLongProperty result         = mapper.Map <ExampleClassWithLongProperty>(exampleObject1);

            Assert.AreEqual(exampleObject1.A, result.A);
        }
コード例 #9
0
        public IEnumerable <Menu_ShowDTO> GetAccountHasNavMenus(string accountId)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                var items = dbContext.Queryable(MenuService_SQL.SearchAccountHasNavMenus, accountId).ToList <Menu>();

                return(null == items ? new List <Menu_ShowDTO>() : items.Select(d => CoffeeMapper <Menu, Menu_ShowDTO> .AutoMap(d, (tout, tin) =>
                {
                    tout.IsMenuItem = (2 == tin.Type);
                })).OrderBy(m => m.SortNumber).ToList());
            }
        }
コード例 #10
0
        public void ClassMappingWithoutAutoDiscoversBasicProperty()
        {
            ClassMappingInstructionHolder mappingInstructions = new ClassMappingInstructionHolder();

            mappingInstructions.AddMapping <ExampleClass1, ExampleClass2>(new ClassMappingInstructionOptions {
                AutoAddPropertiesWithSameName = false
            });
            ICoffeeMapper mapper         = new CoffeeMapper(mappingInstructions);
            ExampleClass1 exampleObject1 = GetObject1();
            ExampleClass2 result         = mapper.Map <ExampleClass2>(exampleObject1);

            Assert.AreEqual(null, result.A);
        }
コード例 #11
0
        public void ClassMappingAutoDiscoversBasicPropertyWithMismatchTypes()
        {
            ClassMappingInstructionHolder mappingInstructions = new ClassMappingInstructionHolder();

            mappingInstructions.AddMapping <ExampleClass1, ExampleClassWithIntProperty>(new ClassMappingInstructionOptions {
                AutoAddPropertiesWithSameName = true
            });
            ICoffeeMapper mapper               = new CoffeeMapper(mappingInstructions);
            ExampleClass1 exampleObject1       = GetObject1();
            ExampleClassWithIntProperty result = mapper.Map <ExampleClassWithIntProperty>(exampleObject1);

            Assert.AreEqual(exampleObject1.A, result.A);
        }
コード例 #12
0
        public IEnumerable <Menu_ShowDTO> GetAllItems()
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Menu> commonService = new CommonService <Menu>(dbContext);

                var items = commonService.GetAllNoMarkDeleted().OrderBy(t => t.SortNumber).ToList();

                return(null == items ? new List <Menu_ShowDTO>() : items.Select(d => CoffeeMapper <Menu, Menu_ShowDTO> .AutoMap(d, (tout, tin) =>
                {
                    tout.IsMenuItem = (2 == tin.Type);
                })));
            }
        }
コード例 #13
0
        public string AddNewOne(Account_AddEditDTO addOne, string creater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <AdminUser>     commonAdminUserService     = new CommonService <AdminUser>(dbContext);
                CommonService <AdminUserInfo> commonAdminUserInfoService = new CommonService <AdminUserInfo>(dbContext);

                bool hasExist = commonAdminUserService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Account.Equals(addOne.Account)).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A admin user item with the same account '{addOne.Account}' already exists");
                }

                try
                {
                    dbContext.DBTransaction.Begin();

                    AdminUser newAdminUserOne = CoffeeMapper <Account_AddEditDTO, AdminUser> .AutoMap(addOne, (_out, _in) =>
                    {
                        _out.PasswordHash = "ensky123.";  //系統默認密碼
                        _out.Id           = Utils.GetGuidStr();
                        _out.Creater      = creater;
                    });

                    string accountId = commonAdminUserService.Insert(newAdminUserOne);

                    AdminUserInfo newAdminUserInfoOne = CoffeeMapper <Account_AddEditDTO, AdminUserInfo> .AutoMap(addOne, (_out, _in) =>
                    {
                        _out.Id          = Utils.GetGuidStr();
                        _out.Creater     = creater;
                        _out.AdminUserId = accountId;
                    });

                    commonAdminUserInfoService.Insert(newAdminUserInfoOne);

                    dbContext.DBTransaction.Commit();

                    return(accountId);
                }
                catch (Exception ex)
                {
                    dbContext.DBTransaction.Rollback();

                    throw ex;
                }
            }
        }
コード例 #14
0
        public void EditOne(Menu_AddEditDTO editOne, string updater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Menu> commonService = new CommonService <Menu>(dbContext);

                bool isExist = commonService.AnyByIdNoMarkDeleted(editOne.Id);
                if (!isExist)
                {
                    throw new PushToUserException("Current menu item is not exist");
                }

                bool hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Type != editOne.Type && d.Id == editOne.Id).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"the type of Menu item is not allow to change");
                }

                hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Name.Equals(editOne.Name) && d.Id != editOne.Id).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A menu item with the same name '{editOne.Name}' already exists");
                }

                if (!string.IsNullOrEmpty(editOne.PagePath))
                {
                    hasExist = commonService.WhereNoMarkDeleted().Where(d => d.PagePath.Equals(editOne.PagePath) && d.Id != editOne.Id).Any();
                    if (hasExist)
                    {
                        throw new PushToUserException($"A menu item with the same page path '{editOne.PagePath}' already exists");
                    }
                }

                Menu updateOne = CoffeeMapper <Menu_AddEditDTO, Menu> .AutoMap(editOne, (_out, _in) =>
                {
                    _out.Updater    = updater;
                    _out.UpdateTime = DateTime.Now;
                });

                dbContext.Update <Menu>(d => new { d.Name, d.PagePath, d.ParentId, d.Icon, d.Type, d.RemarkInfo, d.SortNumber, d.Updater, d.UpdateTime }, updateOne)
                .Where(d => d.Id.Equals(updateOne.Id)).Done();
            }
        }
コード例 #15
0
        public string AddNewOne(Department_AddEditDTO addOne, string creater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Department> commonService = new CommonService <Department>(dbContext);

                bool hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Name.Equals(addOne.Name)).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A Department item with the same name '{addOne.Name}' already exists");
                }

                Department newOne = CoffeeMapper <Department_AddEditDTO, Department> .AutoMap(addOne, (_out, _in) =>
                {
                    _out.Id      = Utils.GetGuidStr();
                    _out.Creater = creater;
                });

                return(commonService.Insert(newOne));
            }
        }
コード例 #16
0
        public string AddNewOne(Permission_AddEditDTO addOne, string creater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Permission> commonService = new CommonService <Permission>(dbContext);

                bool hasExist = commonService.WhereNoMarkDeleted().Where(p => 0 == p.DelFlag && p.ApiUrl.Equals(addOne.ApiUrl)).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A api permission item with the same api url '{addOne.ApiUrl}' already exists");
                }

                Permission newOne = CoffeeMapper <Permission_AddEditDTO, Permission> .AutoMap(addOne, (_out, _in) =>
                {
                    _out.Id             = Utils.GetGuidStr();
                    _out.Creater        = creater;
                    _out.PermissionType = 1;
                });

                return(commonService.Insert(newOne));
            }
        }
コード例 #17
0
        public IEnumerable <Permission_ShowDTO> GetAccountHasApiPerms(string accountId)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                var items = dbContext.Queryable(PermissionService_SQL.SearchAccountHasApiPerms, accountId).ToList <Permission>();

                return(null == items ? new List <Permission_ShowDTO>() : items.Select(d => CoffeeMapper <Permission, Permission_ShowDTO> .AutoMap(d)));
            }
        }
コード例 #18
0
        public IEnumerable <Permission_ShowDTO> SearchItemsPaged(int?pageNum = null, int?pageSize = null, string apiType = null, string nameKey = null)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Permission> commonService = new CommonService <Permission>(dbContext);

                var search = commonService.WhereNoMarkDeleted().Where(p => p.PermissionType == 1);

                //查询条件
                if (!string.IsNullOrEmpty(apiType))
                {
                    search = search.Where(p => p.ApiType.Equals(apiType));
                }

                if (!string.IsNullOrEmpty(nameKey))
                {
                    search = search.Where(p => p.Name.Contains(nameKey));
                }

                //分页
                if (pageNum.HasValue && pageSize.HasValue)
                {
                    search.OrderBy(t => t.SortNumber).Paging(pageNum.Value, pageSize.Value);
                }

                var items = search.Select().ToList();

                return(null == items ? new List <Permission_ShowDTO>() : items.Select(d => CoffeeMapper <Permission, Permission_ShowDTO> .AutoMap(d)).ToList());
            }
        }
コード例 #19
0
        public string AddNewOne(Menu_AddEditDTO addOne, string creater)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Menu> commonService = new CommonService <Menu>(dbContext);

                bool hasExist = commonService.WhereNoMarkDeleted().Where(d => 0 == d.DelFlag && d.Name.Equals(addOne.Name)).Any();
                if (hasExist)
                {
                    throw new PushToUserException($"A menu item with the same name '{addOne.Name}' already exists");
                }

                if (!string.IsNullOrEmpty(addOne.PagePath))
                {
                    hasExist = commonService.WhereNoMarkDeleted().Where(d => d.PagePath.Equals(addOne.PagePath)).Any();
                    if (hasExist)
                    {
                        throw new PushToUserException($"A menu item with the same page path '{addOne.PagePath}' already exists");
                    }
                }

                try
                {
                    dbContext.DBTransaction.Begin();

                    Menu newOne = CoffeeMapper <Menu_AddEditDTO, Menu> .AutoMap(addOne, (_out, _in) =>
                    {
                        _out.Id      = Utils.GetGuidStr();
                        _out.Creater = creater;
                    });

                    string newMenuId = commonService.Insert(newOne);

                    //菜单项添加对应的权限项记录
                    if (2 == addOne.Type)
                    {
                        Permission menuPerm = new Permission
                        {
                            Id             = Utils.GetGuidStr(),
                            Name           = $"menu-({addOne.Name})",
                            PermissionType = 2,
                            MenuId         = newMenuId,
                            DelFlag        = 0,
                            Creater        = creater
                        };

                        dbContext.Add(menuPerm);
                    }

                    dbContext.DBTransaction.Commit();

                    return(newMenuId);
                }
                catch (Exception ex)
                {
                    dbContext.DBTransaction.Rollback();

                    throw ex;
                }
            }
        }
コード例 #20
0
        public IEnumerable <Department_ShowDTO> GetAllItems()
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Department> commonService = new CommonService <Department>(dbContext);

                var items = commonService.GetAllNoMarkDeleted().OrderBy(t => t.SortNumber).ToList();

                return(null == items ? new List <Department_ShowDTO>() : items.Select(d => CoffeeMapper <Department, Department_ShowDTO> .AutoMap(d)));
            }
        }
コード例 #21
0
        public IEnumerable <Account_ShowDTO> SearchItemsPaged(int?pageNum = null, int?pageSize = null, string name = null, string account = null)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                string        searchSql  = AccountService_SQL.SearchAllAccountInfo;
                List <object> _sqlParams = new List <object>();

                //查询条件
                if (!string.IsNullOrEmpty(name))
                {
                    searchSql += $" and B.NAME = {{{_sqlParams.Count}}}";
                    _sqlParams.Add(name);
                }

                if (!string.IsNullOrEmpty(account))
                {
                    searchSql += $" and A.ACCOUNT = {{{_sqlParams.Count}}}";
                    _sqlParams.Add(account);
                }

                var query = dbContext.Queryable(searchSql, _sqlParams.ToArray());

                //分页
                if (pageNum.HasValue && pageSize.HasValue)
                {
                    query = query.Paging(pageNum.Value, pageSize.Value);
                }

                var items = query.ToList <AdminUser>();

                return(null == items ? new List <Account_ShowDTO>() : items.Select(d => CoffeeMapper <AdminUser, Account_ShowDTO> .AutoMap(d, (tout, tin) =>
                {
                    tout.Name = tin["NAME"].ToString();
                    tout.HasRoleIds = tin["HASROLEIDS"].ToString().Split(',').Where(s => !string.IsNullOrEmpty(s)).ToArray();
                    tout.Roles = tin["ROLESNAME"].ToString();
                })));
            }
        }
コード例 #22
0
        public IEnumerable <Message_ShowDTO> SearchItemsPaged(int?pageNum = null, int?pageSize = null, int?type = null, int?status = null, string receiver = null, int?theTermDays = null)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Message> commonService = new CommonService <Message>(dbContext);

                var search = commonService.WhereNoMarkDeleted();

                //查询条件
                if (type.HasValue)
                {
                    search = search.Where(d => d.Type == type.Value);
                }

                if (status.HasValue)
                {
                    search = search.Where(d => d.Status == status.Value);
                }

                if (!string.IsNullOrEmpty(receiver))
                {
                    search = search.Where(d => d.Receiver == receiver);
                }

                if (theTermDays.HasValue)
                {
                    DateTime theEarliestDateTime = DateTime.Now.AddDays(-theTermDays.Value);
                    search = search.Where(d => d.CreateTime >= theEarliestDateTime);
                }

                //分页
                if (pageNum.HasValue && pageSize.HasValue)
                {
                    search.OrderBy(t => t.SortNumber).Paging(pageNum.Value, pageSize.Value);
                }

                var items = search.Select().ToList();

                return(null == items ? new List <Message_ShowDTO>() : items.Select(d => CoffeeMapper <Message, Message_ShowDTO> .AutoMap(d, (tout, tin) =>
                {
                    switch (tin.Type)
                    {
                    case 1:
                        tout.TypeText = "系統通知";
                        break;

                    case 2:
                        tout.TypeText = "個人消息";
                        break;

                    default:
                        tout.TypeText = "未知消息類型";
                        break;
                    }
                    switch (tin.Status)
                    {
                    case -1:
                        tout.TypeText = "發送失敗";
                        break;

                    case 0:
                        tout.TypeText = "未發送";
                        break;

                    case 1:
                        tout.TypeText = "已發送";
                        break;

                    case 2:
                        tout.TypeText = "未閱讀";
                        break;

                    case 3:
                        tout.TypeText = "已閱讀";
                        break;

                    default:
                        tout.TypeText = "未知消息狀態";
                        break;
                    }
                })));
            }
        }
コード例 #23
0
        public IEnumerable <Dictionary_ShowDTO> SearchItemsPaged(int?pageNum = null, int?pageSize = null, string type = null)
        {
            using (MiniSenDbContext dbContext = new MiniSenDbContext())
            {
                CommonService <Dictionary> commonService = new CommonService <Dictionary>(dbContext);

                var search = commonService.WhereNoMarkDeleted();

                //查询条件
                if (!string.IsNullOrEmpty(type))
                {
                    search = search.Where(d => d.Type.Equals(type));
                }

                //分页
                if (pageNum.HasValue && pageSize.HasValue)
                {
                    search.OrderBy(t => t.SortNumber).Paging(pageNum.Value, pageSize.Value);
                }

                var items = search.Select().ToList();

                return(null == items ? new List <Dictionary_ShowDTO>() : items.Select(d => CoffeeMapper <Dictionary, Dictionary_ShowDTO> .AutoMap(d)).ToList());
            }
        }