From 08b4403ec8d6b69528d161cfcad80b5d64dea76c Mon Sep 17 00:00:00 2001 From: Administrator <876263681@qq.com> Date: 星期三, 02 七月 2025 15:12:43 +0800 Subject: [PATCH] #优化库位检索 --- src/main/java/com/zy/asrs/controller/LocDetlController.java | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 49 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LocDetlController.java b/src/main/java/com/zy/asrs/controller/LocDetlController.java index 34b0ba9..713da44 100644 --- a/src/main/java/com/zy/asrs/controller/LocDetlController.java +++ b/src/main/java/com/zy/asrs/controller/LocDetlController.java @@ -31,6 +31,7 @@ @Autowired private LocDetlService locDetlService; + @Autowired private LocDetlMapper locDetlMapper; @Autowired @@ -66,6 +67,18 @@ return R.parse(BaseRes.EMPTY); } + @GetMapping (value = "/locDetl/pageList/auth") + @ManagerAuth(memo = "鍒嗛〉鏌ヨ搴撳瓨鏄庣粏") + public R pageList(@RequestParam Map<String,Object> param){ + if (Cools.isEmpty(param.get("locNo"))){ + return new R(201,""); + } + Page<LocDetl> locDetlPage = locDetlService.selectPage(new Page<>(Integer.parseInt((String) param.get("curr")) + , Integer.parseInt((String) param.get("limit"))), new EntityWrapper<LocDetl>().eq("loc_no", param.get("locNo"))); + + return R.ok(locDetlPage); + } + @RequestMapping(value = "/stock/out/list/auth") @ManagerAuth public R stockOutList(@RequestParam(defaultValue = "1")Integer curr, @@ -83,7 +96,7 @@ return R.ok(locDetlService.getStockOut(toPage(curr, limit, param, LocDetl.class))); } - @RequestMapping(value = "/locDetl/list/auth") + @RequestMapping(value = "/locDetl/list/auth")// /locDetl/list/auth 鎺ュ彛闂 @ManagerAuth public R list(@RequestParam(defaultValue = "1")Integer curr, @RequestParam(defaultValue = "10")Integer limit, @@ -91,13 +104,14 @@ @RequestParam(required = false)String orderByType, @RequestParam(required = false)String condition, @RequestParam Map<String, Object> param){ - excludeTrash(param); EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); + excludeTrash(param); convert(param, wrapper); allLike(LocDetl.class, param.keySet(), wrapper, condition); if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} return R.ok(locDetlService.selectPage(new Page<>(curr, limit), wrapper)); } + private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ for (Map.Entry<String, Object> entry : map.entrySet()){ @@ -158,8 +172,31 @@ List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); EntityWrapper<LocDetl> wrapper = new EntityWrapper<>(); Map<String, Object> map = excludeTrash(param.getJSONObject("locDetl")); + String row = ""; + if (map.get("row") != null) { + String chooseRow = (String) map.get("row"); + if (chooseRow.length() == 1) { + row = "0" + chooseRow; + map.remove("row"); + }else { + row = chooseRow; + map.remove("row"); + } + } convert(map, wrapper); + if (!row.equals("")){ + wrapper.and() + .where("loc_no like '" +row +"%'"); + } List<LocDetl> list = locDetlService.selectList(wrapper); + for (LocDetl item : list) { + if (item.getSpecs() != null) { + item.setSpecs(item.getSpecs().replace("\"", "\"\"")); // 杞箟鍙屽紩鍙� + } + if (item.getBrand() != null) { + item.setBrand(item.getBrand().replace("\"", "\"\"")); + } + } return R.ok(exportSupport(list, fields)); } @@ -227,4 +264,14 @@ .doWrite(excel); } + /** + * 鑾峰彇搴撳瓨鎬绘暟 + * @return + */ + @RequestMapping("/locDetl/count") + public R getAllCount(){ + Integer sum = locDetlService.sum(); + return R.ok(sum); + } + } -- Gitblit v1.9.1