移除无用仓储

This commit is contained in:
不做码农 2022-10-14 22:10:36 +08:00
parent 4b0d4a3e74
commit 6c3efee19a
12 changed files with 0 additions and 566 deletions

View File

@ -1,20 +0,0 @@
using System;
using Infrastructure.Attribute;
using ZR.Repository.System;
using ZR.Model.Models;
namespace ZR.Repository
{
/// <summary>
/// 多语言配置仓储
///
/// @author zr
/// @date 2022-05-06
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class CommonLangRepository : BaseRepository<CommonLang>
{
#region
#endregion
}
}

View File

@ -1,91 +0,0 @@
using Infrastructure.Attribute;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.System.Generate;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class GenTableRepository : BaseRepository<GenTable>
{
}
[AppService(ServiceLifetime = LifeTime.Transient)]
public class GenTableColumnRepository : BaseRepository<GenTableColumn>
{
/// <summary>
/// 根据表id批量删除表字段
/// </summary>
/// <param name="tableId"></param>
/// <returns></returns>
public int DeleteGenTableColumn(long[] tableId)
{
return Context.Deleteable<GenTableColumn>().Where(f => tableId.Contains(f.TableId)).ExecuteCommand();
}
/// <summary>
/// 根据表名删除字段
/// </summary>
/// <param name="tableName"></param>
/// <returns></returns>
public int DeleteGenTableColumnByTableName(string tableName)
{
return Context.Deleteable<GenTableColumn>().Where(f => f.TableName == tableName).ExecuteCommand();
}
/// <summary>
/// 获取表所有字段
/// </summary>
/// <param name="tableId"></param>
/// <returns></returns>
public List<GenTableColumn> GenTableColumns(long tableId)
{
return Context.Queryable<GenTableColumn>().Where(f => f.TableId == tableId).OrderBy(x => x.Sort).ToList();
}
/// <summary>
/// 插入表字段
/// </summary>
/// <param name="tableColumn"></param>
/// <returns></returns>
public int InsertGenTableColumn(List<GenTableColumn> tableColumn)
{
return Context.Insertable(tableColumn).IgnoreColumns(x => new { x.Remark }).ExecuteCommand();
}
/// <summary>
/// 批量更新表字段
/// </summary>
/// <param name="tableColumn"></param>
/// <returns></returns>
public int UpdateGenTableColumn(List<GenTableColumn> tableColumn)
{
return Context.Updateable(tableColumn)
.WhereColumns(it => new { it.ColumnId, it.TableId})
.UpdateColumns(it => new
{
it.ColumnComment,
it.CsharpField,
it.CsharpType,
it.IsQuery,
it.IsEdit,
it.IsInsert,
it.IsList,
it.QueryType,
it.HtmlType,
it.IsRequired,
it.Sort,
it.Update_time,
it.DictType,
it.Update_by,
it.Remark,
it.IsSort
})
.ExecuteCommand();
}
}
}

View File

@ -1,19 +0,0 @@
using System;
using Infrastructure.Attribute;
using ZR.Model.System;
namespace ZR.Repository
{
/// <summary>
/// 参数配置仓储接口的实现
///
/// @author zhaorui
/// @date 2021-09-29
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysConfigRepository : BaseRepository<SysConfig>
{
#region
#endregion
}
}

View File

@ -1,23 +0,0 @@
using Infrastructure.Attribute;
using System.Collections.Generic;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 角色部门
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysRoleDeptRepository : BaseRepository<SysRoleDept>
{
/// <summary>
/// 根据角色获取菜单id
/// </summary>
/// <param name="roleId"></param>
/// <returns></returns>
public List<SysRoleDept> SelectRoleDeptByRoleId(long roleId)
{
return Context.Queryable<SysRoleDept>().Where(it => it.RoleId == roleId).ToList();
}
}
}

View File

@ -1,124 +0,0 @@
using Infrastructure.Attribute;
using Infrastructure.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using ZR.Model;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 字典数据
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysDictDataRepository : BaseRepository<SysDictData>
{
/// <summary>
/// 字典类型数据搜索
/// </summary>
/// <param name="dictData"></param>
/// <param name="pagerInfo"></param>
/// <returns></returns>
public PagedInfo<SysDictData> SelectDictDataList(SysDictData dictData, PagerInfo pagerInfo)
{
var exp = Expressionable.Create<SysDictData>();
exp.AndIF(!string.IsNullOrEmpty(dictData.DictLabel), it => it.DictLabel.Contains(dictData.DictLabel));
exp.AndIF(!string.IsNullOrEmpty(dictData.Status), it => it.Status == dictData.Status);
exp.AndIF(!string.IsNullOrEmpty(dictData.DictType), it => it.DictType == dictData.DictType);
return GetPages(exp.ToExpression(), pagerInfo);
}
/// <summary>
/// 根据字典类型查询
/// </summary>
/// <param name="dictData"></param>
/// <returns></returns>
public List<SysDictData> SelectDictDataByType(string dictType)
{
return Context.Queryable<SysDictData>().Where(f => f.Status == "0" && f.DictType == dictType)
.OrderBy(it => it.DictSort)
.ToList();
}
/// <summary>
/// 根据字典类型查询
/// </summary>
/// <param name="dictData"></param>
/// <returns></returns>
public List<SysDictData> SelectDictDataByTypes(string[] dictTypes)
{
return Context.Queryable<SysDictData>().Where(f => f.Status == "0" && dictTypes.Contains(f.DictType))
.OrderBy(it => it.DictSort)
.ToList();
}
/// <summary>
/// 新增保存字典数据信息
/// </summary>
/// <param name="dict"></param>
/// <returns></returns>
public long InsertDictData(SysDictData dict)
{
var result = Context.Insertable(dict).ExecuteReturnBigIdentity();
return result;
}
/// <summary>
/// 修改数据
/// </summary>
/// <param name="dict"></param>
/// <returns></returns>
public long UpdateDictData(SysDictData dict)
{
return Context.Updateable<SysDictData>()
.SetColumns(t => new SysDictData()
{
Remark = dict.Remark,
Update_time = DateTime.Now,
DictSort = dict.DictSort,
DictLabel = dict.DictLabel,
DictValue = dict.DictValue,
Status = dict.Status,
CssClass = dict.CssClass,
ListClass = dict.ListClass
})
.Where(f => f.DictCode == dict.DictCode).ExecuteCommand();
}
/// <summary>
/// 批量删除字典数据信息
/// </summary>
/// <param name="dictCodes"></param>
/// <returns></returns>
public int DeleteDictDataByIds(long[] dictCodes)
{
return Delete(dictCodes);
}
/// <summary>
/// 同步修改字典类型
/// </summary>
/// <param name="old_dictType">旧字典类型</param>
/// <param name="new_dictType">新字典类型</param>
/// <returns></returns>
public int UpdateDictDataType(string old_dictType, string new_dictType)
{
//只更新DictType字段根据where条件
return Context.Updateable<SysDictData>()
.SetColumns(t => new SysDictData() { DictType = new_dictType })
.Where(f => f.DictType == old_dictType)
.ExecuteCommand();
}
/// <summary>
/// 根据字典类型查询自定义sql
/// </summary>
/// <param name="dictType"></param>
/// <returns></returns>
public List<SysDictData> SelectDictDataByCustomSql(SysDictType sysDictType)
{
return Context.Ado.SqlQuery<SysDictData>(sysDictType?.CustomSql).ToList();
}
}
}

View File

@ -1,56 +0,0 @@
using Infrastructure.Attribute;
using SqlSugar;
using System.Collections.Generic;
using ZR.Model;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 字典
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysDictRepository : BaseRepository<SysDictType>
{
public List<SysDictType> GetAll()
{
return Context.Queryable<SysDictType>().ToList();
}
/// <summary>
/// 查询字段类型列表
/// </summary>
/// <param name="dictType">实体模型</param>
/// <returns></returns>
public PagedInfo<SysDictType> SelectDictTypeList(SysDictType dictType, PagerInfo pager)
{
var exp = Expressionable.Create<SysDictType>();
exp.AndIF(!string.IsNullOrEmpty(dictType.DictName), it => it.DictName.Contains(dictType.DictName));
exp.AndIF(!string.IsNullOrEmpty(dictType.Status), it => it.Status == dictType.Status);
exp.AndIF(!string.IsNullOrEmpty(dictType.DictType), it => it.DictType.Contains(dictType.DictType));
exp.AndIF(!string.IsNullOrEmpty(dictType.Type), it => it.Type.Equals(dictType.Type));
return GetPages(exp.ToExpression(), pager, f => f.DictId, OrderByType.Desc);
}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public int DeleteDictTypeByIds(long[] id)
{
return Context.Deleteable<SysDictType>().In(id).ExecuteCommand();
}
/// <summary>
/// 修改
/// </summary>
/// <param name="sysDictType"></param>
/// <returns></returns>
public int UpdateDictType(SysDictType dictType)
{
return Context.Updateable(dictType).IgnoreColumns(it => new { dictType.Create_by }).ExecuteCommand();
}
}
}

View File

@ -1,89 +0,0 @@
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using System.Collections.Generic;
using ZR.Model;
using ZR.Model.System.Dto;
using ZR.Model.System;
using SqlSugar;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysLogininfoRepository : BaseRepository<SysLogininfor>
{
/// <summary>
/// 查询登录日志
/// </summary>
/// <param name="logininfoDto"></param>
/// <param name="pager"></param>
/// <returns></returns>
public PagedInfo<SysLogininfor> GetLoginLog(SysLogininfor logininfoDto, PagerInfo pager)
{
var exp = Expressionable.Create<SysLogininfor>();
exp.And(it => it.LoginTime >= logininfoDto.BeginTime && it.LoginTime <= logininfoDto.EndTime);
exp.AndIF(logininfoDto.Ipaddr.IfNotEmpty(), f => f.Ipaddr == logininfoDto.Ipaddr);
exp.AndIF(logininfoDto.UserName.IfNotEmpty(), f => f.UserName.Contains(logininfoDto.UserName));
exp.AndIF(logininfoDto.Status.IfNotEmpty(), f => f.Status == logininfoDto.Status);
var query = Context.Queryable<SysLogininfor>()
.Where(exp.ToExpression())
.OrderBy(it => it.InfoId, OrderByType.Desc);
return query.ToPage(pager);
}
/// <summary>
/// 登录日志记录
/// </summary>
/// <param name="sysLogininfor"></param>
/// <returns></returns>
public void AddLoginInfo(SysLogininfor sysLogininfor)
{
int result = Context.Insertable(sysLogininfor)
.ExecuteReturnIdentity();
}
/// <summary>
/// 清空登录日志
/// </summary>
public void TruncateLogininfo()
{
string sql = "truncate table sys_logininfor";
Context.Ado.ExecuteCommand(sql);
}
/// <summary>
/// 删除登录日志
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public int DeleteLogininforByIds(long[] ids)
{
return Context.Deleteable<SysLogininfor>().In(ids).ExecuteCommand();
}
/// <summary>
/// 登录
/// </summary>
/// <param name="user">登录实体</param>
/// <returns></returns>
public SysUser Login(LoginBodyDto user)
{
return Context.Queryable<SysUser>().First(it => it.UserName == user.Username && it.Password == user.Password);
}
/// <summary>
/// 修改登录信息
/// </summary>
/// <param name="user"></param>
/// <param name="userId"></param>
/// <returns></returns>
public void UpdateLoginInfo(LoginBodyDto user, long userId)
{
var db = Context;
db.Updateable(new SysUser() { LoginIP = user.LoginIP, LoginDate = db.GetDate(), UserId = userId })
.UpdateColumns(it => new { it.LoginIP, it.LoginDate })
.ExecuteCommand();
}
}
}

View File

@ -1,72 +0,0 @@
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using System.Collections.Generic;
using ZR.Model;
using ZR.Model.System.Dto;
using ZR.Model.System;
using SqlSugar;
using Infrastructure.Model;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysOperLogRepository : BaseRepository<SysOperLog>
{
/// <summary>
/// 查询操作日志
/// </summary>
/// <param name="sysOper"></param>
/// <param name="pagerInfo">分页数据</param>
/// <returns></returns>
public PagedInfo<SysOperLog> GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo)
{
var exp = Expressionable.Create<SysOperLog>();
exp.And(it => it.OperTime >= sysOper.BeginTime && it.OperTime <= sysOper.EndTime);
exp.AndIF(sysOper.Title.IfNotEmpty(), it => it.Title.Contains(sysOper.Title));
exp.AndIF(sysOper.operName.IfNotEmpty(), it => it.OperName.Contains(sysOper.operName));
exp.AndIF(sysOper.BusinessType != -1, it => it.BusinessType == sysOper.BusinessType);
exp.AndIF(sysOper.Status != -1, it => it.Status == sysOper.Status);
return GetPages(exp.ToExpression(), pagerInfo, x => x.OperId, OrderByType.Desc);
}
/// <summary>
/// 添加操作日志
/// </summary>
/// <param name="sysOperLog"></param>
/// <returns></returns>
public void AddSysOperLog(SysOperLog sysOperLog)
{
Context.Insertable(sysOperLog).ExecuteCommandAsync();
}
/// <summary>
/// 清空日志
/// </summary>
public void ClearOperLog()
{
string sql = "truncate table sys_oper_log";
Context.Ado.ExecuteCommand(sql);
}
/// <summary>
/// 删除操作日志
/// </summary>
/// <param name="operIds"></param>
/// <returns></returns>
public int DeleteOperLogByIds(long[] operIds)
{
return Context.Deleteable<SysOperLog>().In(operIds).ExecuteCommand();
}
/// <summary>
/// 查询操作日志
/// </summary>
/// <param name="operId"></param>
/// <returns></returns>
public SysOperLog SelectOperLogById(long operId)
{
return Context.Queryable<SysOperLog>().InSingle(operId);
}
}
}

View File

@ -1,15 +0,0 @@
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.System;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysPostRepository : BaseRepository<SysPost>
{
}
}

View File

@ -1,15 +0,0 @@
using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.System;
namespace ZR.Repository.System
{
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysTasksQzRepository: BaseRepository<SysTasksQz>
{
}
}

View File

@ -1,27 +0,0 @@
using Infrastructure.Attribute;
using SqlSugar;
using System.Collections.Generic;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 用户岗位
/// </summary>
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysUserPostRepository : BaseRepository<SysUserPost>
{
/// <summary>
/// 获取用户岗位
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<SysPost> SelectPostsByUserId(long userId)
{
return Context.Queryable<SysPost, SysUserPost>((p, up) => new JoinQueryInfos(
JoinType.Left, up.PostId == p.PostId
)).Where((p, up) => up.UserId == userId)
.Select<SysPost>().ToList();
}
}
}

View File

@ -4,21 +4,6 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="System\CommonLangRepository.cs" />
<Compile Remove="System\GenTableRepository.cs" />
<Compile Remove="System\SysConfigRepository.cs" />
<Compile Remove="System\SysDeptRepository.cs" />
<Compile Remove="System\SysDictDataRepository.cs" />
<Compile Remove="System\SysDictRepository.cs" />
<Compile Remove="System\SysLogininfoRepository.cs" />
<Compile Remove="System\SysNoticeRepository.cs" />
<Compile Remove="System\SysOperLogRepository.cs" />
<Compile Remove="System\SysPostRepository.cs" />
<Compile Remove="System\SysTasksQzRepository.cs" />
<Compile Remove="System\SysUserPostRepository.cs" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /> <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />
<ProjectReference Include="..\ZR.Model\ZR.Model.csproj" /> <ProjectReference Include="..\ZR.Model\ZR.Model.csproj" />