索引:

目录索引

一.API 列表

  .QueryListAsync()

  .QueryListAsync<M>()

    如: .QueryListAsync<AgentInventoryRecord>() , 用于 单表/多表连接 查询.

  .QueryListAsync<VM>()

    如: .QueryListAsync<AgentVM>() , 用于 单表 查询.

  .QueryListAsync<T>(Expression<Func<M, T>> columnMapFunc)

    如: .QueryListAsync(it => it.Name) , 用于 单表 单列 查询.

    或者:

      .QueryListAsync(agent => new AgentVM
                  {
                      XXXX = agent.Name,
                      YYYY = agent.PathId
                  })  , 用于 单表 多列 查询.

  .QueryListAsync<T>(Expression<Func<T>> columnMapFunc)

    如:  .Queryer(out Agent agent1, out AgentInventoryRecord record1)

      ... ...

      .QueryListAsync(() => agent1.CreatedOn)   , 用于 多表连接 单列 查询.

    或者: .Queryer(out Agent agent12, out AgentInventoryRecord record12)

        ... ...

       .QueryListAsync(() => new AgentVM
                  {
                      nn = agent12.PathId,
                      yy = record12.Id,
                      xx = agent12.Id,
                      zz = agent12.Name,
                      mm = record12.LockedCount
                  })  , 用于 多表连接 多列 查询.

二.API 单表-便捷 方法 举例

  1. 单表 单列 多条 便捷方法 

             var res7 = await Conn.QueryListAsync<Agent, string>(it => it.Name.StartsWith("张"), it => it.Name);

    以 MySQL 为例,生成 SQL 如下:

 select `Name`
from `Agent`
where `Name` like ?Name_1;

  2. 单表 多列 多条 便捷方法

        var date = DateTime.Parse("2018-08-20");

             var res3 = await Conn.QueryListAsync<AlipayPaymentRecord, AlipayPaymentRecordVM>(it => it.CreatedOn >= date,
it => new AlipayPaymentRecordVM
{
TotalAmount = it.TotalAmount,
Description = it.Description
});

    以 MySQL 为例,生成 SQL 如下:

 select     `TotalAmount` as TotalAmount,
    `Description` as Description
from `AlipayPaymentRecord`
where `CreatedOn`>=?CreatedOn_1;

  3. 单表 VM 多条 便捷方法

             var date = DateTime.Parse("2018-08-20");

             var res2 = await Conn.QueryListAsync<AlipayPaymentRecord, AlipayPaymentRecordVM>(it => it.CreatedOn >= date);

    以 MySQL 为例,生成 SQL 如下:

 select     `Id`,
`CreatedOn`,
`TotalAmount`,
`Description`,
`CanceledOn`
from `AlipayPaymentRecord`
where `CreatedOn`>=?CreatedOn_1;

  4. 单表 M 多条 便捷方法

             var date = DateTime.Parse("2018-08-20");

             var res1 = await Conn.QueryListAsync<AlipayPaymentRecord>(it => it.CreatedOn >= date);

    以 MySQL 为例,生成 SQL 如下:

 select *
from `AlipayPaymentRecord`
where `CreatedOn`>=?CreatedOn_1;

三.API 单表-完整 方法 举例

  1. 单表 单列 多条 完整方法

             var res2 = await Conn
.Queryer<Agent>()
.Where(it => it.AgentLevel == AgentLevel.DistiAgent)
.QueryListAsync(it => it.Name);

    以 MySQL 为例,生成 SQL 如下:

 select `Name`
from `Agent`
where `AgentLevel`=?AgentLevel_1;

  2.单表 多列 多条 完整方法

             var res5 = await Conn
.Queryer<Agent>()
.Where(it => it.AgentLevel == AgentLevel.DistiAgent)
.QueryListAsync(agent => new AgentVM
{
XXXX = agent.Name,
YYYY = agent.PathId
});

    以 MySQL 为例,生成 SQL 如下:

 select     `Name` as XXXX,
`PathId` as YYYY
from `Agent`
where `AgentLevel`=?AgentLevel_1;

  3.单表 VM 多条 完整方法

             var testQ5 = new WhereTestModel
{
CreatedOn = DateTime.Now.AddDays(-),
StartTime = WhereTest.CreatedOn,
EndTime = DateTime.Now,
AgentLevelXX = AgentLevel.DistiAgent,
ContainStr = "~00-d-3-1-"
};
var res5 = await Conn
.Queryer<Agent>()
.Where(it => it.CreatedOn >= testQ5.StartTime)
.QueryListAsync<AgentVM>();

    以 MySQL 为例,生成 SQL 如下:

 select     `Id`,
`CreatedOn`,
`UserId`,
`PathId`,
`Name`,
`Phone`
from `Agent`
where `CreatedOn`>=?CreatedOn_1;

  4. 单表 M 多条 完整方法

             var start = WhereTest.CreatedOn.AddDays(-);

             var res2 = await Conn
.Queryer<BodyFitRecord>()
.Where(it => it.CreatedOn >= start)
.QueryListAsync();

    以 MySQL 为例,生成 SQL 如下:

 select *
from `BodyFitRecord`
where `CreatedOn`>=?CreatedOn_1;

四.API 多表连接-完整 方法 举例

  1.多表连接 单列 多条 完整方法

             var res1 = await Conn
.Queryer(out Agent agent1, out AgentInventoryRecord record1)
.From(() => agent1)
.InnerJoin(() => record1)
.On(() => agent1.Id == record1.AgentId)
.Where(() => agent1.AgentLevel == AgentLevel.DistiAgent)
.QueryListAsync(() => agent1.CreatedOn);

    以 MySQL 为例,生成 SQL 如下:

 select agent1.`CreatedOn`
from `Agent` as agent1
inner join AgentInventoryRecord as record1
on agent1.`Id`=record1.`AgentId`
where agent1.`AgentLevel`=?AgentLevel_4;

  2.多表连接 多列 多条 完整方法

             var res12 = await Conn
.Queryer(out Agent agent12, out AgentInventoryRecord record12)
.From(() => agent12)
.InnerJoin(() => record12)
.On(() => agent12.Id == record12.AgentId)
.Where(() => record12.CreatedOn >= WhereTest.CreatedOn)
.QueryListAsync(() => new AgentVM
{
nn = agent12.PathId,
yy = record12.Id,
xx = agent12.Id,
zz = agent12.Name,
mm = record12.LockedCount
});

    以 MySQL 为例,生成 SQL 如下:

 select     agent12.`PathId` as nn,
record12.`Id` as yy,
agent12.`Id` as xx,
agent12.`Name` as zz,
record12.`LockedCount` as mm
from `Agent` as agent12
inner join AgentInventoryRecord as record12
on agent12.`Id`=record12.`AgentId`
where record12.`CreatedOn`>=?CreatedOn_4;

  3.多表连接 M 多条 完整方法

             var res1 = await Conn
.Queryer(out Agent agent1, out AgentInventoryRecord record1)
.From(() => agent1)
.InnerJoin(() => record1)
.On(() => agent1.Id == record1.AgentId)
.Where(() => agent1.CreatedOn >= WhereTest.CreatedOn.AddDays(-))
.QueryListAsync<AgentInventoryRecord>();

    以 MySQL 为例,生成 SQL 如下:

 select record1.`*`
from `Agent` as agent1
inner join AgentInventoryRecord as record1
on agent1.`Id`=record1.`AgentId`
where agent1.`CreatedOn`>=?CreatedOn_4;

                                         蒙

                                    2018-12-26 15:25 周三

                                    2018-12-30 11:30 周日

                                    2019-04-12 23:29 周五

最新文章

  1. window.onload与$(document).ready()的区别
  2. STL-&lt;queue&gt;-priority queue的使用
  3. HDU 3065 (AC自动机模板题)
  4. OpenCV 2.4.11 VS2010 Configuration
  5. VS编程中找不到Microsoft.Office.Core、Microsoft.Office.Interop.Word和VBIDE
  6. &quot;渴了么&quot;用户场景分析
  7. SeaJS学习笔记(一) ./ 和 ../ 区别
  8. MFC/VC++ UI界面美化技术
  9. c++ 10
  10. /dev/console,/dev/null,/dev/tty
  11. 那些年踩过的坑之:first-child伪类选择器
  12. Android属于查询执行情况的电话号码
  13. 201521123092《java程序设计》第十一周学习总结
  14. Ionic3关闭弹出页面,跳转到列表后刷新父页面
  15. 关于UR=A的测试
  16. 遇到ANR问题的处理步骤
  17. HTTPS学习笔记一----HTTPS的基础理论知识
  18. 学爬虫,需要掌握哪些Python基础?
  19. Uva101-STL模拟
  20. css抖动动画

热门文章

  1. Eclipse4JavaEE安装Gradle,并导入我们的Gradle项目
  2. 21 , CSS 构造模型
  3. 激活效能,CODING 敏捷研发模块上线
  4. windows凭据管理
  5. LeetCode算法题-Letter Case Permutation(Java实现)
  6. nn.ConvTranspose2d的参数output_padding的作用
  7. Linux vi/vim编辑器常用命令与用法总结
  8. 网卡的 Ring Buffer 详解
  9. 使用dom4j 解析xml文件
  10. Java泛型的重要目的:别让猫别站在狗队里