Commit 208282f1 authored by 吴春's avatar 吴春

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents d320abfc 2a22df08
using Edu.Common.Plugin;
namespace Edu.Common.Enum.Web
{
/// <summary>
/// 导航类型枚举
/// </summary>
public enum NavTypeEnum
{
/// <summary>
/// 首页
/// </summary>
[EnumField("首页")]
Home = 1,
/// <summary>
/// 日语培训
/// </summary>
[EnumField("日语培训")]
JapaneseTraining =2,
/// <summary>
/// 留学服务
/// </summary>
[EnumField("留学服务")]
StudyAbroadService =3,
/// <summary>
/// 就业服务
/// </summary>
[EnumField("就业服务")]
EmploymentServices = 4,
/// <summary>
/// 媒体中心
/// </summary>
[EnumField("媒体中心")]
MediaCenter = 5,
/// <summary>
/// 关于我们
/// </summary>
[EnumField("关于我们")]
AboutUs =6,
/// <summary>
/// 加入我们
/// </summary>
[EnumField("加入我们")]
JoinUs = 7,
}
}
......@@ -95,5 +95,10 @@ namespace Edu.Model.Entity.User
/// 法定代表人
/// </summary>
public string LegalPerson { get; set; }
/// <summary>
/// 官网地址
/// </summary>
public string WebSiteDomain { get; set; }
}
}
\ No newline at end of file
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Web
{
/// <summary>
/// 网站菜单管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Web_Menu
{
/// <summary>
/// 菜单编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 菜单名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 菜单地址
/// </summary>
public string MenuUrl { get; set; }
/// <summary>
/// 父节点编号
/// </summary>
public int ParentId { get; set; }
/// <summary>
/// 菜单等级
/// </summary>
public int MenuLevel { get; set; }
/// <summary>
/// 样式名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 图标地址
/// </summary>
public string Icon { get; set; }
/// <summary>
/// 排序
/// </summary>
public int SortNum { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Common.Enum;
using Edu.Common.Enum.Web;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Web
{
/// <summary>
/// 网站导航管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Web_Nav
{
/// <summary>
/// 主键编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 导航大标题
/// </summary>
public string NavTitle { get; set; }
/// <summary>
/// 导航子标题
/// </summary>
public string SubTitle { get; set; }
/// <summary>
/// 导航背景图片
/// </summary>
public string BgImg { get; set; }
/// <summary>
/// 导航地址
/// </summary>
public string LinkUrl { get; set; }
/// <summary>
/// 导航类型
/// </summary>
public NavTypeEnum NavType { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Web
{
/// <summary>
/// 新闻管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Web_News
{
/// <summary>
/// 新闻编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 新闻标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 新闻图片
/// </summary>
public string Img { get; set; }
/// <summary>
/// 新闻内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 新闻类型编号
/// </summary>
public int TypeId { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Common.Enum;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Web
{
/// <summary>
/// 新闻类型管理实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Web_NewsType
{
/// <summary>
/// 新闻类型编号(主键)
/// </summary>
public int Id { get; set; }
/// <summary>
/// 新闻类型名称
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 图片
/// </summary>
public string Image { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public DateStateEnum Status { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人编号
/// </summary>
public int CreateBy { get; set; }
/// <summary>
/// 集团编号
/// </summary>
public int Group_Id { get; set; }
/// <summary>
/// 学校编号
/// </summary>
public int School_Id { get; set; }
}
}
using Edu.Model.Entity.Web;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Web
{
/// <summary>
/// 网站菜单管理视图实体类
/// </summary>
public class RB_Web_Menu_ViewModel: RB_Web_Menu
{
}
}
using Edu.Model.Entity.Web;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Web
{
/// <summary>
/// 网站导航管理试图实体类
/// </summary>
public class RB_Web_Nav_ViewModel : RB_Web_Nav
{
/// <summary>
/// 网站导航名称
/// </summary>
public string NavTypeName { get { return Common.Plugin.EnumHelper.ToName(this.NavType); } }
}
}
\ No newline at end of file
using Edu.Model.Entity.Web;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Web
{
/// <summary>
/// 新闻类型管理视图实体类
/// </summary>
public class RB_Web_NewsType_ViewModel : RB_Web_NewsType
{
}
}
using Edu.Model.Entity.Web;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Web
{
/// <summary>
/// 新闻管理视图实体类
/// </summary>
public class RB_Web_News_ViewModel : RB_Web_News
{
}
}
......@@ -27,6 +27,22 @@ namespace Edu.Module.User
return groupRepository.GetGroupListRepository(query);
}
/// <summary>
/// 根据前端域名获取集团编号
/// </summary>
/// <param name="domain"></param>
/// <returns></returns>
public int GetGroupIdByDomainModule(string domain)
{
var groupList = GetGroupListModule(new Model.ViewModel.User.RB_Group_ViewModel() { WebSiteDomain = domain });
int groupId = 0;
if (groupList != null && groupList.Count > 0)
{
groupId = groupList?.FirstOrDefault()?.GId ?? 0;
}
return groupId;
}
/// <summary>
/// 获取集团分页列表
/// </summary>
......@@ -72,6 +88,7 @@ namespace Edu.Module.User
{nameof(RB_Group_ViewModel.Logo),model.Logo },
{nameof(RB_Group_ViewModel.UpdateBy),model.UpdateBy },
{nameof(RB_Group_ViewModel.UpdateTime),model.UpdateTime },
{nameof(RB_Group_ViewModel.WebSiteDomain),model.WebSiteDomain },
};
flag = groupRepository.Update(fileds, new WhereHelper(nameof(RB_Group_ViewModel.GId), model.GId));
}
......
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Aop\Edu.Aop.csproj" />
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
<ProjectReference Include="..\Edu.Model\Edu.Model.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
</ItemGroup>
</Project>
using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System.Linq;
using System.Collections.Generic;
using VT.FW.DB;
namespace Edu.Module.Web
{
/// <summary>
/// 网站菜单管理处理类
/// </summary>
public class WebMenuModule
{
/// <summary>
/// 网站菜单管理仓储层对象
/// </summary>
private readonly RB_Web_MenuRepository web_MenuRepository = new RB_Web_MenuRepository();
/// <summary>
/// 获取网站菜单分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Menu_ViewModel> GetWebMenuPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_Menu_ViewModel query)
{
return web_MenuRepository.GetWebMenuPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取网站菜单列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Menu_ViewModel> GetWebMenuListModule(RB_Web_Menu_ViewModel query)
{
return web_MenuRepository.GetWebMenuListRepository(query);
}
/// <summary>
/// 获取树形结构菜单
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public object GetMenuTreeModule(RB_Web_Menu_ViewModel query)
{
List<object> result = new List<object>();
var list = GetWebMenuListModule(query);
if (list != null && list.Count > 0)
{
var firstList = list.Where(qitem => qitem.MenuLevel == 1).OrderBy(qitem => qitem.SortNum);
if (firstList != null && firstList.Count() > 0)
{
foreach (var rootItem in firstList)
{
var subList = list.Where(qitem => qitem.MenuLevel == 2 && qitem.ParentId == rootItem.Id).OrderBy(qitem => qitem.SortNum);
List<object> secondList = new List<object>();
foreach (var subItem in subList)
{
var childList = list.Where(qitem => qitem.MenuLevel == 3 && qitem.ParentId == subItem.Id).OrderBy(qitem => qitem.SortNum);
secondList.Add(new
{
subItem.Name,
subItem.MenuUrl,
subItem.Icon,
subItem.ClassName,
ChildList = childList?.Select(qitem => new { qitem.Name, qitem.MenuUrl, qitem.Icon, qitem.ClassName })
});
}
result.Add(new
{
rootItem.Name,
rootItem.MenuUrl,
rootItem.Icon,
rootItem.ClassName,
ChildList = secondList
});
}
}
}
return result;
}
/// <summary>
/// 新增修改网站前台菜单
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetWebMenuModule(RB_Web_Menu_ViewModel model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Menu_ViewModel.Name),model.Name },
{nameof(RB_Web_Menu_ViewModel.MenuUrl),model.MenuUrl },
{nameof(RB_Web_Menu_ViewModel.ParentId),model.ParentId },
{nameof(RB_Web_Menu_ViewModel.MenuLevel),model.MenuLevel },
{nameof(RB_Web_Menu_ViewModel.ClassName),model.ClassName },
{nameof(RB_Web_Menu_ViewModel.Icon),model.Icon },
{nameof(RB_Web_Menu_ViewModel.SortNum),model.SortNum },
};
flag = web_MenuRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Menu_ViewModel.Id), model.Id));
}
else
{
var newId = web_MenuRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取网站菜单详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Web_Menu_ViewModel GetWebMenuModule(object Id)
{
return web_MenuRepository.GetEntity<RB_Web_Menu_ViewModel>(Id);
}
/// <summary>
/// 修改网站菜单状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveWebMenuStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Menu_ViewModel.Status),Status },
};
var flag = web_MenuRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Menu_ViewModel.Id), Id));
return flag;
}
}
}
using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Module.Web
{
/// <summary>
/// 网站导航处理类
/// </summary>
public class WebNavModule
{
/// <summary>
/// 网站导航仓储层对象
/// </summary>
private readonly RB_Web_NavRepository web_NavRepository = new RB_Web_NavRepository();
/// <summary>
/// 获取网站导航分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Nav_ViewModel> GetWebNavPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_Nav_ViewModel query)
{
return web_NavRepository.GetWebNavPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取网站导航列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Nav_ViewModel> GetWebNavListModule(RB_Web_Nav_ViewModel query)
{
return web_NavRepository.GetWebNavListRepository(query);
}
/// <summary>
/// 新增修改导航
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetWebNavModule(RB_Web_Nav_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Nav_ViewModel.NavTitle),model.NavTitle },
{nameof(RB_Web_Nav_ViewModel.SubTitle),model.SubTitle },
{nameof(RB_Web_Nav_ViewModel.BgImg),model.BgImg },
{nameof(RB_Web_Nav_ViewModel.LinkUrl),model.LinkUrl },
{nameof(RB_Web_Nav_ViewModel.NavType),model.NavType },
};
flag = web_NavRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Nav_ViewModel.Id), model.Id));
}
else
{
var newId = web_NavRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取网站导航详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Web_Nav_ViewModel GetWebNavModule(object Id)
{
return web_NavRepository.GetEntity<RB_Web_Nav_ViewModel>(Id);
}
/// <summary>
/// 修改网站导航状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveWebNavStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_Nav_ViewModel.Status),Status },
};
var flag = web_NavRepository.Update(fileds, new WhereHelper(nameof(RB_Web_Nav_ViewModel.Id), Id));
return flag;
}
}
}
using Edu.Model.ViewModel.Web;
using Edu.Repository.Web;
using System.Collections.Generic;
using VT.FW.DB;
namespace Edu.Module.Web
{
/// <summary>
/// 网站新闻处理类
/// </summary>
public class WebNewsModule
{
/// <summary>
/// 网站新闻管理仓储层对象
/// </summary>
private readonly RB_Web_NewsRepository web_NewsRepository = new RB_Web_NewsRepository();
/// <summary>
/// 网站新闻类型仓储层对象
/// </summary>
private readonly RB_Web_NewsTypeRepository web_NewsTypeRepository = new RB_Web_NewsTypeRepository();
#region 新闻管理
/// <summary>
/// 获取网站新闻分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_News_ViewModel> GetWebNewsPageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_News_ViewModel query)
{
return web_NewsRepository.GetWebNewsPageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取网站新闻列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_News_ViewModel> GetWebNewsListModule(RB_Web_News_ViewModel query)
{
return web_NewsRepository.GetWebNewsListRepository(query);
}
/// <summary>
/// 新增修改新闻
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetWebNewsModule(RB_Web_News_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_News_ViewModel.Title),model.Title },
{nameof(RB_Web_News_ViewModel.Img),model.Img },
{nameof(RB_Web_News_ViewModel.Content),model.Content },
{nameof(RB_Web_News_ViewModel.TypeId),model.TypeId },
};
flag = web_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Web_News_ViewModel.Id), model.Id));
}
else
{
var newId = web_NewsRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取网站新闻详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Web_News_ViewModel GetWebNewsModule(object Id)
{
return web_NewsRepository.GetEntity<RB_Web_News_ViewModel>(Id);
}
/// <summary>
/// 修改网站新闻状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveWebNewsStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_News_ViewModel.Status),Status },
};
var flag = web_NewsRepository.Update(fileds, new WhereHelper(nameof(RB_Web_News_ViewModel.Id), Id));
return flag;
}
#endregion
#region 新闻类型管理
/// <summary>
/// 获取网站新闻类型分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_NewsType_ViewModel> GetWebNewsTypePageModule(int pageIndex, int pageSize, out long rowsCount, RB_Web_NewsType_ViewModel query)
{
return web_NewsTypeRepository.GetWebNewsTypePageRepository(pageIndex, pageSize, out rowsCount, query);
}
/// <summary>
/// 获取网站新闻类型列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_NewsType_ViewModel> GetWebNewsTypeListModule(RB_Web_NewsType_ViewModel query)
{
return web_NewsTypeRepository.GetWebNewsTypeListRepository(query);
}
/// <summary>
/// 新增修改新闻类型
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetWebNewsTypeModule(RB_Web_NewsType_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_NewsType_ViewModel.TypeName),model.TypeName },
{nameof(RB_Web_NewsType_ViewModel.Image),model.Image },
};
flag = web_NewsTypeRepository.Update(fileds, new WhereHelper(nameof(RB_Web_NewsType_ViewModel.Id), model.Id));
}
else
{
var newId = web_NewsTypeRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取网站新闻类型详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public RB_Web_NewsType_ViewModel GetWebNewsTypeModule(object Id)
{
return web_NewsTypeRepository.GetEntity<RB_Web_NewsType_ViewModel>(Id);
}
/// <summary>
/// 修改网站新闻类型状态
/// </summary>
/// <param name="Id"></param>
/// <param name="Status">0-正常,1-删除</param>
/// <returns></returns>
public bool RemoveWebNewsTypeStatusModule(int Id, int Status)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Web_NewsType_ViewModel.Status),Status },
};
var flag = web_NewsTypeRepository.Update(fileds, new WhereHelper(nameof(RB_Web_NewsType_ViewModel.Id), Id));
return flag;
}
#endregion
}
}
......@@ -58,6 +58,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND {0}={1} ", nameof(RB_Group_ViewModel.GId),query.GId);
}
if (!string.IsNullOrEmpty(query.WebSiteDomain))
{
builder.AppendFormat(" AND {0}='{1}' ", nameof(RB_Group_ViewModel.WebSiteDomain), query.WebSiteDomain);
}
}
return Get<RB_Group_ViewModel>(builder.ToString(),parameters).ToList();
}
......
using Edu.Common.Enum;
using Edu.Model.Entity.Web;
using Edu.Model.ViewModel.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Web
{
/// <summary>
/// 网站菜单管理仓储层
/// </summary>
public class RB_Web_MenuRepository : BaseRepository<RB_Web_Menu>
{
/// <summary>
/// 获取网站菜单分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Menu_ViewModel> GetWebMenuPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Web_Menu_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_Menu AS A
WHERE 1=1
");
if (query == null)
{
return new List<RB_Web_Menu_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Menu_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Web_Menu_ViewModel.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
if (query.Status > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Menu_ViewModel.Status), (int)query.Status);
}
}
return GetPage<RB_Web_Menu_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取网站菜单列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Menu_ViewModel> GetWebMenuListRepository(RB_Web_Menu_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_Menu AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Menu_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Web_Menu_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Menu_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat(" AND A.{0} LIKE @Name ", nameof(RB_Web_Menu_ViewModel.Name));
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
}
return Get<RB_Web_Menu_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Web;
using Edu.Model.ViewModel.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Web
{
/// <summary>
/// 网站导航仓储层
/// </summary>
public class RB_Web_NavRepository : BaseRepository<RB_Web_Nav>
{
/// <summary>
/// 获取网站导航分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Nav_ViewModel> GetWebNavPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Web_Nav_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM rb_web_nav AS A
WHERE 1=1
");
if (query == null)
{
return new List<RB_Web_Nav_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.NavTitle))
{
builder.AppendFormat(" AND A.{0} LIKE @NavTitle ", nameof(RB_Web_Nav_ViewModel.NavTitle));
parameters.Add("NavTitle", "%" + query.NavTitle.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.SubTitle))
{
builder.AppendFormat(" AND A.{0} LIKE @NavTitle ", nameof(RB_Web_Nav_ViewModel.SubTitle));
parameters.Add("SubTitle", "%" + query.SubTitle.Trim() + "%");
}
if (query.NavType > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.NavType), (int)query.NavType);
}
if (query.Status > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.Status), (int)query.Status);
}
}
return GetPage<RB_Web_Nav_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(),parameters).ToList();
}
/// <summary>
/// 获取网站导航列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_Nav_ViewModel> GetWebNavListRepository(RB_Web_Nav_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM rb_web_nav AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Web_Nav_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.NavTitle))
{
builder.AppendFormat(" AND A.{0} LIKE @NavTitle ", nameof(RB_Web_Nav_ViewModel.NavTitle));
parameters.Add("NavTitle", "%" + query.NavTitle.Trim() + "%");
}
if (!string.IsNullOrEmpty(query.SubTitle))
{
builder.AppendFormat(" AND A.{0} LIKE @NavTitle ", nameof(RB_Web_Nav_ViewModel.SubTitle));
parameters.Add("SubTitle", "%" + query.SubTitle.Trim() + "%");
}
if (query.NavType > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.NavType), (int)query.NavType);
}
}
return Get<RB_Web_Nav_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Web;
using Edu.Model.ViewModel.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Web
{
/// <summary>
/// 新闻管理仓储层
/// </summary>
public class RB_Web_NewsRepository:BaseRepository<RB_Web_News>
{
/// <summary>
/// 获取网站新闻分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_News_ViewModel> GetWebNewsPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Web_News_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_News AS A
WHERE 1=1
");
if (query == null)
{
return new List<RB_Web_News_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_News_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Title))
{
builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_Web_News_ViewModel.Title));
parameters.Add("Title", "%" + query.Title.Trim() + "%");
}
if (query.Status > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_Nav_ViewModel.Status), (int)query.Status);
}
if (query.TypeId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_News_ViewModel.TypeId), query.TypeId);
}
}
return GetPage<RB_Web_News_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取网站新闻列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_News_ViewModel> GetWebNewsListRepository(RB_Web_News_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_News AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_News_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Web_News_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_News_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.Title))
{
builder.AppendFormat(" AND A.{0} LIKE @Title ", nameof(RB_Web_News_ViewModel.Title));
parameters.Add("Title", "%" + query.Title.Trim() + "%");
}
if (query.TypeId > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_News_ViewModel.TypeId), query.TypeId);
}
}
return Get<RB_Web_News_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.Common.Enum;
using Edu.Model.Entity.Web;
using Edu.Model.ViewModel.Web;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB.Dapper;
namespace Edu.Repository.Web
{
public class RB_Web_NewsTypeRepository:BaseRepository<RB_Web_NewsType>
{
/// <summary>
/// 获取网站新闻类型分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示调试</param>
/// <param name="rowsCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_NewsType_ViewModel> GetWebNewsTypePageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Web_NewsType_ViewModel query)
{
rowsCount = 0;
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_NewsType AS A
WHERE 1=1
");
if (query == null)
{
return new List<RB_Web_NewsType_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_NewsType_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.TypeName))
{
builder.AppendFormat(" AND A.{0} LIKE @TypeName ", nameof(RB_Web_NewsType_ViewModel.TypeName));
parameters.Add("TypeName", "%" + query.TypeName.Trim() + "%");
}
if (query.Status > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_NewsType_ViewModel.Status), (int)query.Status);
}
}
return GetPage<RB_Web_NewsType_ViewModel>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
/// <summary>
/// 获取网站新闻类型列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_Web_NewsType_ViewModel> GetWebNewsTypeListRepository(RB_Web_NewsType_ViewModel query)
{
var parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*
FROM RB_Web_NewsType AS A
WHERE 1=1
");
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_NewsType_ViewModel.Status), (int)DateStateEnum.Normal);
if (query == null)
{
return new List<RB_Web_NewsType_ViewModel>();
}
else
{
if (query.Group_Id > 0)
{
builder.AppendFormat(@" AND A.{0}={1} ", nameof(RB_Web_NewsType_ViewModel.Group_Id), query.Group_Id);
}
if (!string.IsNullOrEmpty(query.TypeName))
{
builder.AppendFormat(" AND A.{0} LIKE @TypeName ", nameof(RB_Web_NewsType_ViewModel.TypeName));
parameters.Add("TypeName", "%" + query.TypeName.Trim() + "%");
}
}
return Get<RB_Web_NewsType_ViewModel>(builder.ToString()).ToList();
}
}
}
using Edu.AOP;
using Edu.Common.API;
using Edu.Common.Enum;
using Edu.Common.Enum.Web;
using Edu.Common.Plugin;
using Edu.Model.ViewModel.Course;
using Edu.Model.ViewModel.Web;
using Edu.Module.Course;
using Edu.Module.User;
using Edu.Module.Web;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Edu.WebApi.Controllers.Web
{
/// <summary>
/// 网站前端接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiExceptionFilter]
[ApiController]
[EnableCors("AllowCors")]
public class WebController : BaseController
{
/// <summary>
/// 网站导航处理类对象
/// </summary>
private readonly WebNavModule navModule = new WebNavModule();
/// <summary>
/// 集团处理类对象
/// </summary>
private readonly GroupModule groupModule = AOPHelper.CreateAOPObject<GroupModule>();
/// <summary>
/// 网站菜单管理处理类对象
/// </summary>
private readonly WebMenuModule menuModule = new WebMenuModule();
/// <summary>
/// 网站新闻管理处理类对象
/// </summary>
private readonly WebNewsModule newsModule = new WebNewsModule();
/// <summary>
/// 课程系列处理类
/// </summary>
private readonly CourseCategoryModule categoryModule = new CourseCategoryModule();
/// <summary>
/// 课程处理类对象
/// </summary>
private readonly CourseModule courseModule = AOP.AOPHelper.CreateAOPObject<CourseModule>();
/// <summary>
/// 获取网站配置
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebSiteConfig()
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
var menuList = menuModule.GetMenuTreeModule(new RB_Web_Menu_ViewModel() { Group_Id = groupId });
var obj = new
{
groupId,
menuList
};
return ApiResult.Success(data: obj);
}
/// <summary>
/// 获取网站导航列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebNavList()
{
var query = new RB_Web_Nav_ViewModel()
{
NavTitle = base.ParmJObj.GetStringValue("NavTitle"),
SubTitle = base.ParmJObj.GetStringValue("SubTitle"),
NavType = (NavTypeEnum)base.ParmJObj.GetInt("NavType"),
Group_Id = base.ParmJObj.GetInt("Group_Id"),
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = navModule.GetWebNavListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取网站新闻类型列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebNewsTypeList()
{
var query = new RB_Web_NewsType_ViewModel()
{
TypeName = base.ParmJObj.GetStringValue("TypeName"),
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = newsModule.GetWebNewsTypeListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取新闻分页
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetWebNewsPage()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Web_News_ViewModel()
{
Title = base.ParmJObj.GetStringValue("Title"),
TypeId = base.ParmJObj.GetInt("TypeId"),
Status = DateStateEnum.Normal,
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = newsModule.GetWebNewsPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
/// <summary>
/// 获取课程分类列表
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public ApiResult GetCourseCategoryList()
{
var query = new RB_Course_Category_ViewModel()
{
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = categoryModule.GetCourseCategoryListModule(query);
return ApiResult.Success(data: list);
}
/// <summary>
/// 获取课程分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCoursePageList()
{
var pageModel = Common.Plugin.JsonHelper.DeserializeObject<ResultPageModel>(RequestParm.Msg.ToString());
var query = new RB_Course_ViewModel()
{
CourseName = base.ParmJObj.GetStringValue("CourseName"),
QCateIds = base.ParmJObj.GetStringValue("QCateIds"),
Status = (DateStateEnum)base.ParmJObj.GetInt("Status"),
IsQPrice = base.ParmJObj.GetInt("IsQPrice"),
IsQTeacher = base.ParmJObj.GetInt("IsQTeacher"),
Group_Id = base.ParmJObj.GetInt("Group_Id")
};
if (query.Group_Id <= 0)
{
string Domain = base.ParmJObj.GetStringValue("Domain");
int groupId = groupModule.GetGroupIdByDomainModule(Domain);
query.Group_Id = groupId;
}
var list = courseModule.GetCoursePageListModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
return ApiResult.Success(data: pageModel);
}
}
}
This diff is collapsed.
......@@ -37,6 +37,7 @@
<ProjectReference Include="..\Edu.Module.StudyAbroad\Edu.Module.StudyAbroad.csproj" />
<ProjectReference Include="..\Edu.Module.System\Edu.Module.System.csproj" />
<ProjectReference Include="..\Edu.Module.User\Edu.Module.User.csproj" />
<ProjectReference Include="..\Edu.Module.Web\Edu.Module.Web.csproj" />
<ProjectReference Include="..\Edu.Repository\Edu.Repository.csproj" />
<ProjectReference Include="..\Edu.ThirdCore\Edu.ThirdCore.csproj" />
</ItemGroup>
......
......@@ -56,7 +56,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Module.OKR", "Edu.Modul
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Test", "Edu.Test\Edu.Test.csproj", "{672E00D8-BF3A-43D0-81DF-A7A70E28DD92}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edu.Module.StudyAbroad", "Edu.Module.StudyAbroad\Edu.Module.StudyAbroad.csproj", "{2ED4527A-351A-49C0-94E0-D926F6EE2844}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Edu.Module.StudyAbroad", "Edu.Module.StudyAbroad\Edu.Module.StudyAbroad.csproj", "{2ED4527A-351A-49C0-94E0-D926F6EE2844}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Edu.Module.Web", "Edu.Module.Web\Edu.Module.Web.csproj", "{380ACD87-3D6C-474C-A0ED-A91BD8E26081}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -136,6 +138,10 @@ Global
{2ED4527A-351A-49C0-94E0-D926F6EE2844}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2ED4527A-351A-49C0-94E0-D926F6EE2844}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2ED4527A-351A-49C0-94E0-D926F6EE2844}.Release|Any CPU.Build.0 = Release|Any CPU
{380ACD87-3D6C-474C-A0ED-A91BD8E26081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{380ACD87-3D6C-474C-A0ED-A91BD8E26081}.Debug|Any CPU.Build.0 = Debug|Any CPU
{380ACD87-3D6C-474C-A0ED-A91BD8E26081}.Release|Any CPU.ActiveCfg = Release|Any CPU
{380ACD87-3D6C-474C-A0ED-A91BD8E26081}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -157,6 +163,7 @@ Global
{FF7B1BD4-0F06-4D22-91EB-9140E65A87AE} = {5B0BC66C-B15F-4174-8966-0968C61F816F}
{DA20EF60-D6D6-4EE3-950B-96F231A2F6F2} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{2ED4527A-351A-49C0-94E0-D926F6EE2844} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
{380ACD87-3D6C-474C-A0ED-A91BD8E26081} = {7AC0A4EC-3215-4FF2-96DC-DE8325ED6915}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {8763B446-FAB1-46BF-9743-F2628533241B}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment