我是靠谱客的博主 阳光画板,这篇文章主要介绍mapper.xml的基本写法,现在分享给大家,希望可以做个参考。

修改代码块

    <update id="editContent" parameterType="com.ilearning.ssm.pojo.LessionContent">
        update tb_lession_content
        <set>
            <if test="tb_le_con_content!=null">
                tb_le_con_content=#{tb_le_con_content},
            </if>
            <if test="tb_le_con_video!=null">
                tb_le_con_video=#{tb_le_con_video}
            </if>
        </set>
        where tb_le_con_content=#{tb_le_con_content}
    </update>

删除代码块

   <delete id="delContent" parameterType="com.ilearning.ssm.pojo.LessionContent">
        delete from tb_lession_content
        <where>
            <if test="tb_le_id!=0">
                and tb_le_id = #{tb_le_id}
            </if>
            <if test="tb_le_con_id!=0">
                and  tb_le_con_id = #{tb_le_con_id}
            </if>
            <if test="tb_le_con_content!=null and tb_le_con_content!=''"  >
                and tb_le_con_content = #{tb_le_con_content}
            </if>
        </where>
    </delete>

查找

      <select id="findTeacher" resultType="com.ilearning.ssm.pojo.Teacher" parameterType="com.ilearning.ssm.pojo.Teacher">
        select
            t1.tb_tid,t1.tb_tname,t1.tb_tgrade,t1.tb_tcourse,t1.tb_tdetail,t1.tb_tpic,t1.tb_tdata,t2.tb_tud
        from
            tb_teacher AS t1
        INNER JOIN
            tb_teacher_manager AS t2 on t1.tb_tid=t2.tb_tid
        <where>
            <if test="tb_tid!=null">
                and t1.tb_tid = #{tb_tid}
            </if>
            <if test="tb_tid!=null">
                and t1.tb_tid = #{tb_tid}
            </if>
        </where>
    </select>

最后

以上就是阳光画板最近收集整理的关于mapper.xml的基本写法的全部内容,更多相关mapper.xml内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(59)

评论列表共有 0 条评论

立即
投稿
返回
顶部