ReportDataSourceFieldMapper.xml 5.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.lhcredit.project.business.reportDataSourceField.mapper.ReportDataSourceFieldMapper">
    
    <resultMap type="ReportDataSourceField" id="ReportDataSourceFieldResult">
        <result property="id"    column="id"    />
        <result property="sortNum"    column="sortNum"    />
        <result property="dsId"    column="ds_id"    />
        <result property="fieldName"    column="field_name"    />
        <result property="fieldCode"    column="field_code"    />
        <result property="fieldType"    column="field_type"    />
        <result property="isShow"    column="is_show"    />
        <result property="reportType"    column="report_type"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="apiId"    column="api_id"    />
    </resultMap>
	
	<sql id="selectReportDataSourceFieldVo">
        select id, sortNum, ds_id, field_name, field_code, field_type, is_show, report_type, del_flag, create_time, update_time, api_id from report_data_source_field
    </sql>
	
    <select id="selectReportDataSourceFieldList" parameterType="ReportDataSourceField" resultMap="ReportDataSourceFieldResult">
        <include refid="selectReportDataSourceFieldVo"/>
        <where>  
            <if test="id != null "> and id = #{id}</if>
            <if test="sortNum != null "> and sortNum = #{sortNum}</if>
            <if test="dsId != null "> and ds_id = #{dsId}</if>
            <if test="fieldName != null  and fieldName != '' "> and field_name = #{fieldName}</if>
            <if test="fieldCode != null  and fieldCode != '' "> and field_code = #{fieldCode}</if>
            <if test="fieldType != null  and fieldType != '' "> and field_type = #{fieldType}</if>
            <if test="isShow != null "> and is_show = #{isShow}</if>
            <if test="reportType != null  and reportType != '' "> and report_type = #{reportType}</if>
            <if test="delFlag != null  and delFlag != '' "> and del_flag = #{delFlag}</if>
            <if test="createTime != null "> and create_time = #{createTime}</if>
            <if test="updateTime != null "> and update_time = #{updateTime}</if>
            <if test="apiId != null "> and api_id = #{apiId}</if>
        </where>
    </select>
    
    <select id="selectReportDataSourceFieldById" parameterType="Integer" resultMap="ReportDataSourceFieldResult">
        <include refid="selectReportDataSourceFieldVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertReportDataSourceField" parameterType="ReportDataSourceField" useGeneratedKeys="true" keyProperty="id">
        insert into report_data_source_field
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="sortNum != null  ">sortNum,</if>
			<if test="dsId != null  ">ds_id,</if>
			<if test="fieldName != null  and fieldName != ''  ">field_name,</if>
			<if test="fieldCode != null  and fieldCode != ''  ">field_code,</if>
			<if test="fieldType != null  and fieldType != ''  ">field_type,</if>
			<if test="isShow != null  ">is_show,</if>
			<if test="reportType != null  and reportType != ''  ">report_type,</if>
			<if test="delFlag != null  and delFlag != ''  ">del_flag,</if>
			<if test="createTime != null  ">create_time,</if>
			<if test="updateTime != null  ">update_time,</if>
			<if test="apiId != null  ">api_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="sortNum != null  ">#{sortNum},</if>
			<if test="dsId != null  ">#{dsId},</if>
			<if test="fieldName != null  and fieldName != ''  ">#{fieldName},</if>
			<if test="fieldCode != null  and fieldCode != ''  ">#{fieldCode},</if>
			<if test="fieldType != null  and fieldType != ''  ">#{fieldType},</if>
			<if test="isShow != null  ">#{isShow},</if>
			<if test="reportType != null  and reportType != ''  ">#{reportType},</if>
			<if test="delFlag != null  and delFlag != ''  ">#{delFlag},</if>
			<if test="createTime != null  ">#{createTime},</if>
			<if test="updateTime != null  ">#{updateTime},</if>
			<if test="apiId != null  ">#{apiId},</if>
         </trim>
    </insert>
	 
    <update id="updateReportDataSourceField" parameterType="ReportDataSourceField">
        update report_data_source_field
        <trim prefix="SET" suffixOverrides=",">
            <if test="sortNum != null  ">sortNum = #{sortNum},</if>
            <if test="dsId != null  ">ds_id = #{dsId},</if>
            <if test="fieldName != null  and fieldName != ''  ">field_name = #{fieldName},</if>
            <if test="fieldCode != null  and fieldCode != ''  ">field_code = #{fieldCode},</if>
            <if test="fieldType != null  and fieldType != ''  ">field_type = #{fieldType},</if>
            <if test="isShow != null  ">is_show = #{isShow},</if>
            <if test="reportType != null  and reportType != ''  ">report_type = #{reportType},</if>
            <if test="delFlag != null  and delFlag != ''  ">del_flag = #{delFlag},</if>
            <if test="createTime != null  ">create_time = #{createTime},</if>
            <if test="updateTime != null  ">update_time = #{updateTime},</if>
            <if test="apiId != null  ">api_id = #{apiId},</if>
        </trim>
        where id = #{id}
    </update>

	<delete id="deleteReportDataSourceFieldById" parameterType="Integer">
        delete from report_data_source_field where id = #{id}
    </delete>
	
    <delete id="deleteReportDataSourceFieldByIds" parameterType="String">
        delete from report_data_source_field where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    
</mapper>