src/Czar.Cms.Repository.SqlServer/ManagerRoleRepository.cs
(开头部分) 6KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/**
*┌──────────────────────────────────────────────────────────────┐
*│ 描 述:后台管理员角色接口实现
*│ 作 者:yilezhu
*│ 版 本:1.0 模板代码自动生成
*│ 创建时间:2018-12-18 13:28:43
*└──────────────────────────────────────────────────────────────┘
*┌──────────────────────────────────────────────────────────────┐
*│ 命名空间: Czar.Cms.Repository.SqlServer
*│ 类 名: ManagerRoleRepository
*└──────────────────────────────────────────────────────────────┘
*/
using Czar.Cms.Core.DbHelper;
using Czar.Cms.Core.Options;
using Czar.Cms.Core.Repository;
using Czar.Cms.IRepository;
using Czar.Cms.Models;
using Microsoft.Extensions.Options;
using System;
using System.Threading.Tasks;
using Dapper;
using System.Linq;
using System.Collections.Generic;
namespace Czar.Cms.Repository.SqlServer
{
public class ManagerRoleRepository:BaseRepository<ManagerRole,Int32>, IManagerRoleRepository
{
public ManagerRoleRepository(IOptionsSnapshot<DbOption> options)
{
_dbOption = options.Get("CzarCms");
if (_dbOption == null)
{
throw new ArgumentNullException(nameof(DbOption));
}
_dbConnection = ConnectionFactory.CreateConnection(_dbOption.DbType, _dbOption.ConnectionString);
}
public int DeleteLogical(int[] ids)
{
string sql= "update [ManagerRole] set IsDelete=1 where Id in @Ids";
return _dbConnection.Execute(sql, new {
Ids=ids
});
}
public async Task<int> DeleteLogicalAsync(int[] ids)
{
string sql = "update [ManagerRole] set IsDelete=1 where Id in @Ids";
return await _dbConnection.ExecuteAsync(sql, new {
Ids=ids
});
}
public string GetNameById(int id)
{
var item = Get(id);
return item == null ? "角色不存在" : item.RoleName;
}
后面还有 112 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
