初始化
This commit is contained in:
parent
647bec3f6d
commit
fbe873e072
@ -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.ApplicationContext;
|
||||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||||
|
|
||||||
@ -12,6 +14,7 @@ public class App {
|
|||||||
}
|
}
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ApplicationContext context = ApplicationInit();
|
ApplicationContext context = ApplicationInit();
|
||||||
System.out.println("OK");
|
MapService mapService = (MapService) context.getBean(MapService.class);
|
||||||
|
System.out.println(mapService.findAllList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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 "";
|
||||||
|
}
|
||||||
14
src/main/java/com/gis3c/ol/dao/MapDao.java
Normal file
14
src/main/java/com/gis3c/ol/dao/MapDao.java
Normal 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();
|
||||||
|
}
|
||||||
11
src/main/java/com/gis3c/ol/service/MapService.java
Normal file
11
src/main/java/com/gis3c/ol/service/MapService.java
Normal 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();
|
||||||
|
}
|
||||||
7
src/main/java/com/gis3c/ol/service/ViewService.java
Normal file
7
src/main/java/com/gis3c/ol/service/ViewService.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.gis3c.ol.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by hukekuan on 2017/12/14.
|
||||||
|
*/
|
||||||
|
public interface ViewService {
|
||||||
|
}
|
||||||
23
src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java
Normal file
23
src/main/java/com/gis3c/ol/service/impl/MapServiceImpl.java
Normal 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -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 {
|
||||||
|
}
|
||||||
19
src/main/resources/mappings/ol/MapDao.xml
Normal file
19
src/main/resources/mappings/ol/MapDao.xml
Normal 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>
|
||||||
@ -39,6 +39,11 @@
|
|||||||
<bean id="sqlSessionFactory_sys" class="org.mybatis.spring.SqlSessionFactoryBean">
|
<bean id="sqlSessionFactory_sys" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||||
<property name="dataSource" ref="dataSource_sys"/>
|
<property name="dataSource" ref="dataSource_sys"/>
|
||||||
<property name="configLocation" value="classpath:sql-map-config-mybatis.xml"/>
|
<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>
|
</bean>
|
||||||
</beans>
|
</beans>
|
||||||
Loading…
Reference in New Issue
Block a user