package com.demo.wjj.controller; import com.demo.wjj.po.Dictionary; import com.demo.wjj.po.ImgList; import com.demo.wjj.po.TbImgItem; import com.demo.wjj.service.DictionaryService; import com.demo.wjj.utils.ApiResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 数据字典 * @author wangqing * @date 2018.11.11 */ @RequestMapping("/dic") @RestController public class DictionaryController { private final Logger LOG = LoggerFactory.getLogger(getClass()); @Autowired private DictionaryService dictionaryService; /** * 获取设备类型 * @return apiResult */ @GetMapping("/getDeviceType") public ApiResult queryDeviceType() { LOG.info("调用获取设备类型(/dic/getDeviceType)接口"); try { List dictionaries = dictionaryService.queryDictionaryList(DictionaryService.DEVICE_TYPE); LOG.info("调用获取设备类型(/dic/getDeviceType)接口成功"); return ApiResult.createSuccess(dictionaries); } catch (Exception e) { LOG.error("调用获取设备类型(/dic/getDeviceType)接口异常", e); return ApiResult.createFailure(); } } /** * 获取配置说明 * @return apiResult */ @GetMapping("/getConfigInstructions") public ApiResult queryConfigInstructions() { LOG.info("调用获取配置说明(/dic/getDeviceType)接口"); try { List dictionaries = dictionaryService.queryDictionaryList(DictionaryService.CONFIG_INSTRUCTIONS); LOG.info("调用获取配置说明(/dic/getDeviceType)接口成功"); return ApiResult.createSuccess(dictionaries); } catch (Exception e) { LOG.error("调用获取配置说明(/dic/getDeviceType)接口异常", e); return ApiResult.createFailure(); } } /** * 获取作业履历 * @return apiResult */ @GetMapping("/getJobResume") public ApiResult queryJobResume() { LOG.info("调用获取作业履历(/dic/getJobResume)接口"); try { List dictionaries = dictionaryService.queryDictionaryList(DictionaryService.JOB_RESUME); LOG.info("调用获取作业履历(/dic/getJobResume)接口成功"); return ApiResult.createSuccess(dictionaries); } catch (Exception e) { LOG.error("调用获取作业履历(/dic/getJobResume)接口异常", e); return ApiResult.createFailure(); } } /** * 获取细节分类 * @return apiResult */ @PostMapping("/queryImgItemListByType") public ApiResult queryImgItemListByType(Integer type, Integer bqId) { LOG.info("获取细节分类(/dic/getQueryImgItemList)接口"); try { List ImgItemList = dictionaryService.queryImgItemListByType(type, bqId); LOG.info("获取细节分类(/dic/getQueryImgItemList)接口成功 ImgItemList{}",ImgItemList); return ApiResult.createSuccess(ImgItemList); } catch (Exception e) { LOG.error("获取细节分类(/dic/getQueryImgItemList)接口异常", e); return ApiResult.createFailure(); } } }