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());
|
}
|
|
|
}
|