代码文件

\RG3.BO.DB\Services\DbSqlService$ResStartUp.cs
\RG3.BO.DB\Services\DbSqlService$ResConnection.cs

案例

RG3.Web.Host.PaaS\App_Data\Templates\DevCode\components\form-child-virtual\

统计字段来源跨库


   "stockInCount": {
      "extendAlias": "input_basis",
      "fieldSort": 9999,
      "tableId": 1,
      "dataType": "varchar",
      "title": "入库记录",
      "isData": false,
      "filter": {
        "isMust": false
      },
      //"sql": "(select count(cis_id) from mall_commodity_in_stock tb_child where tb_child.sku_id=mall_commodity_sku_info.sku_id) stock_in_count",
      // #region 统计字段来源跨库
      "sql": "0 stock_in_count",
      "connectionSql": {
        "mappers": {
          "skuId": "sku_id"
        },
        "dbSql": "select count(cis_id) stock_in_count,sku_id from mall_commodity_in_stock where sku_id in @skuId group by sku_id",
        "rowSql": "sku_id='@skuId'",
        "rowParams": [],
        "connName": "ConnMallOrder"
      },
      // #endregion 统计字段来源跨库
      "selectSql": {
        "oracle": null,
        "sqlserver": null,
        "mysql": null,
        "sqlite": null
      },
      "field": "stockInCount",
      "name": "stock_in_count",
      "alias": "stock_in_count",
      "isDate": false,
      "isPrimary": false,
      "isIdentity": false,
      "maxLength": 200
    },

查询结果同步到当前表(跨库)

\App_Data\Templates\DevCode\components\mapper-table-count\mapper_mkey_sql__responsefield_2.json

{
  // #region 开启扩展入库配置
  //"saveSqlExtand": {
    //"mall_commodity_sku_info": {
    //  "sortId": 1,
    //  "connName": "ConnMall",
    //  "sqlUpdate": "update mall_commodity_in_stock mi,mall_commodity_sku_info m set mi.comm_name=m.comm_name,mi.comm_id=m.comm_id,mi.sku_id=m.sku_id,mi.sku_title=m.sku_title where mi.cis_id=@cisId and mi.sku_id=m.sku_id",
    //  "sqlInsert": null
    //}
  //},
  // #endregion 开启扩展入库配置
  // #region 查询结果同步到当前表(跨库)
  "saveSqlExtand": {
    "mall_commodity_sku_info": {
      "sortId": 1,
      "connSource": "ConnMall",
      "connName": "ConnMallOrder",
      "primaryField": "cisId",
      "primaryName": "cis_id",
      "foreignField": "skuId",
      "foreignName": "sku_id",
      "sqlSelect": "select sku_id,cis_id from mall_commodity_in_stock where cis_id=@cisId",
      "sqlSource": "select '' cis_id,sku_id,comm_name,comm_id,sku_title from mall_commodity_sku_info where sku_id in @skuId",
      "sqlUpdate": "update mall_commodity_in_stock set comm_name=@commName,comm_id=@commId,sku_title=@skuTitle where cis_id=@cisId and sku_id=@skuId",
      "sqlInsert": null
    }
  },
  // #endregion 查询结果同步到当前表(跨库)
  "responseField": {
    "manager": {
      // #region 开启扩展入库配置
      "saveSqlExtand": true
    },
    "manager_detail": {
      // #region 开启扩展入库配置
      "saveSqlExtand": true
      // #endregion 开启扩展入库配置
    }
  }
}
文档更新时间: 2022-10-29 22:45   作者:admin