current position:Home>For the field of int type set, when 0 is entered, the database is null and empty

For the field of int type set, when 0 is entered, the database is null and empty

2022-02-02 20:58:59 CSDN Q & A

When I make a payment status setting , When not paid , yes 0, After payment is 1, But in typing 0 When , The database is null, It's empty
Here is the code

java The code in  GOrder gOrder = new GOrder();//  establish GOrder Order instance  gOrder.setPayStatus(0);// Unpaid status  0 Here's the entity class  public Integer payStatus; Here is mybatis mid-piece <if test="payStatus != null and payStatus !=''">                pay_status,            </if><if test="payStatus != null and payStatus !=''">                #{payStatus},            </if>



Refer to the answer 1:

Integer This kind of judgment Can't prevent 0 The state of
Just remove this and payStatus !=''




Refer to the answer 2:



Refer to the answer 3:

If you can ,sql Paste it completely




Refer to the answer 4:

copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202022058582638.html

Random recommended