教育训练处考试制证系统后端
zhangf
2024-09-11 1a316551c8e46b793904090cfa84781bf77fef2a
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
44
package com.gkhy.exam.institutionalaccess.controller;
 
import com.gkhy.exam.institutionalaccess.model.query.ThStatisticQuery;
import com.gkhy.exam.institutionalaccess.service.ThSubjectTypeService;
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.redis.RedisCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.PostConstruct;
 
@RestController
@RequestMapping("/th/subject/type")
public class ThSubjectTypeController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(ThSubjectTypeController.class);
    @Autowired
    private ThSubjectTypeService thSubjectTypeService;
    @Autowired
    private RedisCache redisCache;
    //缓存科目信息
    @PostConstruct
    private void initThSubjectType() {
        //清除redis缓存
        String key = CacheConstants.THREE_SUBJECT_TYPE;
        if (redisCache.hasKey(key)) {
            redisCache.deleteObject(key);
        }
        thSubjectTypeService.subjectTypeCache();
        log.info("【组织架构信息】已加入缓存");
    }
 
    @GetMapping("/tree")
    private AjaxResult getTree() {
        return AjaxResult.success(thSubjectTypeService.getTree());
    }
 
 
}