zoukankan      html  css  js  c++  java
  • MyDAL

    索引:

    目录索引

    一.API 列表

      C# 代码中 instance.property == null 生成 SQL 对应的 is null

        :.Queryer<Agent>()

          ... ...

          .Where(it => it.CrmUserId == null)

          ... ... 用于 单表 is null 条件

          .Queryer(out Agent a5,out AgentInventoryRecord r5)

          ... ...

          .Where(() => a5.ActiveOrderId==null)

          ... ... 用于 多表连接 is null 条件

      C# 代码中 instance.propery != null 生成 SQL 对应的 is not null

        如:.Queryer<Agent>()

          ... ...

          .Where(it => it.ActiveOrderId != null)

          ... ... 用于 单表 is not null 条件

          .Queryer(out Agent a6, out AgentInventoryRecord r6)

          ... ...

          .Where(() => a6.ActiveOrderId != null)

          ... ... 用于 多表连接 is not null 条件

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

      1. IS NULL 条件

    1             var res7 = await Conn.QueryListAsync<Agent>(it => it.ActiveOrderId == null);

        以 MySQL 为例,生成 SQL 如下:

    1 select *
    2 from `agent`
    3 where  `ActiveOrderId`  is null ;

      2. IS NOT NULL 条件

    1             var res8 = await Conn.QueryListAsync<Agent>(it => it.ActiveOrderId != null);

        以 MySQL 为例,生成 SQL 如下:

    1 select *
    2 from `agent`
    3 where  `ActiveOrderId`  is not null ;

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

      1. IS NULL 条件

    1             var res1 = await Conn
    2                 .Queryer<Agent>()
    3                 .Where(it => it.ActiveOrderId == null)
    4                 .QueryListAsync();

        以 MySQL 为例,生成 SQL 如下:

    1 select *
    2 from `agent`
    3 where  `ActiveOrderId`  is null ;

      2. IS NOT NULL 条件

    1             var res4 = await Conn
    2                 .Queryer<Agent>()
    3                 .Where(it => it.ActivedOn != null && it.ActiveOrderId != null && it.CrmUserId == null)
    4                 .QueryListAsync();

        以 MySQL 为例,生成 SQL 如下:

    1 select *
    2 from `agent`
    3 where (( `ActivedOn`  is not null  &&  `ActiveOrderId`  is not null ) &&  `CrmUserId`  is null );

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

      1. IS NULL 条件

    1             var res5 = await Conn
    2                 .Queryer(out Agent a5,out AgentInventoryRecord r5)
    3                 .From(()=>a5)
    4                     .LeftJoin(()=>r5)
    5                         .On(()=>a5.Id==r5.AgentId)
    6                 .Where(() => a5.ActiveOrderId==null)
    7                 .QueryListAsync<Agent>();

        以 MySQL 为例,生成 SQL 如下:

    1 select a5.`*`
    2 from `agent` as a5 
    3     left join `agentinventoryrecord` as r5
    4         on a5.`Id`=r5.`AgentId`
    5 where  a5.`ActiveOrderId`  is null ;

      2. IS NOT NULL 条件

    1             var res6 = await Conn
    2                 .Queryer(out Agent a6, out AgentInventoryRecord r6)
    3                 .From(() => a6)
    4                     .LeftJoin(() => r6)
    5                         .On(() => a6.Id == r6.AgentId)
    6                 .Where(() => a6.ActiveOrderId != null)
    7                 .QueryListAsync<Agent>();

        以 MySQL 为例,生成 SQL 如下:

    1 select a6.`*`
    2 from `agent` as a6 
    3     left join `agentinventoryrecord` as r6
    4         on a6.`Id`=r6.`AgentId`
    5 where  a6.`ActiveOrderId`  is not null ;

                                             蒙

                                        2019-01-20 22:22 周日

                                        2019-04-12 23:47 周五

  • 相关阅读:
    103、服务器出现大量close_wait的连接的原因是什么?有什么解决方法?
    102、常见的HTTP状态码有哪些?
    rpm包管理、yum源及创建本地仓库(同步华为源)
    文件管理之:输出与重定向echo
    高级权限--acl, mask,文件属性权限;su切换用户,sudo提权
    基本权限;权限对⽂件or⽬录的意义;特殊权限;文件权限之umask
    权限管理--用户介绍;用户与组相关文件;用户管理命令之用户创建、查看、删除、修改
    文件管理之:打包、压缩
    字符处理命令-sort排序,uniq去重,cut剪切文件,tr删除或替换结果集,wc统计
    上传与下载wget、curl、r z、s z
  • 原文地址:https://www.cnblogs.com/Meng-NET/p/10296445.html
Copyright © 2011-2022 走看看