Esempio n. 1
0
 public void deleteDicIndex(String id) {
   Map<String, Object> params = InstanceUtil.newHashMap();
   params.put("index_id", id);
   List<String> ids = dicMapper.selectIdByMap(params);
   if (ids.size() > 0) {
     throw new BusinessException();
   }
   dicIndexMapper.deleteById(id);
 }
Esempio n. 2
0
  @Cacheable(value = "sysDics")
  public Map<String, Map<String, String>> getAllDic() {
    List<String> records = dicIndexMapper.selectIdByMap(Collections.<String, Object>emptyMap());

    Map<String, String> dicIndexMap = InstanceUtil.newHashMap();
    for (String id : records) {
      dicIndexMap.put(id, dicIndexMapper.selectById(id).getKeyValue());
    }
    records = dicMapper.selectIdByMap(Collections.<String, Object>emptyMap());
    Page<String> idPage = new Page<String>(1, records.size());
    idPage.setRecords(records);
    Page<SysDic> sysDics = getPage(idPage, SysDic.class);
    Map<String, Map<String, String>> resultMap = InstanceUtil.newHashMap();
    for (SysDic sysDic : sysDics.getRecords()) {
      String key = dicIndexMap.get(sysDic.getIndexId());
      if (resultMap.get(key) == null) {
        Map<String, String> dicMap = InstanceUtil.newHashMap();
        resultMap.put(key, dicMap);
      }
      resultMap.get(key).put(sysDic.getCode(), sysDic.getCodeText());
    }
    return resultMap;
  }