Mybatis xml映射方便的写法

<sql id="insertColumn">
        data_job_id,
         ds_info,
         src_ds_type,
         dst_ds_type,
         scene_state,
         last_checked_time,
         check_period_ms,
         last_round_reset_time,
         round_period_ms,
         incre_gen_config,
         full_gen_config,
         compare_config,
         create_job_config
    </sql>

    <sql id="insertColumnJava">
        #{dataJobId},
        #{dsInfo},
        #{srcDsType},
        #{dstDsType},
        #{sceneState},
        #{lastCheckedTime},
        #{checkPeriodMs},
        #{lastRoundResetTime},
        #{roundPeriodMs},
        #{increGenConfig},
        #{fullGenConfig},
        #{compareConfig},
        #{createJobConfig}
    </sql>


    <insert id="insertSceneDO">
        insert into cloudcanal_scene_instance(
        <include refid="insertColumn"/>

        ) VALUES (<include refid="insertColumnJava"/>)
    </insert>
View Code

 

posted @ 2021-05-10 12:22  hulian425  阅读(24)  评论(0编辑  收藏  举报