FreeSql

官网  
实体特性 
Ado 它包括所有对 SQL 操作的封装,提供 ExecuteReader、ExecuteDataSet、ExecuteDataTable、ExecuteNonQuery、ExecuteScalar 等方法,使用起来和传统 SqlHelper 一样。

1、安装包

dotnet add package FreeSql
dotnet add package FreeSql.Provider.SqlServer

-- 仓储
dotnet add package FreeSql.DbContext

2、Program.cs 文件

using FreeSql;
using Microsoft.OpenApi.Models;
using System.Configuration;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

#region FreeSql

Func<IServiceProvider, IFreeSql> fsqlFactory = r =>
{
    IFreeSql fsql = new FreeSqlBuilder()
    .UseConnectionString(DataType.SqlServer, builder.Configuration.GetConnectionString("SqlServerDefault"))
    //.UseConnectionString(FreeSql.DataType.SqlServer, r.GetService<IConfiguration>()["ConnectionStrings:Default"])
    .UseMonitorCommand(cmd => Console.WriteLine($"Sql:{cmd.CommandText}"))//监听SQL语句
    //.UseAutoSyncStructure(true) //自动同步实体结构到数据库,FreeSql不会扫描程序集,只有CRUD时才会生成表。
    .UseLazyLoading(false)
    .UseNoneCommandParameter(true)
    .Build();
    return fsql;
};
/// 仓储
builder.Services.AddFreeRepository();
builder.Services.AddScoped<UnitOfWorkManager>();

builder.Services.AddSingleton(fsqlFactory);

#endregion

var app = builder.Build();

// Configure the HTTP request pipeline.

app.UseAuthorization();

//在项目启动时,从容器中获取IFreeSql实例,并执行一些操作:同步表,种子数据,FluentAPI等
using (IServiceScope serviceScope = app.Services.CreateScope())
{
    var fsql = serviceScope.ServiceProvider.GetRequiredService<IFreeSql>();
    //fsql.CodeFirst.SyncStructure(typeof(Topic));//Topic 为要同步的实体类//同步实体类到数据库
}

app.MapControllers();

app.Run();

3、appsettings.json 文件

{
  "ConnectionStrings": {
    "SqlServerDefault": "data source=.;initial catalog=dbTest;uid=sa;password=000000;TrustServerCertificate=True;",
    "Default": "Data Source=localhost;Port=3306;Database=dbTest;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true;MinimumPoolSize=50;MaximumPoolSize=1000",
    "DbType": "MySql"
  },
  "AllowedHosts": "*"
}

4、FreeSqlController.cs 文件

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;

namespace Trial.WebAPI.Controllers
{
    [Route("api/FreeSql/[action]")]
    [ApiController]
    public class FreeSqlController : ControllerBase
    {
        private readonly IFreeSql _fsql;

        public FreeSqlController(IFreeSql freeSql)
        {
            _fsql = freeSql;
        }

        /// <summary>
        /// 单条插入
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult Insert()
        {
            var model = new Transfer_Amount_Relation_copy2_FreeSql
            {
                UserName = "UserName",
                ActualPaymentFee = 100,
                Recipient = "Recipient",
                BankCardNumber = "BankCardNumber",
                IDNumber = "IDNumber",
                PaymentTime = DateTime.Now,
                OrderNo = "OrderNo",
                InputDetailId = 1,
                BigAmountId = 1,
                UsageAmount = 10
            };

            /// 返回即将执行的 SQL 语句
            string sqlString = _fsql.Insert(model).ToSql();

            /// 返回插入后的记录
            List<Transfer_Amount_Relation_copy2_FreeSql> t1 = _fsql.Insert(model).ExecuteInserted();

            /// 返回影响的行数
            int t2 = _fsql.Insert(model).ExecuteAffrows();

            /// 返回自增
            /// 表有自增列,插入数据后应该要返回 id
            long id = _fsql.Insert(model).ExecuteIdentity();

            return Ok(new { data = model });
        }

        /// <summary>
        /// 批量插入
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult BulkCopy()
        {
            var items = new List<Transfer_Amount_Relation_copy2_FreeSql>();
            for (int i = 0; i < 10; i++)
            {
                items.Add(new Transfer_Amount_Relation_copy2_FreeSql
                {
                    UserName = "UserName" + i.ToString(),
                    ActualPaymentFee = 100,
                    Recipient = "Recipient" + i.ToString(),
                    BankCardNumber = "BankCardNumber" + i.ToString(),
                    IDNumber = "IDNumber" + i.ToString(),
                    PaymentTime = DateTime.Now,
                    OrderNo = "OrderNo",
                    InputDetailId = 1,
                    BigAmountId = 1,
                    UsageAmount = 10
                });
            }

            /// 批量插入 Affrows
            int t = _fsql.Insert(items).ExecuteAffrows();

            /// 批量插入 SqlBulkCopy
            _fsql.Insert(items).ExecuteSqlBulkCopy();

            return Ok();
        }

        [HttpGet]
        public IActionResult SelectTest()
        {
            // 如果查询结果为空,ToOne方法会返回null,而不是抛出异常‌
            var toOne = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.Id == 1000).ToOne();

            // 如果查询结果为空,First方法会抛出异常(经过测试,不会抛异常)
            var first = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>().Where(u => u.Id == 1000).First();

            return Ok(new { data = toOne });
        }

        [HttpGet]
        public IActionResult PageTest()
        {
            long total = 0;
            decimal actualPaymentFee = 100;

            #region 分页1
            var page1 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>()
                .WhereIf(actualPaymentFee > 0, x => x.ActualPaymentFee > 0)
                .OrderBy(b => b.Id)
                .Skip(0)
                .Limit(10) //第100行-110行的记录
                .ToList();
            #endregion

            #region 分页2
            var page2 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>()
                .Where(u => u.ActualPaymentFee > 0)
                .OrderBy(u => u.ActualPaymentFee)
                .Count(out total) //总记录数量
                .Page(1, 20)
                .ToList();
            #endregion

            #region 分页3
            /// 数据量大一般不建议查 Count/CountAsync,而应该采用流式分页(上一页、下一页、不返回总数量)

            total = 0;
            var page3 = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>()
                .Where(u => u.ActualPaymentFee > 0)
                .OrderBy(u => u.ActualPaymentFee);

            total = page3.Count();

            var list = page3.Page(1, 30).ToList();
            #endregion


            return Ok(new { data = list });
        }

        /// <summary>
        /// sql 语句
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult WithSqlTest()
        {
            #region select
            var list = _fsql.Select<Transfer_Amount_Relation_copy2_FreeSql>()
                .WithSql("select * from Transfer_Amount_Relation_copy2 where ActualPaymentFee > @val", new { val = 0 })
                .Page(1, 10)
                .ToList();
            #endregion

            #region select
            var sql = "select top 10 * from Transfer_Amount_Relation_copy2";
            var list1 = _fsql.Ado.Query<Transfer_Amount_Relation_copy2_FreeSql>(sql).ToList();
            #endregion

            #region INSERT
            var insertSql = "INSERT INTO [Transfer_Amount_Relation_copy2]" +
                "([UserName], [ActualPaymentFee], [Recipient], [BankCardNumber], [IDNumber], [OrderNo], [PaymentTime], [BigAmountId], [InputDetailId], [UsageAmount]) " +
                "VALUES" +
                "(@UserName, @ActualPaymentFee, @Recipient, @BankCardNumber, @IDNumber, @OrderNo, @PaymentTime, @BigAmountId, @InputDetailId, @UsageAmount)";

            var affectedRows = _fsql.Ado.ExecuteNonQuery(insertSql, new
            {

                UserName = "UserName100",
                ActualPaymentFee = 100,
                Recipient = "Recipient",
                BankCardNumber = "BankCardNumber",
                IDNumber = "IDNumber",
                OrderNo = "OrderNo",
                PaymentTime = DateTime.Now,
                BigAmountId = 1,
                InputDetailId = 1,
                UsageAmount = 10
            });
            #endregion

            return Ok(new { data = list });
        }

        /// <summary>
        /// sql 语句
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public IActionResult AdoTest()
        {
            #region 多条记录
            var list = _fsql.Ado.Query<Transfer_Amount_Relation_copy2>("select top 10 * from Transfer_Amount_Relation_copy2").ToList();
            #endregion

            #region 单条记录
            var model = _fsql.Ado.QuerySingle<Transfer_Amount_Relation_copy2>("select * from Transfer_Amount_Relation_copy2 where Id = @Id", new { Id = 50 });
            #endregion

            #region 多个结果集
            var sql1 = "select top 10 * from Transfer_Amount_Relation_copy2";
            var sql2 = "select top 20 * from Transfer_Amount_Relation_copy2";
            var result = _fsql.Ado.Query<Transfer_Amount_Relation_copy2, Transfer_Amount_Relation_copy2>($"{sql1};{sql2}");
            List<Transfer_Amount_Relation_copy2> list1 = result.Item1;
            List<Transfer_Amount_Relation_copy2> list2 = result.Item2;
            #endregion

            #region INSERT
            var insertSql = "INSERT INTO [Transfer_Amount_Relation_copy2]" +
                "([UserName], [ActualPaymentFee], [Recipient], [BankCardNumber], [IDNumber], [OrderNo], [PaymentTime], [BigAmountId], [InputDetailId], [UsageAmount]) " +
                "VALUES" +
                "(@UserName, @ActualPaymentFee, @Recipient, @BankCardNumber, @IDNumber, @OrderNo, @PaymentTime, @BigAmountId, @InputDetailId, @UsageAmount)";

            var affectedRows = _fsql.Ado.ExecuteNonQuery(insertSql, new
            {

                UserName = "UserName100",
                ActualPaymentFee = 100,
                Recipient = "Recipient",
                BankCardNumber = "BankCardNumber",
                IDNumber = "IDNumber",
                OrderNo = "OrderNo",
                PaymentTime = DateTime.Now,
                BigAmountId = 1,
                InputDetailId = 1,
                UsageAmount = 10
            });
            #endregion

            return Ok(new { data = list });
        }
    }
}

================ 仓储 ================
5、SimpleFreeSqlRepository.cs 文件

using CodeFirst.Entity;
using FreeSql;

namespace Trial.Repository.AmountRelation
{
    public interface ISimpleFreeSqlRepository
    {
        Task<long> Create(Transfer_Amount_Relation_copy2_FreeSql input);

        Task<long> Modify(Transfer_Amount_Relation_copy2_FreeSql input);

        Task<Transfer_Amount_Relation_copy2_FreeSql> GetAsync(long id);

        Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageList();

        /// <summary>
        /// WithSql
        /// </summary>
        /// <returns></returns>
        Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageListWithSql();
    }

    public class SimpleFreeSqlRepository : BaseRepository<Transfer_Amount_Relation_copy2_FreeSql>, ISimpleFreeSqlRepository
    {
        public SimpleFreeSqlRepository(IFreeSql fsql) : base(fsql) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<long> Create(Transfer_Amount_Relation_copy2_FreeSql input)
        {
            Transfer_Amount_Relation_copy2_FreeSql model = await InsertAsync(input);
            return model.Id;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<long> Modify(Transfer_Amount_Relation_copy2_FreeSql input)
        {
            int count = await UpdateAsync(input);
            return count;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<Transfer_Amount_Relation_copy2_FreeSql> GetAsync(long id)
        {
            var model = await Select.WhereDynamic(id).ToOneAsync<Transfer_Amount_Relation_copy2_FreeSql>();

            var model1 = Select.Where(x => x.Id == id).First();

            return model;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public async Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageList()
        {
            var list = await Select.Where(u => u.ActualPaymentFee > 0)
                .Where(x => x.Id > 0)
                .OrderBy(x => x.Id)
                .Skip(1)
                .Take(100)
                .ToListAsync();
            return list;
        }

        public async Task<List<Transfer_Amount_Relation_copy2_FreeSql>> GetPageListWithSql()
        {
            string sql = "select * from Transfer_Amount_Relation_copy2";
            var list = await Select.WithSql(sql)
                .Where(x => x.Id > 0)
                .OrderBy(x => x.Id)
                .Skip(1)
                .Take(100)
                .ToListAsync();
            return list;
        }
    }
}

6、FreeSqlSimpleController.cs 仓储 

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;
using Trial.Repository.AmountRelation;

namespace Trial.WebAPI.Controllers
{
    [Route("api/FreeSqlSimple/[action]")]
    [ApiController]
    public class FreeSqlSimpleController : ControllerBase
    {
        private readonly ISimpleFreeSqlRepository _repository;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="repository"></param>
        public FreeSqlSimpleController(ISimpleFreeSqlRepository repository)
        {
            _repository = repository;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ActionResult> Get()
        {
            /// 插入
            long id = await _repository.Create(new Transfer_Amount_Relation_copy2_FreeSql
            {
                UserName = "UserName-FreeSql",
                ActualPaymentFee = 100,
                Recipient = "Recipient-FreeSql",
                BankCardNumber = "BankCardNumber-FreeSql",
                IDNumber = "IDNumber-FreeSql",
                PaymentTime = DateTime.Now,
                OrderNo = "OrderNo-FreeSql",
                InputDetailId = 1,
                BigAmountId = 1,
                UsageAmount = 10
            });

            /// 查询单条
            var model = await _repository.GetAsync(50);

            /// 分页
            var list = await _repository.GetPageList();

            /// 分页
            var withSqlList = await _repository.GetPageListWithSql();

            return Ok();
        }
    }
}

7、实体类   实体特性  

using FreeSql.DataAnnotations;

namespace CodeFirst.Entity
{
    /// <summary>
    /// FreeSql
    /// </summary>
    [Table(Name = "Transfer_Amount_Relation_copy2")]
    public class Transfer_Amount_Relation_copy2_FreeSql
    {
        [Column(IsIdentity = true, IsPrimary = true)]
        public long Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 实付费用
        /// </summary>
        public decimal ActualPaymentFee { get; set; }

        /// <summary>
        /// 收款人
        /// </summary>
        public string Recipient { get; set; }

        /// <summary>
        /// 银行卡号
        /// </summary>
        public string BankCardNumber { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        public string IDNumber { get; set; }

        /// <summary>
        /// 订单号
        /// </summary>
        public string OrderNo { get; set; }

        /// <summary>
        /// 支付时间
        /// </summary>
        public DateTime PaymentTime { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int BigAmountId { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int InputDetailId { get; set; }

        /// <summary>
        /// 使用金额
        /// </summary>
        public decimal UsageAmount { get; set; }
    }
}

==================== 仓储 abstract 抽象类 ====================
用于 仓储 扩展方法,自定义方法
创建自定义 IRepositoryBase.cs 接口文件,并且继承 FreeSql框架本身的 IBaseRepository 接口

using System;
using System.Linq.Expressions;
using FreeSql;

namespace Trial.Repository.FreeSql
{
    public interface IRepositoryBase<TEntity, TKey> : IBaseRepository<TEntity, TKey> where TEntity : class
    {
        /// <summary>
        /// 获得Dto
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<TDto> GetAsync<TDto>(TKey id);

        /// <summary>
        /// 根据条件获取实体
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> exp);

        /// <summary>
        /// 根据条件获取Dto
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        Task<TDto> GetAsync<TDto>(Expression<Func<TEntity, bool>> exp);

        /// <summary>
        /// 软删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> SoftDeleteAsync(TKey id);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<bool> SoftDeleteAsync(TKey[] id);
    }

    public interface IRepositoryBase<TEntity> : IRepositoryBase<TEntity, long> where TEntity : class
    {
    }
}

创建自定义 RepositoryBase.cs 类文件,并且继承 FreeSql框架本身的 BaseRepository 类

using FreeSql;
using System.Linq.Expressions;

namespace Trial.Repository.FreeSql
{
    public abstract class RepositoryBase<TEntity, TKey> : BaseRepository<TEntity, TKey> where TEntity : class, new()
    {
        protected RepositoryBase(UnitOfWorkManager uowm) : base(uowm.Orm)
        {
            uowm.Binding(this);
        }

        /// <summary>
        /// 查询单条
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual Task<TDto> GetAsync<TDto>(TKey id)
        {
            return Select.WhereDynamic(id).ToOneAsync<TDto>();
        }

        /// <summary>
        /// 根据条件获取实体
        /// </summary>
        /// <param name="exp"></param>
        /// <returns></returns>
        public virtual Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> exp)
        {
            return Select.Where(exp).ToOneAsync();
        }

        /// <summary>
        /// 根据条件获取Dto
        /// </summary>
        /// <typeparam name="TDto"></typeparam>
        /// <param name="exp"></param>
        /// <returns></returns>
        public virtual Task<TDto> GetAsync<TDto>(Expression<Func<TEntity, bool>> exp)
        {
            return Select.Where(exp).ToOneAsync<TDto>();
        }

        public async Task<bool> SoftDeleteAsync(TKey id)
        {
            await UpdateDiy.SetDto(new { IsDeleted = true }).WhereDynamic(id).ExecuteAffrowsAsync();
            return true;
        }

        public async Task<bool> SoftDeleteAsync(TKey[] ids)
        {
            await UpdateDiy.SetDto(new { IsDeleted = true }).WhereDynamic(ids).ExecuteAffrowsAsync();
            return true;
        }

    }

    public abstract class RepositoryBase<TEntity> : RepositoryBase<TEntity, long> where TEntity : class, new()
    {
        protected RepositoryBase(UnitOfWorkManager uowm) : base(uowm)
        {
        }
    }
}

*、AmountRelationFreeSqlRepository.cs 文件
因为继承了 FreeSql框架本身的 IBaseRepository 接口,可以直接使用InsertAsync,UpdateAsync,DeleteAsync 等方法,所以不用再自定义 增删改查 方法 

using CodeFirst.Entity;
using FreeSql;
using Trial.Repository.FreeSql;

namespace Trial.Repository.AmountRelation
{
    /// <summary>
    /// 继承了基类
    /// </summary>
    public interface IAmountRelationFreeSqlRepository : IRepositoryBase<Transfer_Amount_Relation_copy2_FreeSql>
    {
    }

    public class AmountRelationFreeSqlRepository : RepositoryBase<Transfer_Amount_Relation_copy2_FreeSql>, IAmountRelationFreeSqlRepository
    {
        public AmountRelationFreeSqlRepository(UnitOfWorkManager uowm) : base(uowm)
        {
        }
    }
}

*、FreeSqlAmountRelationController.cs 文件 

using CodeFirst.Entity;
using Microsoft.AspNetCore.Mvc;
using Trial.Repository.AmountRelation;

namespace Trial.WebAPI.Controllers
{
    [Route("api/AmountRelationFreeSql/[action]")]
    [ApiController]
    public class FreeSqlAmountRelationController : ControllerBase
    {
        private readonly IAmountRelationFreeSqlRepository _repository;

        public FreeSqlAmountRelationController(IAmountRelationFreeSqlRepository repository)
        {
            _repository = repository;
        }

        [HttpGet]
        public async Task<ActionResult> Get()
        {
            var info = await _repository.InsertAsync(new Transfer_Amount_Relation_copy2_FreeSql
            {
                UserName = "UserName-FreeSql",
                ActualPaymentFee = 100,
                Recipient = "Recipient-FreeSql",
                BankCardNumber = "BankCardNumber-FreeSql",
                IDNumber = "IDNumber-FreeSql",
                PaymentTime = DateTime.Now,
                OrderNo = "OrderNo-FreeSql",
                InputDetailId = 1,
                BigAmountId = 1,
                UsageAmount = 10

            });

            int count = await _repository.UpdateAsync(new Transfer_Amount_Relation_copy2_FreeSql
            {
                Id = info.Id,
                UserName = "UserName-FreeSql-修改",
                ActualPaymentFee = 100,
                Recipient = "Recipient-FreeSql",
                BankCardNumber = "BankCardNumber-FreeSql",
                IDNumber = "IDNumber-FreeSql",
                PaymentTime = DateTime.Now,
                OrderNo = "OrderNo-FreeSql",
                InputDetailId = 1,
                BigAmountId = 1,
                UsageAmount = 10

            });

            /// 框架方法
            var result0 = await _repository.GetAsync(50);

            /// 自定义方法
            var result1 = await _repository.GetAsync<Transfer_Amount_Relation_copy2_FreeSql>(51);

            /// 自定义方法
            var result2 = await _repository.GetAsync(x => x.Id == 52);

            return Ok();
        }
    }
}

*
*
*
*
*
*

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/943301.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Windows 使用 非安装版MySQL 8

1.下载MySQL 8 https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.40-winx64.zip 2.创建my.ini 下载解压后&#xff0c;发现根目录没有my.ini文件&#xff0c;需手动创建 my.ini # For advice on how to change settings please see # http://dev.mysql.com/doc/refma…

海外招聘丨 苏黎世联邦理工学院—机器学习在社会和政治科学中的应用博士后

雇主简介 苏黎世联邦理工学院是世界领先的科技大学之一。我们以优质的教育、尖端的基础研究和将新知识直接转化为社会而闻名。来自 120 多个国家的 30,000 多名学生认为我们的大学是一个鼓励独立思考和激励卓越的环境的地方。 我们位于欧洲中心&#xff0c;但与世界各地建立联…

微信小程序中遇到过的问题

记录微信小程序中遇到的问题&#xff08;持续更新ing&#xff09; 问题描述&#xff1a;1. WXML中无法直接调用JavaScript方法。2. css中无法直接引用背景图片。3. 关于右上角胶囊按钮。4. 数据绑定问题。5. 事件处理问题。 问题描述&#xff1a; 1. WXML中无法直接调用JavaSc…

idea 8年使用整理

文章目录 前言idea 8年使用整理1. 覆盖application配置2. 启动的时候设置编辑空间大小&#xff0c;并忽略最大空间3. 查询类的关系4. 查看这个方法的引用关系5. 查看方法的调用关系5.1. 查看被调用关系5.2. 查看调用关系 6. 方法分隔线7. 选择快捷键类型8. 代码预览插件9. JReb…

RAGFLOW使用笔记【更新ing】

0.引言 本文记录使用RAGFLOW的一些问题以及解决办法&#xff0c;它以笔记的形式存在&#xff0c;方便我以后回顾自己的学习工作。 1.RAGFLOW上传文件大小默认是128M,如何修改上传文件大小&#xff1f; 更新ragflow/docker/.env中的MAX_CONTENT_LENGTH 环境变量 然后同步更新…

ubuntu22.04安装PaddleX3

PaddleOCR 安装过程可以参考PaddleX本地安装教程 我的电脑环境配置&#xff1a; ubuntu22.04 cuda11.8&#xff08;之前安装的是12.4没有匹配的paddle-gpu;这里改成11.8&#xff09; 一、安装基础环境 1、 conda create -n ppx1 python3.10 2、 conda activate ppx1 3、…

Android 之 Activity 的启动模式(launchMode)

一、Activity 启动模式 在实际项目中&#xff0c;应该根据项目的实际需要来为每个 Activity 指定恰当的启动模式 launchMode。启动模式一共有四种&#xff0c;分别是 standard、singleTop、singleTask 和 singleInstance。可以在 AndroidManifest.xml 中通过给 <activity&g…

软件老化分析

软件老化 课程&#xff1a;软件质量分析 作业 解答 Python代码如下&#xff1a; n int(input("类别数&#xff1a;")) theta list(map(float, input("各个类别的权重&#xff1a;").split())) m list(map(int, input("各个类别的度量元数量&…

Jenkins 构建流水线

在 Linux 系统上安装 Jenkins 服务&#xff0c;以及配置自动化构建项目 前置准备环境&#xff1a;docker、docker-compose、jdk、maven 一、环境搭建 1. Jenkins 安装 &#xff08;1&#xff09;拉取镜像 # 安装镜像包&#xff0c;默认安装最新版本 docker pull jenkins/jen…

5G学习笔记之Non-Public Network

目录 0. NPN系列 1. 概述 2. SNPN 2.1 SNPN概述 2.2 SNPN架构 2.3 SNPN部署 2.3.1 完全独立 2.3.2 共享PLMN基站 2.3.3 共享PLMN基站和PLMN频谱 3. PNI-NPN 3.1 PNI-NPN概述 3.2 PNI-NPN部署 3.2.1 UPF独立 3.2.2 完全共享 0. NPN系列 1. NPN概述 2. NPN R18 3. 【SNPN系列】S…

若依plus apifox导入接口显示为空

项目已经正常启动 访问接口有些没问题&#xff0c;有些有问题 其他模块都可以正常导入 解决&#xff1a;

elementPlus消息组件多按钮案例

let customClass zsl-el-message-box efb.messageBox({title: 操作提示,showConfirmButton: false,customClass,message: efb.VNode(div, null, [efb.VNode(style, null, .${customClass} .el-message-box__message {width: 100%;}),efb.VNode(div, null, hello world),efb.VN…

计算机网络:应用层 —— 网络应用模式

文章目录 客户—服务器方式和对等方式客户/服务器方式 (C/S方式)工作流程特点 对等方式 (P2P方式)工作流程P2P 应用特点 客户—服务器方式和对等方式 网络应用程序运行在处于网络边缘的不同的端系统上&#xff0c;通过彼此间的通信来共同完成某项任务。 开发一种新的网络应用…

科技创新 数智未来|清科·沙丘投研院走进竹云

12月20日&#xff0c;清科沙丘投研院带领企投家团队走进竹云交流分享&#xff0c;聚焦技术创新、企业数字化管理、行业前沿应用案例等热点议题&#xff0c;深入探讨数字技术如何点燃企业高质量发展的澎湃动力&#xff0c;共话企业数字化、智能化发展之道。 达晨财智股权管理部…

外连接转AntiJoin的应用场景与限制条件 | OceanBase SQL 查询改写系列

在《SQL 改写系列&#xff1a;外连接转内连接的常见场景与错误》一文中&#xff0c;我们了解到谓词条件可以过滤掉连接结果中的 null 情形的&#xff0c;将外连接转化为内连接的做法是可行的&#xff0c;正如图1中路径(a)所示。此时&#xff0c;敏锐的你或许会进一步思考&#…

Java - 日志体系_Apache Commons Logging(JCL)日志接口库

文章目录 官网1. 什么是JCL&#xff1f;2. JCL的主要特点3. JCL的核心组件4. JCL的实现机制5. SimpleLog 简介6. CodeExample 1 &#xff1a; 默认日志实现 (JCL 1.3.2版本)Example 2 &#xff1a; JCL (1.2版本&#xff09; Log4J 【安全风险高&#xff0c;请勿使用】 7. 使用…

mavlink移植到单片机stm32f103c8t6,实现接收和发送数据

前言&#xff1a; 好久没更新博客了&#xff0c;这两个月真的是异常的忙&#xff0c;白天要忙着公司里的事&#xff0c;晚上还要忙着修改小论文&#xff0c;一点自己的时间都没有了&#xff0c;不过确确实实是学到了很多东西&#xff0c;对无人机的技术研究也更深了一些。不过好…

GitLab的安装与卸载

目录 GitLab安装 GitLab使用 使用前可选操作 修改web端口 修改Prometheus端口 使用方法 GitLab的卸载 环境说明 系统版本 CentOS 7.2 x86_64 软件版本 gitlab-ce-10.8.4 GitLab安装 Gitlab的rpm包集成了它需要的软件&#xff0c;简化了安装步骤&#xff0c;所以直接…

子网掩码计算route命令

子网掩码 - 站长工具 1.子网掩码 子网掩码就是用来遮掩IP地址并划分网段的工具&#xff0c;根据遮掩的位数不同来划分不同的网段。 2.网关 网关(Gateway)又称网间连接器、协议转换器。默认网关在网络层上以实现网络互连&#xff0c;是最复杂的网络互连设备&#xff0c;仅用…

基本操作:iframe、alert

背景 如果你的目标元素出现在一个iframe标签下&#xff0c;则不能直接定位&#xff0c;必须先完成切换才能进行定位操作&#xff0c;如下图 整个理解为一个大的房间&#xff0c;里面是客厅&#xff0c;driver进到客厅后&#xff0c;如果想操作iframe A里的数据&#xff0c;需…