/**
 * 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.common.dto.PageReq;
import com.crunii.micro.common.utils.DateUtil;
import com.crunii.micro.platform.jdbc.MicroJdbcDao;
import com.crunii.micro.service.sysmgr.dto.sysmgr.RoleU;
import com.crunii.micro.service.sysmgr.dto.sysmgr.WorkerReq;
import com.crunii.micro.service.sysmgr.service.RoleService;
import com.crunii.micro.service.sysmgr.service.WorkerService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Commit;

import java.util.Date;

/**
 * @author 田平 create 2019年3月28日下午4:22:15
 */
public class WorkerServiceTest extends SysmgrBaseTest {

	@Autowired
	private WorkerService workerService;
	@Autowired
	private RoleService roleService;
	@Autowired
	private MicroJdbcDao microJdbcDao;

	//@Test
	@Commit
	public void testID() {
		System.out.println(workerService.getWorkerInfo(9999));
	}

	//@Test
	@Commit
	public void testUpdate() {

		RoleU roleU = new RoleU();
		roleU.setRoleId(9995);
		roleU.setRoleName("jpa update name111");
		roleU.setRoleDesc("jpa update111:" + DateUtil.format(new Date()));
		roleU.setState(1);
		roleService.updateRole(roleU);
	}

	@Test
	@Commit
	public void testPage() {
		PageReq<WorkerReq> req = new PageReq<WorkerReq>();
		WorkerReq workerReq = new WorkerReq();
		req.setQuery(workerReq);
		workerReq.setOrgId("1");
		// workerReq.setLoginCode("admin");
		workerService.pageWorker(req).getResult().forEach(System.out::println);
	}
}
