12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using OASystem.Domain;
- using OASystem.Domain.Entities.System;
- using OASystem.Domain.ViewModels.System;
- namespace OASystem.Infrastructure.Repositories.System
- {
- public class SystemMenuPermissionRepository : BaseRepository<Sys_SystemMenuPermission, SystemMenuPermissionView>
- {
- public SystemMenuPermissionRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
- {
- }
- /// <summary>
- /// 分页查询页面表
- /// </summary>
- /// <param name="_SystemMenuPermissionRepository"></param>
- /// <param name="mid">模块id</param>
- /// <param name="pageSize">行数</param>
- /// <param name="currentPage">页码</param>
- /// <returns></returns>
- public Result GetSystemMenuViweData(SystemMenuPermissionRepository _SystemMenuPermissionRepository,int mid,int pageSize,int currentPage)
- {
- Result result = new Result();
- if (currentPage == 0 || pageSize == 0)
- {
- return result;
- }
- string sql = $@"select top {pageSize} * from (select row_number()
- over(order by id asc) as rownumber,*
- from Sys_SystemMenuPermission where mid = {mid} and isdel = 0 and IsEnable = 1 ) temp_row
- where rownumber> {(currentPage - 1) * pageSize};";
- var DBdata = _SystemMenuPermissionRepository.GetListBySqlWithNolock(sql);
- if (DBdata == null || DBdata.Count == 0)
- {
- result.Code = -1;
- result.Msg = "暂无数据!";
- result.Data = new
- {
- DBdata,
- total = 0
- };
- return result;
- }
- var total = _SystemMenuPermissionRepository.Query<Sys_SystemMenuPermission>(x => x.Mid == mid).Count();
- result.Code = 0;
- result.Msg = "成功!";
- result.Data = new
- {
- DBdata = DBdata.Select(x => new SystemMenuPermissionView
- {
- Id = x.Id,
- Name = x.Name,
- Mid = mid,
- SystemMenuCode = x.SystemMenuCode
- }),
- total = total
- };
- return result;
- }
- }
- }
|