From 12c6c22ea0cddffc41f6d84383a53359607e26ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 17 Oct 2021 22:18:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E5=BA=93=E5=AD=98=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/jsh/erp/controller/MaterialController.java | 6 +++++- .../com/jsh/erp/datasource/mappers/MaterialMapperEx.java | 2 ++ .../java/com/jsh/erp/service/material/MaterialService.java | 5 +++-- .../src/main/resources/mapper_xml/MaterialMapperEx.xml | 7 ++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java index fafea574..6010c23c 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java @@ -535,6 +535,8 @@ public class MaterialController { * @param categoryId * @param materialParam * @param mpList + * @param column + * @param order * @param request * @return * @throws Exception @@ -546,6 +548,8 @@ public class MaterialController { @RequestParam("categoryId") Long categoryId, @RequestParam("materialParam") String materialParam, @RequestParam("mpList") String mpList, + @RequestParam("column") String column, + @RequestParam("order") String order, HttpServletRequest request)throws Exception { BaseResponseInfo res = new BaseResponseInfo(); Map map = new HashMap<>(); @@ -555,7 +559,7 @@ public class MaterialController { idList = materialService.getListByParentId(categoryId); } List dataList = materialService.getListWithStock(depotId, idList, StringUtil.toNull(materialParam), - (currentPage-1)*pageSize, pageSize); + column, order, (currentPage-1)*pageSize, pageSize); int total = materialService.getListWithStockCount(depotId, idList, StringUtil.toNull(materialParam)); MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotId, idList, StringUtil.toNull(materialParam)); map.put("total", total); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java index 9aec39c2..eeef5261 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java @@ -92,6 +92,8 @@ public interface MaterialMapperEx { @Param("depotId") Long depotId, @Param("idList") List idList, @Param("materialParam") String materialParam, + @Param("column") String column, + @Param("order") String order, @Param("offset") Integer offset, @Param("rows") Integer rows); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java index 737a9cd2..f99c4d85 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -818,8 +818,9 @@ public class MaterialService { return materialMapperEx.getMaterialByBarCode(barCodeArray); } - public List getListWithStock(Long depotId, List idList, String materialParam, Integer offset, Integer rows) { - return materialMapperEx.getListWithStock(depotId, idList, materialParam, offset, rows); + public List getListWithStock(Long depotId, List idList, String materialParam, + String column, String order, Integer offset, Integer rows) { + return materialMapperEx.getListWithStock(depotId, idList, materialParam, column, order, offset, rows); } public int getListWithStockCount(Long depotId, List idList, String materialParam) { diff --git a/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml index 8c11c9a9..d0f8c44f 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml @@ -367,7 +367,12 @@ and ifnull(m.delete_flag,'0') !='1' group by m.id - order by m.id desc + + order by m.id desc + + + order by ${column} ${order} + limit #{offset},#{rows}