Adapt the condition
This commit is contained in:
		@ -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();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user