From 2de329dd62706509294fa9355ccd0b7e4f47dde1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=8D=E5=96=9C?= Date: Thu, 7 Nov 2024 10:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E8=AE=A1=E9=87=8F=E5=8D=95?= =?UTF-8?q?=E4=BD=8D=E5=8D=95=E5=85=83=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/MdUnitMeasureUnitTest.java | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 ktg-admin/src/test/MdUnitMeasureUnitTest.java diff --git a/ktg-admin/src/test/MdUnitMeasureUnitTest.java b/ktg-admin/src/test/MdUnitMeasureUnitTest.java new file mode 100644 index 0000000..6b5f56b --- /dev/null +++ b/ktg-admin/src/test/MdUnitMeasureUnitTest.java @@ -0,0 +1,78 @@ +import com.alibaba.fastjson.JSON; +import com.ktg.RuoYiApplication; +import com.ktg.mes.md.domain.MdUnitMeasure; +import com.ktg.mes.md.service.IMdUnitMeasureService; +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 MdUnitMeasureUnitTest { + @Autowired + private IMdUnitMeasureService mdUnitMeasureService; + + @Test + public void add() { + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setMeasureCode("打"); + mdUnitMeasure.setMeasureName("一打"); + mdUnitMeasure.setPrimaryFlag("Y"); + mdUnitMeasure.setEnableFlag("Y"); + mdUnitMeasureService.insertMdUnitMeasure(mdUnitMeasure); + System.out.println("add:" + mdUnitMeasure.getMeasureId()); // 225 + } + + @Test + public void list() { + List list = mdUnitMeasureService.selectMdUnitMeasureList(new MdUnitMeasure()); + System.out.println("list:" + JSON.toJSONString(list)); + } + + @Test + public void getInfo() { + System.out.println("getInfo:" + JSON.toJSONString(mdUnitMeasureService.selectMdUnitMeasureByMeasureId(225L))); + } + + @Test + public void edit() { + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setMeasureId(225L); + mdUnitMeasure.setMeasureCode("dozen"); + mdUnitMeasure.setMeasureName("一打"); + mdUnitMeasure.setPrimaryFlag("Y"); + mdUnitMeasure.setEnableFlag("Y"); + int count = mdUnitMeasureService.updateMdUnitMeasure(mdUnitMeasure); + System.out.println("edit:" + count); + } + + @Test + public void remove() { + Long[] ids = {225L}; + int count = mdUnitMeasureService.deleteMdUnitMeasureByMeasureIds(ids); + System.out.println("remove:" + count); + } + + @Test + public void listPrimary() { + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setPrimaryFlag("Y"); + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + System.out.println("listPrimary:" + JSON.toJSONString(list)); + } + + @Test + public void selectAll() { + MdUnitMeasure mdUnitMeasure = new MdUnitMeasure(); + mdUnitMeasure.setEnableFlag("Y"); + List list = mdUnitMeasureService.selectMdUnitMeasureList(mdUnitMeasure); + System.out.println("selectAll:" + JSON.toJSONString(list)); + } +}