Skip to content

Commit

Permalink
1. 修改命名空间
Browse files Browse the repository at this point in the history
  • Loading branch information
Halifa committed Jul 3, 2017
1 parent 086ae04 commit dfe5e90
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 22 deletions.
2 changes: 1 addition & 1 deletion TonyBlogs.DTO/UserInfo/UserInfoSearchDTO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using System.Linq;
using System.Text;

namespace TonyBlogs.DTO.UserPurview
namespace TonyBlogs.DTO.UserInfo
{
public class UserInfoSearchDTO : JQueryDataTableSearchDTO
{
Expand Down
2 changes: 2 additions & 0 deletions TonyBlogs.IRepository/IUserInfoRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TonyBlogs.DTO.UserInfo;
using TonyBlogs.Entity;

namespace TonyBlogs.IRepository
{
public interface IUserInfoRepository : IBaseRepository<UserInfoEntity>
{
List<UserInfoEntity> GetUserInfoList(UserInfoSearchDTO searchDTO, out long totalCount);
}
}
11 changes: 11 additions & 0 deletions TonyBlogs.IService/IUserInfoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TonyBlogs.DTO;
using TonyBlogs.DTO.UserInfo;
using TonyBlogs.Entity;

namespace TonyBlogs.IService
{
public interface IUserInfoService : IBaseServices<UserInfoEntity>
{
UserInfoSearchDTO GetUserInfoSearchDTO();

UserInfoListDTO GetUserInfoList(UserInfoSearchDTO searchDTO);

ExecuteResult AddOrEditUserInfo(UserInfoEditDTO dto);

UserInfoEditDTO GetUserInfoEditDTO(long userID);

ExecuteResult DeleteUserInfo(long userID);
}
}
48 changes: 27 additions & 21 deletions TonyBlogs.IService/IUserPurviewService.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TonyBlogs.DTO;
using TonyBlogs.DTO.UserPurview;
using TonyBlogs.Entity;

namespace TonyBlogs.IService
{
public interface IUserPurviewService : IBaseServices<PurviewEntity>
{
UserPurviewListDTO GetPurviewList(UserPurviewSearchDTO searchDTO);

ExecuteResult AddOrEditPurview(UserPurviewEditDTO dto);

UserPurviewEditDTO GetPurviewEditDTO(long purviewID);

ExecuteResult DeletePurview(long purviewID);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TonyBlogs.DTO;
using TonyBlogs.DTO.UserPurview;
using TonyBlogs.Entity;

namespace TonyBlogs.IService
{
public interface IUserPurviewService : IBaseServices<PurviewEntity>
{
UserPurviewListDTO GetPurviewList(UserPurviewSearchDTO searchDTO);

ExecuteResult AddOrEditPurview(UserPurviewEditDTO dto);

UserPurviewEditDTO GetPurviewEditDTO(long purviewID);

ExecuteResult DeletePurview(long purviewID);

/// <summary>
/// 获取权限集合<PurviewID,PurviewTitle>
/// </summary>
/// <returns></returns>
Dictionary<long, string> GetPurviewMap();
}
}
34 changes: 34 additions & 0 deletions TonyBlogs.Repository/UserInfoRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,46 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TonyBlogs.DTO.UserInfo;
using TonyBlogs.Entity;
using TonyBlogs.IRepository;
using ServiceStack.OrmLite;

namespace TonyBlogs.Repository
{
public class UserInfoRepository : BaseRepository<UserInfoEntity>, IUserInfoRepository
{
public List<UserInfoEntity> GetUserInfoList(UserInfoSearchDTO searchDTO, out long totalCount)
{
var sqlExp = db.From<UserInfoEntity>();

if (searchDTO.UserID.HasValue)
{
sqlExp.Where(m => m.UserID == searchDTO.UserID);
}

if (!string.IsNullOrEmpty(searchDTO.LoginName))
{
sqlExp.Where(m => m.LoginName == searchDTO.LoginName);
}

if (!string.IsNullOrEmpty(searchDTO.RealName))
{
sqlExp.Where(m => m.RealName == searchDTO.RealName);
}

if (searchDTO.PurviewID.HasValue)
{
sqlExp.Where(m => m.PurviewID == searchDTO.PurviewID);
}

totalCount = base.Count(sqlExp);

sqlExp.Limit(searchDTO.PageIndex - 1, searchDTO.iDisplayLength);

var list = base.QueryWhere(sqlExp);

return list;
}
}
}
47 changes: 47 additions & 0 deletions TonyBlogs.Service/UserInfoService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,57 @@
using System.Text;
using TonyBlogs.Entity;
using TonyBlogs.IService;
using TonyBlogs.DTO.UserInfo;
using TonyBlogs.IRepository;
using AutoMapper;
using TonyBlogs.DTO;

namespace TonyBlogs.Service
{
public class UserInfoService : BaseService<UserInfoEntity>,IUserInfoService
{
private IUserInfoRepository _userInfoRepository;
private IUserPurviewService _userPurviewService;

public UserInfoService(IUserInfoRepository userInfoRepository,
IUserPurviewService userPurviewService)
{
this._userInfoRepository = userInfoRepository;
this.baseDal = userInfoRepository;
this._userPurviewService = userPurviewService;
}

public UserInfoSearchDTO GetUserInfoSearchDTO()
{
UserInfoSearchDTO dto = new UserInfoSearchDTO();
dto.PurviewMap = GetPurviewMap();

return dto;
}

public UserInfoListDTO GetUserInfoList(UserInfoSearchDTO searchDTO)
{
throw new NotImplementedException();
}

public ExecuteResult AddOrEditUserInfo(UserInfoEditDTO dto)
{
throw new NotImplementedException();
}

public UserInfoEditDTO GetUserInfoEditDTO(long userID)
{
throw new NotImplementedException();
}

public ExecuteResult DeleteUserInfo(long userID)
{
throw new NotImplementedException();
}

private Dictionary<long, string> GetPurviewMap()
{
return _userPurviewService.GetPurviewMap();
}
}
}
7 changes: 7 additions & 0 deletions TonyBlogs.Service/UserPurviewService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,12 @@ public ExecuteResult DeletePurview(long purviewID)

return new ExecuteResult() { IsSuccess = true };
}

public Dictionary<long, string> GetPurviewMap()
{
var purviewList = baseDal.QueryWhere(m => m.PurviewID > 0);

return purviewList.ToDictionary<PurviewEntity,long, string>(m => m.PurviewID, m => m.PurviewTitle);
}
}
}

0 comments on commit dfe5e90

Please sign in to comment.