From a94765c9f76d6b5e01ede793a909572d6fe3fd8a Mon Sep 17 00:00:00 2001 From: xyiege Date: Fri, 22 Jul 2022 02:28:50 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E8=AF=A6=E6=83=85=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/AdminGoodsController.java | 16 ++++++++++++++- .../chjyj/szwh/mapper/GoodsSourceMapper.java | 12 +++++++++++ .../mapper/szwh/GoodsSourceMapper.xml | 20 +++++++++++++++---- .../szwh/mapper/GoodsSourceMapperTest.java | 10 ++++++++++ 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java b/src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java index 09fad5a..abc775c 100644 --- a/src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java +++ b/src/main/java/cn/chjyj/szwh/controller/admin/AdminGoodsController.java @@ -2,11 +2,13 @@ package cn.chjyj.szwh.controller.admin; import cn.chjyj.szwh.bean.Goods; import cn.chjyj.szwh.bean.GoodsDetail; +import cn.chjyj.szwh.bean.GoodsSource; import cn.chjyj.szwh.bean.User; import cn.chjyj.szwh.controller.BaseController; import cn.chjyj.szwh.exception.ChException; import cn.chjyj.szwh.service.GoodsDetailService; import cn.chjyj.szwh.service.GoodsService; +import cn.chjyj.szwh.service.GoodsSourceService; import cn.chjyj.szwh.service.UserService; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -28,6 +30,8 @@ public class AdminGoodsController extends BaseController { @Autowired private GoodsDetailService goodsDetailService; @Autowired + private GoodsSourceService goodsSourceService; + @Autowired private UserService userService; /** @@ -193,8 +197,18 @@ public class AdminGoodsController extends BaseController { * @param jstr vue端发送来的json字符串 * @return */ - @PostMapping("/sourceDetail") + @RequestMapping("/sourceDetail") public JSONObject sourceDetail(@RequestBody String jstr){ + JSONObject request = JSON.parseObject(jstr); + String isli=request.getString("isli"); + String islicode=request.getString("islicode"); + String batchcode = request.getString("batchcode"); + + Map gsmap = goodsSourceService.getGoodsSourceDetail(isli,islicode,batchcode); + + jsonObject.put("code",200); + jsonObject.put("msg","成功"); + jsonObject.put("data",gsmap); return jsonObject; } } diff --git a/src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java b/src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java index 3eba62e..0728a16 100644 --- a/src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java +++ b/src/main/java/cn/chjyj/szwh/mapper/GoodsSourceMapper.java @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Map; /** * 商品来源 @@ -27,4 +28,15 @@ public interface GoodsSourceMapper { */ int countGoodSource(@Param("goodsIsli") String goodsIsli,@Param("dataype") int type, @Param("sourceIdentify")String sourceIdentify); + + /** + * 条件检索GOODSSOURCE + * @param map + * @param start + * @param limit + * @return + */ + List getGoodsSourceByMap(@Param("map") Map map, + @Param("start") int start, + @Param("limit") int limit); } diff --git a/src/main/resources/mapper/szwh/GoodsSourceMapper.xml b/src/main/resources/mapper/szwh/GoodsSourceMapper.xml index b30fabc..e3d548f 100644 --- a/src/main/resources/mapper/szwh/GoodsSourceMapper.xml +++ b/src/main/resources/mapper/szwh/GoodsSourceMapper.xml @@ -33,11 +33,23 @@ AND sourceIdentify like concat("%",#{sourceIdentify},"%"); - - + select from - where uname=#{uname} limit 1; + + + + + ${k} = #{v} + + + sourceIdentify like concat ('%',#{v},'%') + + + + + limit #{start},#{limit} diff --git a/src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java b/src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java index f77fb69..f753c19 100644 --- a/src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java +++ b/src/test/java/cn/chjyj/szwh/mapper/GoodsSourceMapperTest.java @@ -9,7 +9,9 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.xml.ws.soap.Addressing; +import java.util.HashMap; import java.util.List; +import java.util.Map; import static org.junit.jupiter.api.Assertions.*; @@ -40,4 +42,12 @@ class GoodsSourceMapperTest { int cc = goodsSourceMapper.countGoodSource(gisl,1,"ISLI01"); System.out.println(cc); } + + @Test + public void getGoodsSourceByMap(){ + Map map =new HashMap(); + map.put("sourceIdentify","010005-000000000000013279999999-7"); + List goodsSource = goodsSourceMapper.getGoodsSourceByMap(map,0,10); + System.out.println(goodsSource.size()); + } } \ No newline at end of file