package test.xt.hb.task;

import java.util.List;
import java.util.Map;

import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;

import com.xt.hb.data.aq.aqmap.AqcxMapper;
import com.xt.hb.data.aq.model.ThreeColumn;
import com.xt.hb.data.gps.model.GpsInfo;
import com.xt.hb.data.gps.svc.GpsService;

@RunWith(JUnit4ClassRunner.class)
// 配置了@ContextConfiguration注解并使用该注解的locations属性指明spring和配置文件之后，
@ContextConfiguration(locations = { "classpath:spring/spring.xml" })
public class AqcxMapperTest {
	@Autowired
	private AqcxMapper aqcxMapper;

	@Autowired
	private GpsService gpsService;

	@Test
	public void testGps() {
		List<GpsInfo> gpss = gpsService.getGPSRealTime();
		System.err.println(gpss.size());
	}

	/**
	 * 湖北省所在地查询
	 */
	@Test
	public void selectHbszd() {
		List<ThreeColumn> result = aqcxMapper.selectHbszd();
		for (ThreeColumn r : result) {
			System.err.println(r.getColumn1() + "," + r.getColumn2() + "," + r.getColumn3());
		}
	}

	/**
	 * 根据所在地ID查询港区名称和ID
	 */
	@Test
	public void selectGqBySzd() {
		List<ThreeColumn> result = aqcxMapper.selectGqByCity("4201");
		for (ThreeColumn r : result) {
			System.err.println(r.getColumn1() + "," + r.getColumn2() + "," + r.getColumn3());
		}
	}

	/**
	 * 根据港区查询经营人
	 */
	@Test
	public void selectJyrmcByGq() {
		List<ThreeColumn> result = aqcxMapper.selectJyrmcByGq(10);
		for (ThreeColumn r : result) {
			System.err.println(r.getColumn1() + "," + r.getColumn2() + "," + r.getColumn3());
		}
	}

	/**
	 * 根据码头ID查询码头信息
	 */
	@Test
	public void selectMtxxByGisId() {
		Map<String, Object> mtxx = aqcxMapper.selectMtxxByGisId("1");
		System.err.println(mtxx.toString());
		Assert.assertNotNull(mtxx);
	}

	/**
	 * 根据泊位ID查询泊位信息
	 */
	@Test
	public void selectBwxxByGisId() {
		Map<String, Object> bwxx = aqcxMapper.selectBwxxByGisId("1");
		System.err.println(bwxx.toString());
		Assert.assertNotNull(bwxx);
	}

	/**
	 * 根据泊位ID查询泊位信息
	 */
	@Test
	public void selectGqxxByGisid() {
		Map<String, Object> gqxx = aqcxMapper.selectGqxxByGisId("1");
		System.err.println(gqxx.toString());
		Assert.assertNotNull(gqxx);
	}

	/**
	 * 根据GIS标示查询经营人基础信息
	 */
	@Test
	public void selectJyrjcxxByGisId() {
		Map<String, Object> result = aqcxMapper.selectJyrjcxxByGisId("1");
		System.err.println(result.toString());
		Assert.assertNotNull(result);
	}
}
