public class Log extends Model<Log> {
private static final long serialVersionUID = 1L;
public static final Log dao = new Log();
public int findFenBiao(String username,Date date,String operation,String ip) {
Long size = Db.queryLong("select count(*) from log");
if (size < 100) {
return Db.update("insert into log(username,date,operation,ip) values(?, ?, ?, ?)",username,date,operation,ip);
} else {
List<Record> update = Db.find("select count(*) from information_schema.tables where table_name = 'test'");
if (update == null) {
Db.update("create table test(id int(20) not null AUTO_INCREMENT, primary key (id), username varchar(80), date date, operation varchar(20), ip varchar(20))");
}
return Db.update("insert into test(username,date,operation,ip) values(?, ?, ?, ?)",username,date,operation,ip);
}
}