primefaces教程_Primefaces,带有JPA的Spring 4(Hibernate 4 / EclipseLink)示例教程

primefaces教程

Java Persistence API is a standard specification. It provides a persistence model that’s implemented by different implementer frameworks.

Java Persistence API是一个标准规范。 它提供了由不同的实现者框架实现的持久性模型。

Primefaces Spring Hibernate EclipseLink (Primefaces Spring Hibernate EclipseLink)

Hibernate & EclipseLink are two most popular implementations used for persisting given business model against some sort of persistence store like relational database. As such, this tutorial will provide you a full-fledged example containing all required configuration steps to developer a layered application that uses:

HibernateEclipseLink是两个最流行的实现,用于将给定的业务模型持久化到某种持久性存储(如关系数据库)中。 这样,本教程将为您提供一个完整的示例,其中包含开发使用以下内容的分层应用程序所需的所有配置步骤:

  1. Primefaces components to develop a compelling User Interface that aimed to handle user’s interactions and verify user’s inputs.

    Primefaces组件可开发引人注目的用户界面,旨在处理用户的交互并验证用户的输入。
  2. Hibernate/EclipseLink implementations to develop an Object/Relational Mapping beneath JPA umbrella.

    Hibernate / EclipseLink实现可在JPA框架下开发对象/关系映射。
  3. Spring framework as a kind of glue that get everything attached each together.

    Spring框架是一种胶粘剂,可以将所有东西都粘在一起。

We’ve discussed before using Hibernate ORM for persisting given domain classes. But today we will use only JPA based configurations.

在使用Hibernate ORM持久存储给定的域类之前,我们已经进行了讨论。 但是今天,我们将仅使用基于JPA的配置。

JPA specification does its bootstrap in a different way. In hibernate we’ve bootstrapped our application using hibernate.cfg.xml file, but JPA doesn’t specify that file.

JPA规范以不同的方式进行引导。 在hibernate中,我们使用hibernate.cfg.xml文件引导了我们的应用程序,但是JPA没有指定该文件。

JPA provides another way of configuration, it’s using persistence.xml file that is located within your classpath and under META-INF folder.

JPA提供了另一种配置方式,它使用位于classpathMETA-INF文件夹下的persistence.xml文件。

Let’s see how can we use both of Hibernate and EclipseLink for implementing a single registration form.

让我们看看如何使用HibernateEclipseLink来实现单个注册表单。

Primefaces Spring JPA Hibernate EclipseLink示例所需的工具 (Primefaces Spring JPA Hibernate EclipseLink Example Required Tools)

Before proceeding far away, you must prepare your environments that should contain for:

在继续进行之前,您必须准备以下环境:

  • JDK 1.6+.

    JDK 1.6以上版本。
  • Eclipse Kepler 4.3.

    Eclipse开普勒4.3。
  • Hibernate 4.3.6.Final.

    Hibernate4.3.6。最终版。
  • Spring 4.0.3.RELEASE.

    Spring 4.0.3发布。
  • EclipseLink 2.5.0-RC1

    EclipseLink 2.5.0-RC1
  • Maven Build Tool

    Maven构建工具
  • MySQL 5.x.

    MySQL5.x。

Primefaces Spring JPA Hibernate EclipseLink示例项目结构 (Primefaces Spring JPA Hibernate EclipseLink Example Project Structure)

Primefaces Spring JPA Hibernate EclipseLink示例数据库表 (Primefaces Spring JPA Hibernate EclipseLink Example Database Tables)

We have Employee table in our MySQL database, you can use below script to create it.

我们MySQL数据库中有Employee表,您可以使用以下脚本来创建它。

CREATE TABLE `employee` (
  `EMP_ID` int(11) NOT NULL AUTO_INCREMENT,
  `EMP_NAME` varchar(45) DEFAULT NULL,
  `EMP_HIRE_DATE` datetime DEFAULT NULL,
  `EMP_SALARY` decimal(11,4) DEFAULT NULL,
  PRIMARY KEY (`EMP_ID`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
  • Employee Table contains one Primary Key with Auto Increment value.

    雇员表包含一个具有自动增量值的主键。

Primefaces Spring JPA Hibernate EclipseLink示例域类 (Primefaces Spring JPA Hibernate EclipseLink Example Domain Classes)

We have also one domain class that would be persisting into our database Employee table.

我们还有一个域类,该域类将持久存储到我们的数据库Employee表中。

Employee.java

Employee.java

package com.journaldev.hibernate.jpa.data;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class Employee {
	@Id
	@Column(name="EMP_ID")
	private long employeeId;
	@Column(name="EMP_NAME")
	private String employeeName;
	@Column(name="EMP_HIRE_DATE")
	@Temporal(TemporalType.TIMESTAMP)
	private Date employeeHireDate;
	@Column(name="EMP_SALARY")
	private double employeeSalary;

	public long getEmployeeId() {
		return employeeId;
	}

	public void setEmployeeId(long employeeId) {
		this.employeeId = employeeId;
	}

	public String getEmployeeName() {
		return employeeName;
	}

	public void setEmployeeName(String employeeName) {
		this.employeeName = employeeName;
	}

	public Date getEmployeeHireDate() {
		return employeeHireDate;
	}

	public void setEmployeeHireDate(Date employeeHireDate) {
		this.employeeHireDate = employeeHireDate;
	}

	public double getEmployeeSalary() {
		return employeeSalary;
	}

	public void setEmployeeSalary(double employeeSalary) {
		this.employeeSalary = employeeSalary;
	}
}
  • JPA provides @Entity which will be used for indicating Employee as a persistent domain class. Default mapping would be happening in order to map this persistent entity with its Employee Table. In case you’ve provided Table name or class name that aren’t identical, @Table must be used.

    JPA提供@Entity,用于将Employee指示为持久域类。 为了将这个持久实体与其员工表进行映射,将发生默认映射。 如果您提供的表名或类名不相同,则必须使用@Table。
  • @Id annotation used for indicating identity of a given Employee instance. Because of discrepancies between attribute name and column name, @column must be provided.

    @Id注释用于指示给定Employee实例的身份。 由于属性名称和列名称之间存在差异,因此必须提供@column。
  • @Column name annotation takes a parameter of mapped column name.

    @Column name批注采用映射列名称的参数。

Primefaces Spring JPA Hibernate EclipseLink示例持久性单元 (Primefaces Spring JPA Hibernate EclipseLink Example Persistence Unit)

As we’ve mentioned earlier, JPA provides an alternative way for bootstrapping JPA framework, it’s a persistence.xml file. The minimum amount of this file should look like:

如前所述,JPA提供了一种引导JPA框架的替代方法,它是一个persistence.xml文件。 该文件的最小数量应如下所示:

persistence.xml

persistence.xml

<persistence xmlns="https://java.sun.com/xml/ns/persistence"
	xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="https://java.sun.com/xml/ns/persistence https://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
	version="2.0">
	<!-- Will be referenced in Spring Context File -->
	<persistence-unit name="jpa-persistence" transaction-type="RESOURCE_LOCAL">
		<class>com.journaldev.hibernate.jpa.data.Employee</class>
		<properties>
			<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/journaldev" />
			<property name="javax.persistence.jdbc.user" value="pankaj" />
			<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
			<property name="javax.persistence.jdbc.password" value="pankaj123" />
		</properties>
	</persistence-unit>
</persistence>

Persistence unit should define:

持久性单元应定义:

  • Persistence unit name. That name will be referenced by Spring context.

    持久性单元名称。 该名称将由Spring上下文引用。
  • Transaction type – JPA implementation have the choice of managing the resource by itself (RESOURCE_LOCAL) or having them managed by the application server’s JTA implementation.

    事务类型– JPA实现可以选择自行管理资源( RESOURCE_LOCAL ),还是由应用程序服务器的JTA实现对其进行管理。
  • Information about database connection.

    有关数据库连接的信息。

Primefaces Spring JPA Hibernate EclipseLink示例Maven依赖项 (Primefaces Spring JPA Hibernate EclipseLink Example Maven Dependencies)

All required libraries are listed within pom.xml file that’s read by Maven itself.

Maven本身读取的pom.xml文件中列出了所有必需的库。

pom.xml

pom.xml

<project xmlns="https://maven.apache.org/POM/4.0.0" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.journaldev</groupId>
	<artifactId>Primefaces-Hibernate-JPA-Spring-Integration-Sample</artifactId>
	<packaging>war</packaging>
	<version>0.0.1-SNAPSHOT</version>
	<name>Primefaces-Hibernate-JPA-Spring-Integration-Sample Maven Webapp</name>
	<url>https://maven.apache.org</url>
	<repositories>
		<repository>
			<id>prime-repo</id>
			<name>PrimeFaces Maven Repository</name>
			<url>https://repository.primefaces.org</url>
			<layout>default</layout>
		</repository>
	</repositories>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<!-- Servlet -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<!-- Faces Implementation -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-impl</artifactId>
			<version>2.2.4</version>
		</dependency>
		<!-- Faces Library -->
		<dependency>
			<groupId>com.sun.faces</groupId>
			<artifactId>jsf-api</artifactId>
			<version>2.2.4</version>
		</dependency>
		<!-- Primefaces Version 5 -->
		<dependency>
			<groupId>org.primefaces</groupId>
			<artifactId>primefaces</artifactId>
			<version>5.0</version>
		</dependency>
		<!-- JSP Library -->
		<dependency>
			<groupId>javax.servlet.jsp</groupId>
			<artifactId>javax.servlet.jsp-api</artifactId>
			<version>2.3.1</version>
		</dependency>
		<!-- JSTL Library -->
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>jstl</artifactId>
			<version>1.1.2</version>
		</dependency>
		<!-- Hibernate 4.3.6 core library library -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>4.3.6.Final</version>
		</dependency>
		<!-- Hibernate 4.3.6 JPA support -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-entitymanager</artifactId>
			<version>4.3.6.Final</version>
		</dependency>
		<!-- MySQL driver connector library -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>5.1.31</version>
		</dependency>
		<!-- Spring ORM -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-orm</artifactId>
			<version>4.0.3.RELEASE</version>
		</dependency>
		<!-- Spring Web -->
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-webmvc</artifactId>
			<version>4.0.3.RELEASE</version>
		</dependency>
		<!-- Dependencies for Eclipse JPA Persistence API -->
		<dependency>
			<groupId>org.eclipse.persistence</groupId>
			<artifactId>eclipselink</artifactId>
			<version>2.5.0-RC1</version>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Hibernate / JPA Spring配置 (Hibernate/JPA Spring Configuration)

Persisting using of JPA requires an instance of EntityManager. This instance can be acquired by configuring a proper Spring context.

持续使用JPA需要EntityManager的实例。 可以通过配置适当的Spring上下文来获取此实例。

applicationContext.xml

applicationContext.xml

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="https://www.springframework.org/schema/beans"
	xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:tx="https://www.springframework.org/schema/tx"
	xmlns:context="https://www.springframework.org/schema/context"
	xmlns:aop="https://www.springframework.org/schema/aop" xmlns:util="https://www.springframework.org/schema/util"
	xsi:schemaLocation="https://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd https://www.springframework.org/schema/aop https://www.springframework.org/schema/aop/spring-aop.xsd https://www.springframework.org/schema/context  https://www.springframework.org/schema/context/spring-context-3.2.xsd https://www.springframework.org/schema/tx https://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
	<!-- Enable Spring Annotation Configuration -->
	<context:annotation-config />
	<!-- Scan for all of Spring components such as Spring Service -->
	<context:component-scan base-package="com.journaldev.spring.service"></context:component-scan>

	<!-- Necessary to get the entity manager injected into the factory bean -->
	<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />	

	<!-- Define Hibernate JPA Vendor Adapter -->
	<bean id="jpaVendorAdapter"
		class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
		<property name="databasePlatform"
			value="org.hibernate.dialect.MySQLDialect" />
	</bean>	

	<!-- Entity Manager Factory -->
	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
		<property name="persistenceUnitName" value="hibernate.jpa"></property>
		<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
	</bean>

	<!-- Transaction Manager -->
	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>

	<!-- Detect @Transactional -->
	<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
  1. JPA require an entityManagerFactory object which is an instance of org.springframework.orm.jpa.LocalEntityFactoryBean. This instance must be provided with the name of persistenceUnit and a JPAVendorAdapter.

    JPA需要一个objectManagerManager对象,该对象是org.springframework.orm.jpa.LocalEntityFactoryBean的实例。 必须为该实例提供persistenceUnit和JPAVendorAdapter的名称。
  2. To use @Trasnactional annotation properly, TransactionManager should be defined.

    为了正确使用@Trasnactional批注,应定义TransactionManager。
  3. Default name and location for Spring context configuration is applicationContext.xml and beneath of WEB-INF folder.

    Spring上下文配置的默认名称和位置是applicationContext.xml ,在WEB-INF文件夹下面。

EclipseLink / JPA Spring配置 (EclipseLink/JPA Spring Configuration)

Same configuration would be used for EclipseLink, a small change is required is to provide EclipseLink’s JPA vendor. Just change the jpaVendorAdapter bean to below and the JPA implementation used will be EclipseLink.

EclipseLink将使用相同的配置,需要做一点改动就是提供EclipseLink的JPA供应商。 只需将jpaVendorAdapter bean更改为下面的内容,使用的JPA实现将是EclipseLink。

applicationContext.xml

applicationContext.xml

<!-- Define EclipseLink JPA Vendor Adapter -->
	<bean id="jpaVendorAdapter"
		class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
		<property name="databasePlatform"
			value="org.eclipse.persistence.platform.database.MySQLPlatform" />
		<property name="generateDdl" value="false" />
		<property name="showSql" value="true" />
	</bean>

Primefaces部署描述符 (Primefaces Deployment Descriptor)

Proper configuration of Spring requires adding of Spring listener into Primefaces’ deployment descriptor web.xml application.

正确配置Spring需要将Spring侦听器添加到Primefaces的部署描述符web.xml应用程序中。

web.xml

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
	xmlns="https://java.sun.com/xml/ns/javaee" xmlns:web="https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="https://java.sun.com/xml/ns/javaee
	https://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5" metadata-complete="true">
	<servlet>
		<servlet-name>Faces Servlet</servlet-name>
		<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>/faces/*</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>Faces Servlet</servlet-name>
		<url-pattern>*.xhtml</url-pattern>
	</servlet-mapping>
	<context-param>
		<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
		<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
		<param-value>client</param-value>
	</context-param>
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
	</listener>
</web-app>

Spring员工服务 (Spring EmployeeService)

Spring service is the interaction point between presentation layer and persistence layer. If you’re familiar with DAO, you can consider it something similar.

Spring服务是表示层和持久层之间的交互点。 如果您熟悉DAO,则可以考虑使用类似的方法。

EmployeeService.java

EmployeeService.java

package com.journaldev.spring.service;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.journaldev.hibernate.jpa.data.Employee;

@Component
public class EmployeeService {
	@PersistenceContext
	private EntityManager em;

	public EntityManager getEm() {
		return em;
	}

	public void setEm(EntityManager em) {
		this.em = em;
	}

	@Transactional
	public void register(Employee emp) {
		// Save employee
		this.em.persist(emp);
	}
}
  1. EntityManager is injected using @PersistenceContext annotation. Even you’ve defined an instance of EntityManagerFactory, but a JPA implementation will be very smart to inject you an instance of EntityManager. EntityManager would be something similar for Session in Hibernate. In case you’ve invoked any of its CRUD operation within both of context and active transaction, your operation would be persisted against your persistence store. Note that em.persist() and using of @Transactional annotation upon register method.

    使用@PersistenceContext注释注入EntityManager。 即使您已经定义了EntityManagerFactory的实例,但是JPA实现将非常聪明地为您注入EntityManager的实例。 EntityManager与Hibernate中的Session类似。 如果您在上下文和活动事务中都调用了它的任何CRUD操作,则您的操作将在持久性存储中持久保存。 请注意em.persist()并在注册方法上使用@Transactional批注。

Primefaces托管Bean – RegisterEmployee (Primefaces Managed Bean – RegisterEmployee)

RegisterEmployee is a faces managed bean that’s used for handling user interaction and validation of user’s input.

RegisterEmployee是一个面Kong管理的Bean,用于处理用户交互和验证用户输入。

ResgiterEmployee.java

ResgiterEmployee.java

package com.journaldev.prime.faces.beans;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

import com.journaldev.jpa.data.Employee;
import com.journaldev.spring.service.EmployeeService;

@ManagedBean
@SessionScoped
public class RegisterEmployee {

	@ManagedProperty("#{employeeService}")
	private EmployeeService employeeService;

	private Employee employee = new Employee();

	public EmployeeService getEmployeeService() {
		return employeeService;
	}

	public void setEmployeeService(EmployeeService employeeService) {
		this.employeeService = employeeService;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public String register() {
		// Calling Business Service
		employeeService.register(employee);
		// Add message
		FacesContext.getCurrentInstance().addMessage(null,
				new FacesMessage("The Employee "+this.employee.getEmployeeName()+" Is Registered Successfully"));
		return "";
	}
}
  • Spring service EmployeeService is injected using Spring el-reslover that get declared with your faces-config.xml.

    Spring服务EmployeeService是使用Spring el-reslover注入的,并通过faces-config.xml进行声明。
  • Register method would delegate the invocation into an injected EmployeeService instance. As such, EmployeeService would handle real registration.

    Register方法会将调用委派到注入的EmployeeService实例中。 这样,EmployeeService将处理实际注册。

Primefaces员工注册页面 (Primefaces Employee Registration Page)

index.xhtml

index.xhtml

<html xmlns="https://www.w3.org/1999/xhtml"
	xmlns:ui="https://java.sun.com/jsf/facelets"
	xmlns:h="https://java.sun.com/jsf/html"
	xmlns:f="https://java.sun.com/jsf/core"
	xmlns:p="https://primefaces.org/ui">
<h:head>
	<script name="jquery/jquery.js" library="primefaces"></script>
	<title>Register Employee</title>
</h:head>
<h:form>
	<p:growl id="messages"></p:growl>
	<p:panelGrid columns="2">
		<p:outputLabel value="Enter Employee Name:"></p:outputLabel>
		<p:inputText value="#{registerEmployee.employee.employeeName}"></p:inputText>
		<p:outputLabel value="Enter Employee Hire Date:"></p:outputLabel>
		<p:calendar value="#{registerEmployee.employee.employeeHireDate}"></p:calendar>
		<p:outputLabel value="Enter Employee Salary:"></p:outputLabel>
		<p:inputText value="#{registerEmployee.employee.employeeSalary}"></p:inputText>
	</p:panelGrid>
	<p:commandButton value="Register" action="#{registerEmployee.register}" update="messages"></p:commandButton>
</h:form>
</html>

Primefaces Spring JPA Hibernate EclipseLink示例摘要 (Primefaces Spring JPA Hibernate EclipseLink Example Summary)

This tutorial aimed to help you get both of Hibernate and EclipseLink JPA implementations used into your project. JPA has changed your life, it’s so easy to configure, use and track. It’s plugged in with a default logging mechanism that would help you find your problem shortly. Contribute us by commenting below and find downloaded source code.

本教程旨在帮助您将Hibernate和EclipseLink JPA实现都用于您的项目中。 JPA改变了您的生活,它很容易配置,使用和跟踪。 它带有默认的日志记录机制,可以帮助您很快找到问题。 通过在下面评论来贡献我们,并找到下载的源代码。

翻译自: https://www.journaldev.com/4058/primefaces-spring-4-jpa-hibernate-eclipselink-example-tutorial

primefaces教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值