parent
2d870ae379
commit
2f1163dd32
@ -0,0 +1,109 @@
|
||||
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
||||
|
||||
import cn.estsh.i3plus.core.api.iservice.busi.IToolService;
|
||||
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
||||
import cn.estsh.i3plus.pojo.base.common.Pager;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.platform.bean.Tool;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description : 测试 硬件服务接口
|
||||
* @Reference :
|
||||
* @Author : yunhao
|
||||
* @Date : 2018-10-31 15:30
|
||||
* @Modify :
|
||||
**/
|
||||
public class TestToolServiceImpl extends TestBase {
|
||||
|
||||
@Autowired
|
||||
IToolService toolService;
|
||||
|
||||
/**
|
||||
* 测试 查询所有硬件
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testListTool() {
|
||||
List list = toolService.listTool();
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id查询硬件
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testGetToolById() {
|
||||
Tool tool = toolService.getToolById("1057110061127700480");
|
||||
System.out.println(JSON.toJSONString(tool));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 添加硬件
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
@Rollback(false)
|
||||
public void testInsertTool() {
|
||||
Tool tool = new Tool();
|
||||
tool.setName("扫描枪");
|
||||
tool.setToolTypeId(1057261374348070912L);
|
||||
tool.setRedToolTypeName("扫描枪22");
|
||||
tool.setToolConnTypeId(1);
|
||||
tool.setToolDataTypeId(1);
|
||||
tool.setToolStatusId(CommonEnumUtil.DATA_STATUS.ENABLE.getValue());
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
tool.setId(null);
|
||||
tool.setName("扫描枪"+i);
|
||||
toolService.insertTool(tool);
|
||||
}
|
||||
System.out.println(JSON.toJSONString(tool));
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 修改硬件
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testUpdateTool(){
|
||||
Tool tool = toolService.getToolById("1057110613261684736");
|
||||
tool.setName("测试修改");
|
||||
|
||||
toolService.updateTool(tool);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 根据id删除硬件
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testDeleteToolById(){
|
||||
toolService.deleteToolById("1057111616417566720");
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试 复杂查询
|
||||
*/
|
||||
@Test
|
||||
@Transactional
|
||||
public void testQueryToolByPager(){
|
||||
Tool tool = new Tool();
|
||||
|
||||
Pager pager = new Pager();
|
||||
pager.setPageSize(10);
|
||||
pager.setCurrentPage(5);
|
||||
|
||||
ListPager list = toolService.queryToolByPager(tool,pager);
|
||||
System.out.println(list);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue