4.6.201910111019 • Published 5 years ago

@dfeidao/fd-an000047 v4.6.201910111019

Weekly downloads
5
License
MIT
Repository
-
Last release
5 years ago

复杂查询

Installation

yarn add --dev @dfeidao/fd-an000047

Example

import an47 from '@dfeidao/fd-an000047';

const ran47 = an47(headers, 'systemid');
const res = await ran47
	// 添加字段
	.add_field('commodity', 'commodity_name', 'commodity_name')
	// 数量
	.add_fun('commodity', 'type_no', 'type_no', 'count')
	// 最大值
	.add_fun('commodity_price_elements', 'retail_price_value', 'retail_price_value', 'max')
	// 分组
	.groupby('commodity', 'type_no')
	// 不为空
	.where_not_null('commodity_price_elements', 'commodityid')
	// 模糊查询
	.where_like('commodity', 'type_no', '%005%')
	// 表1值与表2值相等
	.where_eq_tb('commodity_parameter', 'commodityid', 'commodity_price_elements', 'commodityid')
	// 表1值与表2值不等
	.where_neq_tb('commodity_parameter', 'commodityid', 'commodity_price_elements', 'commodityid')
	// 等
	.where_eq('commodity', 'type_no', 'TP000005')
	// 不等
	.where_neq('commodity', 'type_no', 'TP000005')
	// 大于
	.where_gt('commodity_price_elements', 'retail_price_value', 50)
	// 大于等于
	.where_gte('commodity_price_elements', 'retail_price_value', 50)
	// 小于
	.where_lt('commodity_price_elements', 'retail_price_value', 50)
	// 小于等于
	.where_lte('commodity_price_elements', 'retail_price_value', 50)
	// 表1值大于表2
	.where_gt_tb('commodity_price_elements', 'retail_price_value', 50)
	// 表1值大于等于表2
	.where_gte_tb('sales_changebill_stockin', 'price_difference', 'purchase_payable', 'payment')
	// 表1值小于表2
	.where_lt_tb('commodity_price_elements', 'retail_price_value', 50)
	// 表1值小于等于表2
	.where_lte_tb('sales_changebill_stockin', 'price_difference', 'purchase_payable', 'payment')
	// 内连接
	.inner_join('commodity', 'commodity_parameter', ['commodityid', 'commodityid'])
	// 左外链接
	.outer_left_join('commodity_parameter', 'commodity_price_elements', ['commodityid', 'commodityid'])
	// 右外链接
	.outer_right_join('commodity_parameter', 'commodity_price_elements', ['commodityid', 'commodityid'])
	// 分页
	.page(10, 1)
	// 结束
	.exec();