把统计数据重新更新回表

"saveSqlExtand": {
    // #region 把统计数据重新更新回表
    "product-task": {
      "sortId": 1,
      "connName": "ConnAct",
      "sqlUpdate": "update cpc_product_task tb_a,(select product_task_id,sum(defective_num) defective_num,sum(genuine_num) genuine_num,sum(material_num) material_num,sum(consume_num) consume_num from cpc_product_task_report where product_task_id=@productTaskId and audit_status=1 and is_enabled=1 group by product_task_id) tb_b set tb_a.defective_num=tb_b.defective_num,tb_a.genuine_num=tb_b.genuine_num,tb_a.material_num=tb_b.material_num,tb_a.consume_num=tb_b.consume_num where tb_a.product_task_id=@productTaskId and tb_a.product_task_id = tb_b.product_task_id",
      "sqlInsert": null
    }
    // #endregion 把统计数据重新更新回表
  },

mapper

 "saveSqlExtand": {
    "cpc-product-info-audit": {
      "sortId": 1,
      "connName": "ConnAct",
      "sqlUpdate": null,
      "sqlInsert": "insert into activity_config_audit (audit_id,audit_user_name,audit_user_id,audit_status,audit_date,opinion,object_id) values  (@_primaryIdV,@_userPushName,@_userId,@auditStatus,@_currentDate,@opinion,@activityId);"
    },
    // #region 数据变更后执行的操作
    "activity-blacklist-ip": {
      "sortId": 5,
      "connName": "ConnAct",
      "sqlUpdate": "update activity_blacklist_ip set activity_name=@activityName where activity_id=@activityId",
      // 必须自动,如果为空,不执行方法
      "need": [
        {
          "field": "activityName",
          "value": ""
        },
        {
          "field": "activityId",
          "value": ""
        }
      ]
    },
    "activity-blacklist-user": {
      "sortId": 10,
      "connName": "ConnAct",
      "sqlUpdate": "update activity_blacklist_user set activity_name=@activityName where activity_id=@activityId",
      // 必须自动,如果为空,不执行方法
      "need": [
        {
          "field": "activityName",
          "value": ""
        },
        {
          "field": "activityId",
          "value": ""
        }
      ]
    },
    "activity-whitelist-ip": {
      "sortId": 15,
      "connName": "ConnAct",
      "sqlUpdate": "update activity_whitelist_ip set activity_name=@activityName where activity_id=@activityId",
      // 必须自动,如果为空,不执行方法
      "need": [
        {
          "field": "activityName",
          "value": ""
        },
        {
          "field": "activityId",
          "value": ""
        }
      ]
    },
    "activity-whitelist-user": {
      "sortId": 20,
      "connName": "ConnAct",
      "sqlUpdate": "update activity_whitelist_user set activity_name=@activityName where activity_id=@activityId",
      // 必须自动,如果为空,不执行方法
      "need": [
        {
          "field": "activityName",
          "value": ""
        },
        {
          "field": "activityId",
          "value": ""
        }
      ]
    }
    //  #endregion  数据变更后执行的操作
  },

文档更新时间: 2022-09-18 13:25   作者:admin