From 0710879d79015c2946496c1bdd3289a71f268201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=8D=E5=96=9C?= Date: Wed, 6 Nov 2024 15:29:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=BA=93=E6=88=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ktg-admin/src/test/WmWarehouseUnitTest.java | 77 +++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 ktg-admin/src/test/WmWarehouseUnitTest.java diff --git a/ktg-admin/src/test/WmWarehouseUnitTest.java b/ktg-admin/src/test/WmWarehouseUnitTest.java new file mode 100644 index 0000000..cd0d935 --- /dev/null +++ b/ktg-admin/src/test/WmWarehouseUnitTest.java @@ -0,0 +1,77 @@ +import com.alibaba.fastjson.JSON; +import com.ktg.RuoYiApplication; +import com.ktg.mes.wm.controller.WmWarehouseController; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmWarehouseService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RuoYiApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +public class WmWarehouseUnitTest { + @Autowired + private WmWarehouseController wmWarehouseController = null; + + @Autowired + private IWmWarehouseService wmWarehouseService; + + @Test + public void add() { + WmWarehouse wmWarehouse = new WmWarehouse(); + wmWarehouse.setWarehouseCode("WH999"); + wmWarehouse.setWarehouseName("测试库房999"); + wmWarehouse.setCharge("张三丰"); + wmWarehouse.setRemark("这是一个测试库房999"); + wmWarehouse.setAttr1("7"); + wmWarehouse.setAttr2("刀柄入库"); + wmWarehouse.setAttr3(1L); + wmWarehouseService.insertWmWarehouse(wmWarehouse); + System.out.println("add:" + wmWarehouse.getWarehouseId()); // 222 + } + + @Test + public void list() { + List list = wmWarehouseService.selectWmWarehouseList(new WmWarehouse()); + System.out.println("list:" + JSON.toJSONString(list)); + } + +// @Test TODO E +// public void getTreeList() { +// List list = wmWarehouseService.getTreeList(); +// System.out.println("getTreeList:" + JSON.toJSONString(list)); +// } + + @Test + public void getInfo() { + System.out.println("getInfo:" + JSON.toJSONString(wmWarehouseService.selectWmWarehouseByWarehouseId(222L))); + } + + @Test + public void edit() { + WmWarehouse wmWarehouse = new WmWarehouse(); + wmWarehouse.setWarehouseId(222L); + wmWarehouse.setWarehouseCode("WH999EDIT"); + wmWarehouse.setWarehouseName("测试库房999EDIT"); + wmWarehouse.setCharge("张三丰"); + wmWarehouse.setFrozenFlag("N"); + wmWarehouse.setRemark("这是一个测试库房999EDIT"); + wmWarehouse.setAttr1("7"); + wmWarehouse.setAttr2("刀柄入库"); + wmWarehouse.setAttr3(1L); + wmWarehouse.setAttr4(0L); + int count = wmWarehouseService.updateWmWarehouse(wmWarehouse); + System.out.println("edit:" + count); + } + + @Test + public void remove() { + Long[] ids = {222L}; + int count = wmWarehouseService.deleteWmWarehouseByWarehouseIds(ids); + System.out.println("remove:" + count); + } +}