初始化

This commit is contained in:
hukekuan@163.com 2017-12-14 17:23:58 +08:00
parent 647bec3f6d
commit fbe873e072
9 changed files with 115 additions and 3 deletions

View File

@ -1,5 +1,7 @@
package com.gis3c.spatial;
package com.gis3c;
import com.gis3c.ol.service.MapService;
import com.gis3c.ol.service.impl.MapServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@ -12,6 +14,7 @@ public class App {
}
public static void main(String[] args) {
ApplicationContext context = ApplicationInit();
System.out.println("OK");
MapService mapService = (MapService) context.getBean(MapService.class);
System.out.println(mapService.findAllList());
}
}

View File

@ -0,0 +1,21 @@
package com.gis3c.common.persistence.annotation;
import org.springframework.stereotype.Component;
import java.lang.annotation.*;
/**
* Created by hukekuan on 2017/12/14.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Component
public @interface C3BatisDao {
/**
* The value may indicate a suggestion for a logical component name,
* to be turned into a Spring bean in case of an autodetected component.
* @return the suggested component name, if any
*/
String value() default "";
}

View File

@ -0,0 +1,14 @@
package com.gis3c.ol.dao;
import com.gis3c.common.persistence.annotation.C3BatisDao;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.
*/
@C3BatisDao
public interface MapDao {
public List<Map> findAllList();
}

View File

@ -0,0 +1,11 @@
package com.gis3c.ol.service;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.
*/
public interface MapService {
public List<Map> findAllList();
}

View File

@ -0,0 +1,7 @@
package com.gis3c.ol.service;
/**
* Created by hukekuan on 2017/12/14.
*/
public interface ViewService {
}

View File

@ -0,0 +1,23 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.dao.MapDao;
import com.gis3c.ol.service.MapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Created by hukekuan on 2017/12/14.
*/
@Service
public class MapServiceImpl implements MapService {
@Autowired
private MapDao mapDao;
@Override
public List<Map> findAllList() {
return mapDao.findAllList();
}
}

View File

@ -0,0 +1,9 @@
package com.gis3c.ol.service.impl;
import com.gis3c.ol.service.ViewService;
/**
* Created by hukekuan on 2017/12/14.
*/
public class ViewServiceImpl implements ViewService {
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gis3c.ol.dao.MapDao">
<resultMap id="mapResult" type="Map">
<id property="mapId" column="mapid" />
<result property="" column="mapname" />
</resultMap>
<sql id="mapColumns">
mapid,
mapname
</sql>
<select id="findAllList" resultMap="mapResult">
SELECT
<include refid="mapColumns"/>
FROM c3gis_ol_map;
</select>
</mapper>

View File

@ -39,6 +39,11 @@
<bean id="sqlSessionFactory_sys" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource_sys"/>
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
<!--<property name="mapperLocations" value="classpath:mappings/ol/*.xml"/>-->
<property name="mapperLocations" value="classpath:mappings/ol/*.xml"/>
</bean>
<bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory_sys" />
<property name="basePackage" value="com.gis3c"/>
<property name="annotationClass" value="com.gis3c.common.persistence.annotation.C3BatisDao"/>
</bean>
</beans>