a
554325746@qq.com
2020-01-15 956063ff14bc75e3a2a97c7bcaa06b9edc84ad24
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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 + "'");
    }
}