|
|
@@ -61,7 +61,7 @@ public class MesIconsController extends BaseController {
|
|
|
public MesIcons get(String id, boolean isNewRecord) {
|
|
|
return mesIconsService.get(id, isNewRecord);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询列表
|
|
|
*/
|
|
|
@@ -71,7 +71,7 @@ public class MesIconsController extends BaseController {
|
|
|
model.addAttribute("mesIcons", mesIcons);
|
|
|
return "modules/mes/mesIconsList";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 查询列表数据
|
|
|
*/
|
|
|
@@ -85,50 +85,81 @@ public class MesIconsController extends BaseController {
|
|
|
|
|
|
return page;
|
|
|
}
|
|
|
-
|
|
|
@RequestMapping(value = "icons")
|
|
|
@ResponseBody
|
|
|
public CommonResp icons(MesIcons mesIcons,HttpServletRequest req) {
|
|
|
- CommonResp<List<MesIconsResp>> resp = new CommonResp<>();
|
|
|
- String icons = CacheUtils.get("mes_icons","icons","");
|
|
|
- if(icons != null && !icons.isEmpty()){
|
|
|
- List<MesIconsResp> lists1 = JSON.parseArray(icons,MesIconsResp.class);
|
|
|
- if(!ListUtils.isEmpty(lists1)){
|
|
|
- resp.setData(lists1);
|
|
|
- resp.setResult(Global.TRUE);
|
|
|
- return resp;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<MesIconsResp> mapList = ListUtils.newArrayList();
|
|
|
String host = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/js";
|
|
|
List<MesIcons> list = mesIconsService.findList(mesIcons);
|
|
|
+ List<Map<String, Object>> mapList = ListUtils.newArrayList();
|
|
|
Subject subject = UserUtils.getSubject();
|
|
|
for (MesIcons mi : list) {
|
|
|
if(subject.isPermitted(mi.getAuth())){
|
|
|
- MesIconsResp map = new MesIconsResp();
|
|
|
- map.setTitle(mi.getTitle());
|
|
|
- map.setMode(mi.getMode());
|
|
|
- map.setImg("");
|
|
|
+ Map<String, Object> map = MapUtils.newHashMap();
|
|
|
+ map.put("title", mi.getTitle());
|
|
|
+ map.put("mode", mi.getMode());
|
|
|
// 获取图片
|
|
|
FileUpload fu = new FileUpload();
|
|
|
fu.setBizKey(mi.getId());
|
|
|
fu.setBizType("mesIcons_image");
|
|
|
List<FileUpload> finfo = fileUploadService.findList(fu);
|
|
|
- if(ListUtils.isNotEmpty(finfo)){
|
|
|
- map.setImg(finfo.get(0).getFileUrl());
|
|
|
+ if(finfo!=null&&finfo.size()>0){
|
|
|
+ map.put("img", host + finfo.get(0).getFileUrl());
|
|
|
+ }else{
|
|
|
+ map.put("img", host + "");
|
|
|
}
|
|
|
+
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
}
|
|
|
- if(!ListUtils.isEmpty(mapList)){
|
|
|
- CacheUtils.put("mes_icons","icons",JSON.toJSONString(mapList));
|
|
|
- }
|
|
|
|
|
|
+ CommonResp<List<Map<String, Object>>> resp = new CommonResp<>();
|
|
|
resp.setData(mapList);
|
|
|
resp.setResult(Global.TRUE);
|
|
|
return resp;
|
|
|
}
|
|
|
+// @RequestMapping(value = "icons")
|
|
|
+// @ResponseBody
|
|
|
+// public CommonResp icons(MesIcons mesIcons,HttpServletRequest req) {
|
|
|
+// CommonResp<List<MesIconsResp>> resp = new CommonResp<>();
|
|
|
+// String icons = CacheUtils.get("mes_icons","icons","");
|
|
|
+// if(icons != null && !icons.isEmpty()){
|
|
|
+// List<MesIconsResp> lists1 = JSON.parseArray(icons,MesIconsResp.class);
|
|
|
+// if(!ListUtils.isEmpty(lists1)){
|
|
|
+// resp.setData(lists1);
|
|
|
+// resp.setResult(Global.TRUE);
|
|
|
+// return resp;
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// List<MesIconsResp> mapList = ListUtils.newArrayList();
|
|
|
+// String host = req.getScheme() + "://" + req.getServerName() + ":" + req.getServerPort() + "/js";
|
|
|
+// List<MesIcons> list = mesIconsService.findList(mesIcons);
|
|
|
+// Subject subject = UserUtils.getSubject();
|
|
|
+// for (MesIcons mi : list) {
|
|
|
+// if(subject.isPermitted(mi.getAuth())){
|
|
|
+// MesIconsResp map = new MesIconsResp();
|
|
|
+// map.setTitle(mi.getTitle());
|
|
|
+// map.setMode(mi.getMode());
|
|
|
+// map.setImg("");
|
|
|
+// // 获取图片
|
|
|
+// FileUpload fu = new FileUpload();
|
|
|
+// fu.setBizKey(mi.getId());
|
|
|
+// fu.setBizType("mesIcons_image");
|
|
|
+// List<FileUpload> finfo = fileUploadService.findList(fu);
|
|
|
+// if(ListUtils.isNotEmpty(finfo)){
|
|
|
+// map.setImg(finfo.get(0).getFileUrl());
|
|
|
+// }
|
|
|
+// mapList.add(map);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if(!ListUtils.isEmpty(mapList)){
|
|
|
+// CacheUtils.put("mes_icons","icons",JSON.toJSONString(mapList));
|
|
|
+// }
|
|
|
+//
|
|
|
+// resp.setData(mapList);
|
|
|
+// resp.setResult(Global.TRUE);
|
|
|
+// return resp;
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
|
* 查看编辑表单
|
|
|
@@ -150,7 +181,7 @@ public class MesIconsController extends BaseController {
|
|
|
mesIconsService.save(mesIcons);
|
|
|
return renderResult(Global.TRUE, text("保存功能模块成功!"));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 停用数据
|
|
|
*/
|
|
|
@@ -162,7 +193,7 @@ public class MesIconsController extends BaseController {
|
|
|
mesIconsService.updateStatus(mesIcons);
|
|
|
return renderResult(Global.TRUE, text("停用功能模块成功"));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 启用数据
|
|
|
*/
|
|
|
@@ -174,7 +205,7 @@ public class MesIconsController extends BaseController {
|
|
|
mesIconsService.updateStatus(mesIcons);
|
|
|
return renderResult(Global.TRUE, text("启用功能模块成功"));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 删除数据
|
|
|
*/
|
|
|
@@ -185,5 +216,5 @@ public class MesIconsController extends BaseController {
|
|
|
mesIconsService.delete(mesIcons);
|
|
|
return renderResult(Global.TRUE, text("删除功能模块成功!"));
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
+
|
|
|
+}
|