From aa33e56e37cd19b88ae8eea69c5ebc7c6da8b1d2 Mon Sep 17 00:00:00 2001 From: Administrator <pjb> Date: 星期四, 05 六月 2025 17:59:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/glccwcs' into glccwcs --- src/main/java/com/zy/system/controller/ResourceController.java | 49 +++++++++++++++++++++++++------------------------ 1 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/zy/system/controller/ResourceController.java b/src/main/java/com/zy/system/controller/ResourceController.java index 64717f8..17b421a 100644 --- a/src/main/java/com/zy/system/controller/ResourceController.java +++ b/src/main/java/com/zy/system/controller/ResourceController.java @@ -29,11 +29,11 @@ @RequestMapping(value = "/resource/list/auth") @ManagerAuth - public R list(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, - @RequestParam(required = false)String orderByField, - @RequestParam(required = false)String orderByType, - @RequestParam Map<String, Object> param){ + public R list(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam(required = false) String orderByField, + @RequestParam(required = false) String orderByType, + @RequestParam Map<String, Object> param) { excludeTrash(param); EntityWrapper<Resource> wrapper = new EntityWrapper<>(); convert(param, wrapper); @@ -43,23 +43,24 @@ @RequestMapping(value = "/resource/tree/auth") @ManagerAuth - public R tree(@RequestParam(defaultValue = "1")Integer curr, - @RequestParam(defaultValue = "10")Integer limit, - @RequestParam(required = false)String orderByField, - @RequestParam(required = false)String orderByType, - @RequestParam Map<String, Object> param){ + public R tree(@RequestParam(defaultValue = "1") Integer curr, + @RequestParam(defaultValue = "10") Integer limit, + @RequestParam(required = false) String orderByField, + @RequestParam(required = false) String orderByType, + @RequestParam Map<String, Object> param) { EntityWrapper<Resource> wrapper = new EntityWrapper<>(); excludeTrash(param); convert(param, wrapper); - if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} - else { + if (!Cools.isEmpty(orderByField)) { + wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); + } else { wrapper.orderBy("sort"); } return R.parse("0-鎿嶄綔鎴愬姛").add(resourceService.selectList(wrapper)); } - private void convert(Map<String, Object> map, EntityWrapper wrapper){ - for (Map.Entry<String, Object> entry : map.entrySet()){ + private void convert(Map<String, Object> map, EntityWrapper wrapper) { + for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getKey().endsWith(">")) { wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue()))); } else if (entry.getKey().endsWith("<")) { @@ -73,11 +74,11 @@ @RequestMapping(value = "/resource/edit/auth") @ManagerAuth(memo = "鑿滃崟缂栬緫") public R edit(Resource resource) { - if (Cools.isEmpty(resource)){ + if (Cools.isEmpty(resource)) { return R.error(); } - if (null == resource.getId()){ - if (resource.getSort() == null){ + if (null == resource.getId()) { + if (resource.getSort() == null) { resource.setSort(999); } resourceService.insert(resource); @@ -94,10 +95,10 @@ return R.ok(); } - @RequestMapping(value = "/resource/update/auth") + @RequestMapping(value = "/resource/update/auth") @ManagerAuth(memo = "鑿滃崟淇敼") - public R update(Resource resource){ - if (Cools.isEmpty(resource) || null==resource.getId()){ + public R update(Resource resource) { + if (Cools.isEmpty(resource) || null == resource.getId()) { return R.error(); } resourceService.updateById(resource); @@ -106,8 +107,8 @@ @RequestMapping(value = "/resource/delete/auth") @ManagerAuth - public R delete(@RequestParam(value="ids[]") Long[] ids){ - for (Long id : ids){ + public R delete(@RequestParam(value = "ids[]") Long[] ids) { + for (Long id : ids) { resourceService.deleteById(id); } return R.ok(); @@ -115,7 +116,7 @@ @RequestMapping(value = "/resource/export/auth") @ManagerAuth(memo = "鑿滃崟瀵煎嚭") - public R export(@RequestBody JSONObject param){ + public R export(@RequestBody JSONObject param) { List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); EntityWrapper<Resource> wrapper = new EntityWrapper<>(); Map<String, Object> map = excludeTrash(param.getJSONObject("resource")); @@ -131,7 +132,7 @@ wrapper.like("name", condition); Page<Resource> page = resourceService.selectPage(new Page<>(0, 10), wrapper); List<Map<String, Object>> result = new ArrayList<>(); - for (Resource resource : page.getRecords()){ + 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(")"))); -- Gitblit v1.9.1