mybatis查询的时候一对多查询结果显示

tech2024-05-25  71

<resultMap type="com.medical.design.vo.MContractVo" id="mContractTestMap"> <result property="id" column="id" /> <collection property="contractProductList" ofType="com.medical.design.entity.MContractProduct"> <result property="id" column="id" /> <result property="productName" column="product_name" /> <result property="productSku" column="product_sku" /> <result property="productQuantity" column="product_quantity" /> <result property="productUnit" column="product_unit" /> </collection> </resultMap> @Data public class MContractVo { private Integer id; /* 自增id */ private String companyName; /* 公司名称 */ private String title; /* 需求名称 */ private List<MContractProduct> contractProductList; } { "rows": [], "total": 0, "data": [ { "id": 124, "companyName": "ceshi", "title": null "contractProductList": [ { "id": 124, "productName": "ceshi", "productSku": "ceshi1", "productQuantity": 123, "productUnit": "dun", "createTime": "2020-08-27 23:23:34", "modifyTime": "2020-08-28 17:30:50" }, { "id": 124, "productName": "ceshi2", "productSku": "ceshi2", "productQuantity": 321, "productUnit": "dun", "createTime": "2020-08-27 23:23:34", "modifyTime": "2020-08-28 17:30:50" } ] } ], "message": "", "success": true }

 

最新回复(0)