|
@@ -4,6 +4,32 @@
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.system.mapper.DataSourceMapper">
|
|
|
|
|
|
+ <resultMap type="DataSource" id="DataSourceResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="databaseName" column="database_name" />
|
|
|
+ <result property="databaseIp" column="database_ip" />
|
|
|
+ <result property="username" column="username" />
|
|
|
+ <result property="password" column="password" />
|
|
|
+ <result property="portNumber" column="port_number" />
|
|
|
+ <result property="databaseType" column="database_type" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectDataSourceVo">
|
|
|
+ select id, database_name, database_ip, username, password, port_number, database_type from data_source
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectDataSourceList" parameterType="DataSource" resultMap="DataSourceResult">
|
|
|
+ <include refid="selectDataSourceVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
|
|
|
+ <if test="databaseIp != null and databaseIp != ''"> and database_ip = #{databaseIp}</if>
|
|
|
+ <if test="username != null and username != ''"> and username like concat('%', #{username}, '%')</if>
|
|
|
+ <if test="password != null and password != ''"> and password = #{password}</if>
|
|
|
+ <if test="portNumber != null "> and port_number = #{portNumber}</if>
|
|
|
+ <if test="databaseType != null and databaseType != ''"> and database_type = #{databaseType}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
<select id="selectDatabaseExist" resultType="int">
|
|
|
select count(1) from data_source where database_ip = #{databaseIp} and database_name = #{databaseName} and port_number = #{portNumber}
|
|
|
</select>
|
|
@@ -13,5 +39,10 @@
|
|
|
values (#{databaseName},#{databaseIp},#{username},#{password},#{portNumber},#{databaseType})
|
|
|
</insert>
|
|
|
|
|
|
+ <select id="selectById" resultMap="DataSourceResult">
|
|
|
+ <include refid="selectDataSourceVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
|
|
|
</mapper>
|