<?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.javaweb.geo.mapper.DataSourceMapper">
|
|
<resultMap type="DataSource" id="DataSourceResult">
|
<result property="ids" column="ids" />
|
<result property="dataSource" column="data_source" />
|
<result property="secretKey" column="secret_key" />
|
<result property="companyId" column="company_id" />
|
</resultMap>
|
|
<sql id="selectDataSourceVo">
|
select ids, data_source, secret_key , company_id from js_data_source
|
</sql>
|
|
<select id="selectDataSourceList" parameterType="DataSource" resultMap="DataSourceResult">
|
<include refid="selectDataSourceVo"/>
|
<where>
|
<if test="dataSource != null and dataSource != ''"> and data_source = #{dataSource}</if>
|
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
|
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
</where>
|
</select>
|
|
<select id="selectDataSourceById" parameterType="String" resultMap="DataSourceResult">
|
<include refid="selectDataSourceVo"/>
|
where ids = #{ids}
|
</select>
|
|
<select id="selectDataSourceBySecretKey" resultType="java.lang.String" parameterType="String">
|
select data_source from js_data_source where secret_key = #{secretKey}
|
</select>
|
|
<select id="selectCompanyIdBySecretKey" resultType="java.lang.String" parameterType="String">
|
select company_id from js_data_source where secret_key = #{secretKey}
|
</select>
|
|
<insert id="insertDataSource" parameterType="DataSource">
|
insert into js_data_source
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">ids,</if>
|
<if test="dataSource != null and dataSource != ''">data_source,</if>
|
<if test="secretKey != null and secretKey != ''">secret_key,</if>
|
<if test="companyId != null and companyId != ''">company_id,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">#{ids},</if>
|
<if test="dataSource != null and dataSource != ''">#{dataSource},</if>
|
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
|
<if test="companyId != null and companyId != ''">#{companyId},</if>
|
</trim>
|
</insert>
|
|
<update id="updateDataSource" parameterType="DataSource">
|
update js_data_source
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="dataSource != null and dataSource != ''">data_source = #{dataSource},</if>
|
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
|
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
</trim>
|
where ids = #{ids}
|
</update>
|
|
<update id="updateDataSourceBySecretKey">
|
update js_data_source
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
</trim>
|
where secret_key = #{secretKey}
|
</update>
|
|
<delete id="deleteDataSourceById" parameterType="String">
|
delete from js_data_source where ids = #{ids}
|
</delete>
|
|
<delete id="deleteDataSourceByIds" parameterType="String">
|
delete from js_data_source where ids in
|
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
#{ids}
|
</foreach>
|
</delete>
|
|
</mapper>
|