The primary key is set by the comment "@Id", and MongoDB automatically generates the primary key if the primary key is not set.
Import Org.springframework.data.annotation.Id;
public static class ordercomsumedto{
@Id
private String OrderNo;
Private String Jnlno;
Private String dateTime;
Public String Getorderno () {
return orderno;
}
public void Setorderno (String orderno) {
This.orderno = OrderNo;
}
Public String Getjnlno () {
return jnlno;
}
public void Setjnlno (String jnlno) {
jnlno = Jnlno;
}
Public String GetDateTime () {
return dateTime;
}
public void SetDateTime (String dateTime) {
this.datetime = dateTime;
}
}
Increase/delete/check
@Override public
void Insert (Ordercomsumedto obj) {
this.save (obj);
}
@Override public
ordercomsumedto Selectbyprimarykey (String id) {
ordercomsumedto dto = This.findbyid (ID);
return dto;
}
@Override public
int Deletebyprimarykey (String id) {
return This.deletebyid (ID);
}