PriceRuleController.ts 1.9 KB
import { AxiosResponse, AxiosStatic } from "axios";
import dayjs, { Dayjs } from "dayjs";
// region 前端扩展导入包
import { PriceRule } from "lib/src/entity/vehicle/entity/PriceRule";
import { Page } from "autumn-vue/lib/core/page/Page";
// endregion

/**
 * 价格规则(PriceRule) PI接口
 * @author gonglei
 * @since 2025-10-13 12:18:11
 */
export class PriceRuleController {
	/**
	 * 新增价格规则
	 * @param priceRule
	 * @return PriceRule
	 */
	static addPriceRule(axios: AxiosStatic, priceRule: any): Promise<AxiosResponse<PriceRule>> {
		return axios.post("priceRule/addPriceRule", priceRule);
	}

	/**
	 * 根据id查询价格规则
	 * @param ruleId
	 * @return PriceRule
	 */
	static getPriceRuleById(axios: AxiosStatic, ruleId: number): Promise<AxiosResponse<PriceRule>> {
		return axios.get("priceRule/getPriceRuleById", { params: { ruleId: ruleId } });
	}

	/**
	 */
	static getReferencePriceByVehicleId(axios: AxiosStatic, vehicleId: number): Promise<AxiosResponse<number>> {
		return axios.get("priceRule/getReferencePriceByVehicleId", { params: { vehicleId: vehicleId } });
	}

	/**
	 * 分页查询价格规则
	 * @param pagination
	 * @return Page
	 */
	static pagePriceRule(axios: AxiosStatic, pagination: any): Promise<AxiosResponse<Page<PriceRule>>> {
		return axios.post("priceRule/pagePriceRule", pagination);
	}

	static PAGE_PRICE_RULE = "priceRule/pagePriceRule";

	/**
	 * 删除价格规则
	 * @param ruleId
	 * @return int
	 */
	static removePriceRuleById(axios: AxiosStatic, ruleId: number): Promise<AxiosResponse<number>> {
		return axios.delete("priceRule/removePriceRuleById", { params: { ruleId: ruleId } });
	}

	/**
	 * 修改价格规则
	 * @param priceRule
	 * @return PriceRule
	 */
	static updatePriceRule(axios: AxiosStatic, priceRule: any): Promise<AxiosResponse<PriceRule>> {
		return axios.post("priceRule/updatePriceRule", priceRule);
	}

	// region 前端扩展代码区
	// endregion
}