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)); + } +}