1
0
forked from PGL/Clyde

Adapt the condition

This commit is contained in:
LeoMoulin 2024-03-22 12:03:07 +01:00
parent 9328601d2d
commit 49b99e14c9

View File

@ -20,14 +20,15 @@ public class RegNoGenerator implements IdentifierGenerator {
Statement statement = conn.createStatement();
int n = usv.getCount();
String query = "select count(reg_no)+"+n+" from Users";
usv.increment();
Calendar c = new GregorianCalendar();
int y = c.get(Calendar.YEAR);
String query = "select count(reg_no) + "+n+" from Users where reg_no/10000 = " + y%1000;
ResultSet set = statement.executeQuery(query);
long resp = 0;
Calendar c = new GregorianCalendar();
if(set.next()){
resp = set.getLong(1)+((c.get(Calendar.YEAR)%1000)*10000);
resp = set.getLong(1)+((y%1000)*10000);
usv.increment();
}
conn.close();