Skip to content

Latest commit

 

History

History
40 lines (35 loc) · 1.4 KB

mybatis_plus常见用法-不用xml实现自定义查询.md

File metadata and controls

40 lines (35 loc) · 1.4 KB

找到两种方法: 1、采用mybatis注解的方式 参见:MyBatis Plus 自定义查询语句 DAO层:

@Select("select b.bomName, " +
		"b.bomProductType, b.bomMaterial, " +
		"o.customerID AS bomID, " +
		"o.ordersDataNo AS qrCode, " +
		"s.deliveryDate AS barCode, " +
		"s.mainType AS workshop " +
		"FROM mes_order_bom b " +
		"LEFT JOIN mes_order_ordersdata o ON b.ordersID = o.id " +
		"LEFT JOIN mes_order_soncontract s ON o.sonContractID = s.id " +
		"WHERE o.ordersDataNo IN (#{orderNoList})")
List<MesOrderBom> getBomAndOrderCodeNumber(@Param("orderNoList")List<String> orderNoList);

Service层:

List<MesOrderBom> getBomAndOrderCodeNumber(List<String> orderNoList);

Service实现类:

@Override
public List<MesOrderBom> getBomAndOrderCodeNumber(List<String> orderNoList) {
	return this.baseMapper.getBomAndOrderCodeNumber(orderNoList);
}

2、自定义实现 结合mybatis-plus 实现无XML多表联查询 项目地址:multipleselect java 结合mybatis-plus 实现非手写sql多表查询

参考资料