MyBatis Plus 自定义查询语句

MyBatis Plus 自定义查询语句

1,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 getBomAndOrderCodeNumber(@Param("orderNoList")List orderNoList);

2,Service层

List getBomAndOrderCodeNumber(List orderNoList);

3,Service实现类

@Override
public List getBomAndOrderCodeNumber(List orderNoList) {
	return this.baseMapper.getBomAndOrderCodeNumber(orderNoList);
}

这样写不用再Mapper中写xml文件

你可能感兴趣的:(MyBatis,Plus)