From 0a9914e7008b72ae5541ed9be895faff9ec7f158 Mon Sep 17 00:00:00 2001 From: jishenghua <752718920@qq.com> Date: Mon, 31 Mar 2025 22:34:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=99=BB=E5=BD=95=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=E5=85=A8=E9=83=A8?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/service/MaterialPropertyService.java | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialPropertyService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialPropertyService.java index 4a57f7e4a..4e1a8ccd1 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialPropertyService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/MaterialPropertyService.java @@ -47,9 +47,20 @@ public class MaterialPropertyService { public List getMaterialProperty()throws Exception { MaterialPropertyExample example = new MaterialPropertyExample(); example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED); - List list=null; + List list = new ArrayList<>(); try{ - list=materialPropertyMapper.selectByExample(example); + buildMaterialProperty(list); + List mpList = materialPropertyMapper.selectByExample(example); + Map mpMap = new HashMap<>(); + for(MaterialProperty mp: mpList) { + mpMap.put(mp.getNativeName(), mp.getAnotherName()); + } + //给list里面的别名和排序做更新 + for(MaterialProperty item: list) { + if(mpMap.get(item.getNativeName())!=null) { + item.setAnotherName(mpMap.get(item.getNativeName())); + } + } }catch(Exception e){ JshException.readFail(logger, e); } @@ -59,21 +70,7 @@ public class MaterialPropertyService { public List select(String name)throws Exception { List list = new ArrayList<>(); try{ - MaterialProperty mp1 = new MaterialProperty(); - MaterialProperty mp2 = new MaterialProperty(); - MaterialProperty mp3 = new MaterialProperty(); - mp1.setId(1L); - mp1.setNativeName("扩展1"); - mp1.setAnotherName("扩展1"); - list.add(mp1); - mp2.setId(2L); - mp2.setNativeName("扩展2"); - mp2.setAnotherName("扩展2"); - list.add(mp2); - mp3.setId(3L); - mp3.setNativeName("扩展3"); - mp3.setAnotherName("扩展3"); - list.add(mp3); + buildMaterialProperty(list); PageUtils.startPage(); List mpList = materialPropertyMapperEx.selectByConditionMaterialProperty(name); Map mpMap = new HashMap<>(); @@ -92,6 +89,24 @@ public class MaterialPropertyService { return list; } + private void buildMaterialProperty(List list) { + MaterialProperty mp1 = new MaterialProperty(); + MaterialProperty mp2 = new MaterialProperty(); + MaterialProperty mp3 = new MaterialProperty(); + mp1.setId(1L); + mp1.setNativeName("扩展1"); + mp1.setAnotherName("扩展1"); + list.add(mp1); + mp2.setId(2L); + mp2.setNativeName("扩展2"); + mp2.setAnotherName("扩展2"); + list.add(mp2); + mp3.setId(3L); + mp3.setNativeName("扩展3"); + mp3.setAnotherName("扩展3"); + list.add(mp3); + } + @Transactional(value = "transactionManager", rollbackFor = Exception.class) public int insertMaterialProperty(JSONObject obj, HttpServletRequest request)throws Exception { MaterialProperty materialProperty = JSONObject.parseObject(obj.toJSONString(), MaterialProperty.class);