mapper_bs-msg-chat_sql__responsefield.json

{
  "pushMapperFieldIdx": [
    "bs-msg-chat"
  ],
  //"primarys": [
  //  {
  //    "field": "chatId",
  //    "alias": "chat_id",
  //    "name": "chat_id"
  //  }
  //],
  "responseField": {
    "global": {
      "dataFromType": "Database",
      "show": "chat_id",
      "auth": true
    },
    "my": {
      //#region child 1对多/chilobject1对1
      "showExtand": "null reader",
      //reader
      "bridgeColumnExtand": "",
      "fieldChild": {
        "reader": {
          "moduleKey": "bs-msg-chat-site",
          "responseField": "showmy",
          "showMethod": "childobject"
        }
      },
      //#endregion child 1对多/chilobject1对1
      "extend": "basis",
      "auth": true,
      // #region 开启扩展入库配置
      "saveSqlExtand": true,
      // #endregion 开启扩展入库配置
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion",
      // #endregion 移除多余字段
      // #region 5分钟内数据置顶,sort_id
      "order": "{date_diff_sort},modify_time desc",
      //"where": "{where_sql} and chat_id in (select chat_id from bs_msg_chat_rel_user where user_id=@_userId and is_enabled=1)",
      "field": {
        "sort": {
          "createTime": {
            "column": "create_time",
            "dateDiffMinute": 5
          }
        }
      },
      // #endregion 5分钟内数据置顶
      //#region _mapperType
      "mappers": {
        // 默认配置
        "default": {
          "columnAlias": "title,sign,open_method,link_url,modify_time,chat_id,img_url,content"
        },
        // 未读的消息
        "0": {
          "columnAlias": "default"
        }
      },
      //#endregion _mapperType
      "wheres": [
        "{where_sql} and audit_status=1",
        " and chat_id in (select chat_id from bs_msg_chat_rel_user where user_id=@_userId and is_enabled=1)",
        // #region 未读取的消息
        "{s-if:_mapperType}",
        "{op-eq:0}",
        //bs_msg_notice.notice_id=bs_msg_notice_site.notice_id and
        " and not exists (select chat_id from bs_msg_chat_site where user_id=@_userId) ",
        "{op-eq:0}",
        "{e-if:_mapperType}"
        // #endregion 未读取的消息
      ]
    },
    "my_detail": {
      //#region child 1对多/chilobject1对1
      "showExtand": "null reader",
      //reader
      "bridgeColumnExtand": "",
      "fieldChild": {
        "reader": {
          "moduleKey": "bs-msg-chat-site",
          "responseField": "showmy",
          "showMethod": "childobject"
        }
      },
      //#endregion child 1对多/chilobject1对1
      "extend": "basis_detail",
      "auth": true,
      // #region 开启扩展入库配置
      "saveSqlExtand": true,
      // #endregion 开启扩展入库配置
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion",
      // #endregion 移除多余字段
      //#region 请求详情前执行入库更新数据
      "eventDetailB": [
        {
          // 其它地方使用  _eventRsite
          "name": "site",
          "connName": "ConnMsg",
          "enabled": false,
          // 把状态更新为已读
          "updates": [
            "update bs_msg_chat_site set status=1 where  user_id=@_userId and chat_id=@chatId"
          ],
          "inserts": [
            "insert into bs_msg_chat_site (msg_id,user_id,chat_id,status,open_id,create_time) values (@_primaryIdV,@_userId,@chatId,1,'site',@_currentDate)"
          ]
        }
      ]
      //#endregion 请求详情前执行入库更新数据
    },
    "manager": {
      //#region 1对多 扩展字段
      "bridgeColumnExtand": "users",
      "original": "'' users",
      //#endregion 1对多 扩展字段
      // #region 开启扩展入库配置
      "saveSqlExtand": true,
      // #endregion 开启扩展入库配置
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion",
      // #endregion 移除多余字段
      // #region 5分钟内数据置顶,sort_id
      "order": "{date_diff_sort},modify_time desc",
      "field": {
        "sort": {
          "createTime": {
            "column": "create_time",
            "dateDiffMinute": 5
          }
        }
      }
      // #endregion 5分钟内数据置顶
    },
    "manager_detail": {
      //#region 1对多 扩展字段
      "bridgeColumnExtand": "users",
      "original": "'' users",
      //#endregion 1对多 扩展字段
      // #region 开启扩展入库配置
      "saveSqlExtand": true,
      // #endregion 开启扩展入库配置
      // #region 移除多余字段
      "bridgeColumnRemoves": "audit_opinion",
      // #endregion 移除多余字段
      "fieldChild": {
        //#region 1对多配置 /1对多  1对1 情况下 继承操作
        "users": {
          "moduleKey": "bs-msg-chat-rel-user",
          "responseField": "chat_detail",
          "showMethod": "child",
          "columnBridges": {}
        }
        //#endregion 1对多配置
      }
    }
  },
  // #region 开启扩展入库配置
  "saveSqlExtand": {
    "bs-msg-chat-audit": {
      "sortId": 1,
      "connName": "ConnMsg",
      "sqlUpdate": null,
      "sqlInsert": "insert into bs_msg_chat_audit (audit_id,audit_user_name,audit_user_id,audit_status,audit_date,opinion,object_id) values  (@_primaryIdV,@_userPushName,@_userId,@auditStatus,@_currentDate,@opinion,@chatId);"
    }
  }
  // #endregion 开启扩展入库配置
}
文档更新时间: 2022-09-18 14:57   作者:admin