|
| 1 | +/* |
| 2 | + * Copyright (c) 2015,robinjim(robinjim@126.com) |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package com.robin.basis.controller.system; |
| 17 | + |
| 18 | +import com.robin.core.base.spring.SpringContextHolder; |
| 19 | +import com.robin.core.web.codeset.Code; |
| 20 | +import com.robin.core.web.codeset.CodeSetService; |
| 21 | +import com.robin.core.web.controller.AbstractController; |
| 22 | +import org.springframework.stereotype.Controller; |
| 23 | +import org.springframework.web.bind.annotation.*; |
| 24 | + |
| 25 | +import java.util.ArrayList; |
| 26 | +import java.util.HashMap; |
| 27 | +import java.util.List; |
| 28 | +import java.util.Map; |
| 29 | + |
| 30 | +@Controller |
| 31 | +@RequestMapping("/system") |
| 32 | +public class SysCodeContorller extends AbstractController { |
| 33 | + @GetMapping("/code/{codeSetNo}") |
| 34 | + @ResponseBody |
| 35 | + public Map<String,Object> getCodeSetCombo(@PathVariable String codeSetNo){ |
| 36 | + Map<String,Object> map=new HashMap<>(); |
| 37 | + List<Map<String,Object>> list=new ArrayList<>(); |
| 38 | + CodeSetService util= SpringContextHolder.getBean(CodeSetService.class); |
| 39 | + List<Code> codeList=getCodeList(util.getCacheCode(codeSetNo)); |
| 40 | + for(Code code:codeList){ |
| 41 | + Map<String, Object> tmap = new HashMap<>(); |
| 42 | + tmap.put("value", code.getValue()); |
| 43 | + tmap.put("label", code.getCodeName()); |
| 44 | + list.add(tmap); |
| 45 | + } |
| 46 | + wrapSuccessMap(map,""); |
| 47 | + map.put("data", list); |
| 48 | + return map; |
| 49 | + } |
| 50 | +} |
0 commit comments