shichongfu
2023-04-25 ce0b49552668d3331055e2b1a1447a743dc54939
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
package com.product.admin.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import com.product.admin.config.SystemCode;
import com.product.core.cache.DataPoolRefreshCache;
import com.product.core.config.CoreConst;
import com.product.core.dao.BaseDao;
import com.product.core.entity.DataTableEntity;
import com.product.core.exception.BaseException;
import com.product.core.service.support.AbstractBaseService;
import com.product.util.BaseUtil;
 
@Component
public class SystemCacheService extends AbstractBaseService {
 
    @Autowired
    private BaseDao baseDao;
 
    public void refreshCache(String[] tableNames) throws BaseException {
        if (tableNames == null || tableNames.length == 0) {
            DataTableEntity listTable = baseDao.listTable(CoreConst.PRODUCT_SYS_CACHE_CONFIG);
            if (BaseUtil.dataTableIsEmpty(listTable)) {
                throw new BaseException(SystemCode.SYSTEM_CACHE_TABLE_FOR_EMPTY.getValue(),
                        SystemCode.SYSTEM_CACHE_TABLE_FOR_EMPTY.getText(), this.getClass(), "refreshCache");
            }
            for (int i = 0; i < listTable.getRows(); i++) {
 
 
                DataPoolRefreshCache.getInstance().put(listTable.getString(i, "table_name"));
 
 
            }
        } else {
            for (int i = 0; i < tableNames.length; i++) {
                DataPoolRefreshCache.getInstance().put(tableNames[i]);
            }
        }
    }
}