ServerConfigMapper.xml 1.8 KB
<?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.sibu.orderHelper.base.dao.ServerConfigDao">
	<!-- <cache type="org.mybatis.caches.ehcache.EhcacheCache"/> -->
	<select id="gerOneServerDbConfig" resultMap="resultServerConfigBean" parameterType="map">
		SELECT * from server_config where database_type = #{databaseType} and modules = #{moduleIndex} limit 1
	</select>
	
	<select id="listServerConfig" resultMap="resultServerConfigBean">
		select * from server_config 
	</select>
	
	<select id="listServerConfigByType" resultMap="resultServerConfigBean">
		select * from server_config where database_type = #{dataType}
	</select>
	
	<select id="countOneTypeServerConfig" parameterType="int" resultType="int">
		select count(*) from server_config where database_type = #{dataType}
	</select>
	
	<insert id="addServerDbConfig" parameterType="map">
		insert into server_config (database_id,database_type,modules,database_driver,database_url,database_username,database_password) 
		value(
			#{dbConfig.databaseId},
			#{dbConfig.databaseType},
			#{dbConfig.modules},
			#{dbConfig.databaseDriver},
			#{dbConfig.databaseUrl},
			#{dbConfig.databaseUsername},
			#{dbConfig.databasePassword}
		)
	</insert>
	
	<resultMap type="ServerConfigBean" id="resultServerConfigBean">
		<result column="database_id" property="databaseId" />
		<result column="database_type" property="databaseType" />
		<result column="modules" property="modules" />
		<result column="database_driver" property="databaseDriver" />
		<result column="database_url" property="databaseUrl" />
		<result column="database_username" property="databaseUsername" />
		<result column="database_password" property="databasePassword" />
	</resultMap>
</mapper>