/// <summary> /// 取得更新数据的数据库命令 /// </summary> /// <param name="item">实体数据</param> /// <returns></returns> protected override DapperCommand CreateUpdateCommand(Entity.RoleModule item) { string sql = $"UPDATE {TableName} SET WHERE RoleId=@RoleId And ModuleId=@ModuleId"; return(new DapperCommand() { CommandText = sql, Parameters = item }); }
/// <summary> /// 取得插入数据的数据库命令 /// </summary> /// <param name="item">实体数据</param> /// <returns></returns> protected override DapperCommand CreateInsertCommand(Entity.RoleModule item) { string sql = $"INSERT INTO {TableName} (RoleId,ModuleId) VALUES (@RoleId,@ModuleId)"; return(new DapperCommand() { CommandText = sql, Parameters = item }); }
/// <summary> /// 取得删除数据的数据库命令 /// </summary> /// <param name="item">实体实例</param> /// <returns></returns> protected override DapperCommand CreateDeleteCommand(Entity.RoleModule item) { string sql = $"DELETE FROM {TableName} WHERE RoleId=@RoleId And ModuleId=@ModuleId"; DynamicParameters dynamicParameters = new DynamicParameters(); dynamicParameters.Add("RoleId", item.RoleId); dynamicParameters.Add("ModuleId", item.ModuleId); return(new DapperCommand() { CommandText = sql, Parameters = dynamicParameters }); }