ReportDataSourceMapper.xml 6.91 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.lhcredit.project.business.reportDataSource.mapper.ReportDataSourceMapper">

    <resultMap type="ReportDataSource" id="ReportDataSourceResult">
        <result property="id"    column="id"    />
        <result property="dsName"    column="ds_name"    />
        <result property="dsCode"    column="ds_code"    />
        <result property="dsUrl"    column="ds_url"    />
        <result property="dsUrlParams"    column="ds_url_params"    />
        <result property="remark"    column="remark"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="dataType"    column="data_type"    />
        <result property="demoCompany"    column="demo_company"    />
        <result property="demoData"    column="demo_data"    />
        <result property="fieldType"    column="field_type"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectReportDataSourceVo">
        select id, ds_name, ds_code, ds_url, ds_url_params, remark, del_flag, data_type, demo_company, demo_data, field_type, create_time, update_time from report_data_source
    </sql>

    <select id="selectReportDataSourceList" parameterType="ReportDataSource" resultMap="ReportDataSourceResult">
        <include refid="selectReportDataSourceVo"/>
        <where>
            <if test="id != null "> and id = #{id}</if>
            <if test="dsName != null  and dsName != '' "> and ds_name like concat("%", #{dsName},"%")</if>
            <if test="dsCode != null  and dsCode != '' "> and ds_code = #{dsCode}</if>
            <if test="dsUrl != null  and dsUrl != '' "> and ds_url = #{dsUrl}</if>
            <if test="dsUrlParams != null  and dsUrlParams != '' "> and ds_url_params = #{dsUrlParams}</if>
            <if test="remark != null  and remark != '' "> and remark = #{remark}</if>
            <if test="delFlag != null  and delFlag != '' "> and del_flag = #{delFlag}</if>
            <if test="dataType != null  and dataType != '' "> and data_type = #{dataType}</if>
            <if test="demoCompany != null  and demoCompany != '' "> and demo_company = #{demoCompany}</if>
            <if test="demoData != null  and demoData != '' "> and demo_data = #{demoData}</if>
            <if test="fieldType != null  and fieldType != '' "> and field_type = #{fieldType}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
        </where>
    </select>

    <select id="selectReportDataSourceById" parameterType="Integer" resultMap="ReportDataSourceResult">
        <include refid="selectReportDataSourceVo"/>
        where id = #{id}
    </select>
    <select id="selectByIds"
            resultMap="ReportDataSourceResult">
        <include refid="selectReportDataSourceVo"/>
        where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>

    </select>

    <insert id="insertReportDataSource" parameterType="ReportDataSource" useGeneratedKeys="true" keyProperty="id">
        insert into report_data_source
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dsName != null  and dsName != ''  ">ds_name,</if>
            <if test="dsCode != null  and dsCode != ''  ">ds_code,</if>
            <if test="dsUrl != null  and dsUrl != ''  ">ds_url,</if>
            <if test="dsUrlParams != null  and dsUrlParams != ''  ">ds_url_params,</if>
            <if test="remark != null  and remark != ''  ">remark,</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag,</if>
            <if test="dataType != null  and dataType != ''  ">data_type,</if>
            <if test="demoCompany != null  and demoCompany != ''  ">demo_company,</if>
            <if test="demoData != null  and demoData != ''  ">demo_data,</if>
            <if test="fieldType != null  and fieldType != ''  ">field_type,</if>
            <if test="createTime != null  ">create_time,</if>
            <if test="updateTime != null  ">update_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dsName != null  and dsName != ''  ">#{dsName},</if>
            <if test="dsCode != null  and dsCode != ''  ">#{dsCode},</if>
            <if test="dsUrl != null  and dsUrl != ''  ">#{dsUrl},</if>
            <if test="dsUrlParams != null  and dsUrlParams != ''  ">#{dsUrlParams},</if>
            <if test="remark != null  and remark != ''  ">#{remark},</if>
            <if test="delFlag != null  and delFlag != ''  ">#{delFlag},</if>
            <if test="dataType != null  and dataType != ''  ">#{dataType},</if>
            <if test="demoCompany != null  and demoCompany != ''  ">#{demoCompany},</if>
            <if test="demoData != null  and demoData != ''  ">#{demoData},</if>
            <if test="fieldType != null  and fieldType != ''  ">#{fieldType},</if>
            <if test="createTime != null  ">#{createTime},</if>
            <if test="updateTime != null  ">#{updateTime},</if>
        </trim>
    </insert>

    <update id="updateReportDataSource" parameterType="ReportDataSource">
        update report_data_source
        <trim prefix="SET" suffixOverrides=",">
            <if test="dsName != null  and dsName != ''  ">ds_name = #{dsName},</if>
            <if test="dsCode != null  and dsCode != ''  ">ds_code = #{dsCode},</if>
            <if test="dsUrl != null  and dsUrl != ''  ">ds_url = #{dsUrl},</if>
            <if test="dsUrlParams != null  and dsUrlParams != ''  ">ds_url_params = #{dsUrlParams},</if>
            <if test="remark != null  and remark != ''  ">remark = #{remark},</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag = #{delFlag},</if>
            <if test="dataType != null  and dataType != ''  ">data_type = #{dataType},</if>
            <if test="demoCompany != null  and demoCompany != ''  ">demo_company = #{demoCompany},</if>
            <if test="demoData != null  and demoData != ''  ">demo_data = #{demoData},</if>
            <if test="fieldType != null  and fieldType != ''  ">field_type = #{fieldType},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteReportDataSourceById" parameterType="Integer">
        delete from report_data_source where id = #{id}
    </delete>

    <delete id="deleteReportDataSourceByIds" parameterType="String">
        delete from report_data_source where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>