国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Home Java javaTutorial When the front-end passes data to the back-end, the back-end displays that the obtained data is NULL. How to solve it?

When the front-end passes data to the back-end, the back-end displays that the obtained data is NULL. How to solve it?

Apr 19, 2025 pm 09:15 PM
usdt red

When the front-end passes data to the back-end, the back-end displays that the obtained data is NULL. How to solve it?

Problem Description: During the development process of using the Ruoyi separate framework, the front-end uses POST request to pass data to the back-end, but the back-end receives a NULL value.

Front-end code:

 //Modify the order status export function updateorderstatus(id,status){
    const data={
        id,
        status
    }
    return request({
        url:"/business/orderinfo/updatestate",
        method:"post",
        data:data
    })
}

Screenshot of front-end request data: (Screenshot of front-end request data should be included here)

Backend code (original code):

 @ApiOperation("Order Management-Modify Order Status")
@ApiImplicitParams({
    @ApiImplicitParam(name="id", value = "primary key id", required = true, dataType = "integer"),
    @ApiImplicitParam(name="status", value = "Status 0 ends with 1", required = true, dataType = "integer")
})
@PostMapping("/updatestate")
public AjaxResult updateState(Integer id, Integer status) {
    System.out.println("Change Order Number: "id "\n");
    System.out.println("Change order status: " status "\n");
    // ... (Other code)
}

Screenshot of backend printing results: (This should include screenshots of backend printing results, showing id and status as null)

Problem analysis: The backend uses Integer id, Integer status to receive parameters. When processing POST requests, Spring Boot cannot correctly parse JSON data in the request body to these parameters by default.

Solution: Modify the backend code and bind the JSON data in the request body to an object using the @RequestBody annotation.

Modified backend code:

 @ApiOperation("Order Management-Modify Order Status")
@PostMapping("/updatestate")
public AjaxResult updateState(@RequestBody OrderStatusDTO orderStatusDTO) {
    System.out.println("Change Order Number:" orderStatusDTO.getId() "\n");
    System.out.println("Change order status:" orderStatusDTO.getStatus() "\n");

    if (orderStatusDTO.getId() == null) {
        return AjaxResult.error("enter primary key id");
    }
    if (orderStatusDTO.getStatus() == null) {
        return AjaxResult.error("Input Status");
    }

    BorderInfo borderInfo = new BorderInfo();
    borderInfo.setId(orderStatusDTO.getId());
    borderInfo.setStatus(orderStatusDTO.getStatus());
    System.out.println("Change order status:" borderInfo.toString() "\n");
    orderInfoService.update(borderInfo);
    return AjaxResult.success();
}

Added OrderStatusDTO class:

 public class OrderStatusDTO {
    private Integer id;
    private Integer status;

    // getters and setters
}

By using @RequestBody annotation and creating an OrderStatusDTO class to receive the JSON data passed by the front end, the backend can correctly parse the data to avoid the problem of NULL values. Please make sure that the JSON data sent by the front end is consistent with the field name of OrderStatusDTO . At the same time, check whether the front-end request function has correctly set headers , such as Content-Type: application/json .

This solution is more in line with the design specifications of the RESTful API than the original @RequestParam solution, and also processes the body data of POST requests more clearly.

The above is the detailed content of When the front-end passes data to the back-end, the back-end displays that the obtained data is NULL. How to solve it?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to get stablecoin USDT for free_Xiaobai stablecoin USDT obtain guide How to get stablecoin USDT for free_Xiaobai stablecoin USDT obtain guide Jul 15, 2025 pm 11:51 PM

Yes, you can get USDT for free in the following 5 ways: 1. Participate in airdrop tasks on mainstream exchanges, such as registering and giving away, completing novice tasks, and inviting friends to get rewards; 2. Join the blockchain project community and obtain airdrops through Web3 social platform or Twitter/Discord interaction; 3. Participate in the "test network" activity, register the test chain address and simulate the use of DApp to get incentives; 4. Complete tasks on the cryptocurrency navigation platform to receive novice gift packages, participate in sign-in, lottery and other activities; 5. Interact with the content creation and community, and publish original content to obtain USDT rewards from the project party. At the same time, you need to pay attention to security risks, do not fill in private keys, do not believe in scams, and choose mainstream platforms to participate.

How much cash is 1USDT equal? USDT Value Conversion Tutorial (Mainland) How much cash is 1USDT equal? USDT Value Conversion Tutorial (Mainland) Jul 10, 2025 pm 08:42 PM

?As a stable digital asset pegged to the US dollar, USDT's value conversion and monetization are issues that many users are concerned about. This article will introduce the value composition of USDT in detail and provide practical tutorials on value conversion and monetization in mainland China. 1 USDT's cash value is approximately equal to the real-time dollar exchange rate, but the final delivery price through C2C trading will fluctuate slightly. The core of conversion is to select a merchant with good reputation and appropriate price to trade through the C2C function of a reliable platform.

Is the stablecoin USDT a scam? Is the company behind the stablecoin USDT reliable? Is the stablecoin USDT a scam? Is the company behind the stablecoin USDT reliable? Jul 15, 2025 pm 11:57 PM

USDT is not a scam, but there are risks. 1. Tether provides liquidity in the crypto market by issuing USDT, a stablecoin anchored by the US dollar; 2. The company's background is related to Bitfinex, and has been fined for audit issues but has increased transparency; 3. The reserve assets are mainly US Treasury bonds rather than pure cash, and there are certain financial risks; 4. Face risks such as insufficient audit frequency, centralized control and compliance restrictions; 5. The USDT market is highly accepted, but trust needs to be based on continuous disclosure and compliance operations. Overall, USDT is trustworthy but does not equal zero risk, and users should be cautious.

How to exchange USDT for stablecoin USDT into cash_USDT withdrawal tutorial How to exchange USDT for stablecoin USDT into cash_USDT withdrawal tutorial Jul 15, 2025 pm 11:54 PM

USDT cash exchange needs to be operated through a trading platform that supports fiat currency withdrawal. 1. Prepare a trading platform account that supports fiat currency withdrawal (such as Binance, Ouyi, Huobi, etc.); 2. Complete KYC real-name authentication; 3. Bind bank cards or Alipay and other payment methods; 4. Log in to the account and ensure that USDT is in the fund account or spot account; 5. Enter the OTC or fiat currency area and choose to sell USDT; 6. Set the sales amount and match the buyer; 7. After confirming the other party’s payment, click “Confirm Coin Delivery” to complete the transaction. Withdrawal methods include OTC fiat currency transactions, bank card withdrawals and third-party payments, among which OTC is more efficient. Notes include making sure to verify that the money is received before releasing, avoiding frequent large withdrawals, and contacting customer service in time when encountering abnormalities. The key to the entire process is to choose

What does the counter-referential meaning of the currency circle? Why do some people specifically operate in reverse? Market sentiment indicators What does the counter-referential meaning of the currency circle? Why do some people specifically operate in reverse? Market sentiment indicators Jul 10, 2025 pm 09:27 PM

The "reverse reference" in the currency circle, as the name suggests, refers to those reference objects whose views or operations are often opposite to the actual market trend. When such people or groups are extremely optimistic, the market may face a decline; when they are extremely pessimistic, the market may instead rebound. This is not to say that these people deliberately provide wrong signals, but that their judgments may deviate from the mainstream trends in the market, or that their operating behavior happens to be a catalyst for market reversal in a specific situation.

Which exchanges are listed on NALA coins? Where can I buy NALA coins? Which exchanges are listed on NALA coins? Where can I buy NALA coins? Jul 11, 2025 pm 10:18 PM

NALA coins can be traded on platforms such as Uniswap V2 (Ethereum Network), Uniswap V3 (Base Network), MEXC and CoinUnited.io. The specific steps are: 1. Select a trading platform; 2. Register and complete identity verification; 3. Recharge funds; 4. Purchase NALA; 5. Withdraw coins to your personal wallet. Please ensure the security of the platform before investing and pay attention to market volatility risks.

How to transfer USDT to the exchange of stablecoin_Detailed explanation of USDT exchange trading operations How to transfer USDT to the exchange of stablecoin_Detailed explanation of USDT exchange trading operations Jul 15, 2025 pm 11:36 PM

To transfer USDT to the exchange for transactions, you must first confirm that the chain type matches, the address is correct, and complete real-name authentication. 1. Register and authenticate the mainstream exchange account with real name; 2. Confirm that the wallet is consistent with the USDT chain type of the exchange (such as TRC20); 3. Obtain the recharge address of the corresponding chain on the exchange and copy it accurately; 4. Initiate transfers from the wallet and pay the corresponding handling fee; 5. After arrival, you can trade in the spot or contract market; 6. Pay attention to checking the address, avoid transferring to the contract address, and give priority to low-processing networks. The entire process is usually completed in minutes, ensuring operational safety is key.

How to check the airdrop of currency circle projects? How to avoid fake airdrop scams? How to check the airdrop of currency circle projects? How to avoid fake airdrop scams? Jul 10, 2025 pm 09:12 PM

Finding airdrop opportunities for cryptocurrency projects is the way many participants want to acquire tokens for early-stage projects. These airdrops are usually a means for project parties to promote brand, community construction, or inspire early users. To find this information effectively, you need to rely on multiple reliable channels and methods.

See all articles