/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights reserved. <a>http://www.crunii.com</a>
 */
package com.crunii.micro.api.test;

import com.crunii.micro.service.sysmgr.dto.org.OrgC;
import com.crunii.micro.service.sysmgr.service.OrgService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;

/**
 * @author 田平 create 2019年6月5日上午10:16:09
 */
public class OrgServiceTest extends SysmgrBaseTest {

	@Autowired
	private OrgService orgService;

	//@Test
	@Rollback(false)
	public void testCreate() {
		OrgC orgC = new OrgC();
		orgC.setOrgCode("CRUNII");
		orgC.setOrgName("中冉");
		orgC.setOrgDesc("中冉信息产业有限公司");
		orgC.setParentOrgId(0L);
		orgC.setSortId(1);
		orgService.createOrg(orgC);
	}

	//@Test
	@Rollback(false)
	public void testCreate2() {
		OrgC orgC = new OrgC();
		orgC.setOrgCode("JIWEIHUI7");
		orgC.setOrgName("技委会7");
		orgC.setOrgDesc("技委会7");
		orgC.setParentOrgId(2L);
		orgC.setSortId(4);
		orgService.createOrg(orgC);
	}

	//@Test
	@Rollback(true)
	public void testCheckOrgCode() {
		System.out.println(orgService.checkOrgCode("ABC"));
		System.out.println(orgService.checkOrgCode("DESIGN"));
	}

	@Test
	@Rollback(true)
	public void testGetOrgChildren() {
		orgService.getOrgChildren(0L,1).forEach(System.out::println);
	}

}
