package com.basic.security.manager;
|
|
import com.basic.security.model.ModelAdapter;
|
import com.basic.security.model.Time;
|
import com.basic.security.utils.ExceptionUtil;
|
|
import java.util.List;
|
|
public class TimeManager extends BaseManager {
|
public static List<ModelAdapter> getAllTimeRule() {
|
return findList("select * from time where del_flag='0'");
|
}
|
|
public static List<ModelAdapter> getAllUseTimeRule() {
|
return findList("select * from time where is_use='1' and del_flag ='0'");
|
}
|
|
public static void deleteOneTimeRule(ModelAdapter timeRule) {
|
try {
|
deletePhysically(findById("time", timeRule.getId()));
|
} catch (Exception e) {
|
ExceptionUtil.printException(e);
|
}
|
}
|
|
public static boolean isContain(String timeRuleName) {
|
List<ModelAdapter> allTimeRule = getAllTimeRule();
|
for (ModelAdapter timeRule : allTimeRule) {
|
if (timeRuleName.equals(timeRule.getString("time_rule_name"))) {
|
return true;
|
}
|
}
|
return false;
|
}
|
|
public static void saveTime(ModelAdapter timeDocument) {
|
BaseManager.save(timeDocument);
|
}
|
|
public static ModelAdapter findByTimeRuleName(String timeRuleName) {
|
return findOne("select * from time where " + Time.time_rule_name + "='" + timeRuleName + "'");
|
}
|
}
|