MyBatis的映射自动匹配

 开始标签:


代码一:

代码二:

这两组查询结果相同。结果如下:

{
  "code": 200,
  "list": {
    "id": 7,
    "releaseId": "222",
    "releaseName": "dyy房源1",
    "project": "大汉1期",
    "building": "一栋",
    "number": "1002号",
    "numberId": "49E3A05520E7724EDE83",
    "address": "大汉金桥",
    "appId": null,
    "typeId": "53",
    "area": 30,
    "orientation": "60",
    "roomNumber": 3,
    "tingNumber": 2,
    "weiNumber": 1,
    "rent": 300,
    "rentalMode": "1",
    "deposit": 500,
    "rentNumber": "3",
    "totalFloors": 15,
    "floors": 4,
    "fitment": "5",
    "leadingPersonId": "ee0a7aeadc9e42a2bf98d7fbab705f7a",
    "managerType": "1",
    "eleaseStatusId": "4",
    "linkman": null,
    "linkmanPhone": null,
    "delFlag": "0",
    "browseNum": 0,
    "huxing": null,
    "managerCost": 0,
    "isTop": null,
    "creator": "",
    "createTime": "2018-04-28 15:52:22",
    "updateTime": "2018-05-22 08:57:56",
    "updator": "admin",
    "approvalOpinion": "1",
    "remark": null,
    "list1": null,
    "list2": null,
    "list3": null,
    "list4": null,
    "houseFile": null,
    "fileId": null,
    "huxingName": null
  }
}

 结论:当数据库的字段为下划线隔开的方式时,如果其对用的映射类成名变量是驼峰方式命名时,myBatis的映射查询结果可自动匹配。即myBatis的查询结果方式是默认自动匹配驼峰方式,不需要额外的映射配置。

 

你可能感兴趣的:(MyBatis)