| | |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.core.controller.AbstractBaseController; |
| | | import com.zy.common.i18n.I18nMessageService; |
| | | import com.zy.system.entity.Resource; |
| | | import com.zy.system.service.ResourceService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private ResourceService resourceService; |
| | | @Autowired |
| | | private I18nMessageService i18nMessageService; |
| | | |
| | | @RequestMapping(value = "/resource/{id}/auth") |
| | | @ManagerAuth |
| | |
| | | for (Resource resource : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", resource.getId()); |
| | | map.put("value", resource.getName().concat("(").concat(resource.getLevel$().substring(0, 2).concat(")"))); |
| | | String levelText = i18nMessageService.translateLegacy(Cools.isEmpty(resource.getLevel$()) ? "" : resource.getLevel$()); |
| | | String localizedName = i18nMessageService.resolveResourceText(resource.getName(), resource.getCode(), resource.getId()); |
| | | String shortLevelText = levelText.matches(".*[\\u4E00-\\u9FA5].*") |
| | | ? levelText.substring(0, Math.min(2, levelText.length())) |
| | | : levelText; |
| | | map.put("value", localizedName.concat("(").concat(shortLevelText).concat(")")); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | |
| | | else { |
| | | wrapper.orderBy("sort"); |
| | | } |
| | | return R.parse("0-操作成功").add(resourceService.selectList(wrapper)); |
| | | List<Resource> resources = resourceService.selectList(wrapper); |
| | | for (Resource resource : resources) { |
| | | resource.setName(i18nMessageService.resolveResourceText(resource.getName(), resource.getCode(), resource.getId())); |
| | | } |
| | | return R.parse("0-操作成功").add(resources); |
| | | } |
| | | |
| | | } |