zoukankan      html  css  js  c++  java
  • mybatis一对多

    一.课程包含课时

    xml如下:

      <resultMap id="culTrainCoursePO" type="com.thinkgem.jeesite.modules.train.entity.CulTrainCoursePO">
        <id column="id" jdbcType="VARCHAR" property="id" />
        <result column="course_name" jdbcType="VARCHAR" property="courseName" />
        <result column="bel_project_id" jdbcType="VARCHAR" property="belProjectId" />
       
        <collection property="culTrainLessonPOs" ofType="com.thinkgem.jeesite.modules.train.entity.CulTrainLessonPO">
          <id property="id" column="lesson_id"/>
          <result property="courseId" column="course_id"/>
          <result property="lessonBatchNum" column="lesson_batch_num"/>
         
        </collection>
      </resultMap>
    
    
      <select id="selectCourseLessonById" parameterType="String" resultMap="culTrainCoursePO">
        select c.*,l.id lesson_id,l.course_id,l.lesson_batch_num from
        cul_train_course c left join cul_train_lesson l on l.course_id = c.id
        where c.id = #{id}
      </select>
        
      <select id="selectCourseLesson" resultMap="culTrainCoursePO">
        select c.*,l.id lesson_id,l.course_id,l.lesson_batch_num from
        cul_train_course c left join cul_train_lesson l on l.course_id = c.id
      </select>

    参考来源:https://blog.csdn.net/qq_36791569/article/details/81517080

  • 相关阅读:
    暑假训练第三周总结
    UVA 1212 Duopoly
    UVA 12125 March of the Penguins
    UVA 1345 Jamie's Contact Groups
    UVA 10806 Dijkstra, Dijkstra.
    暑假训练第一周总结
    HDU 5792 World is Exploding
    HDU 5791 Two
    HDU 5787 K-wolf Number
    Sql With as 用法
  • 原文地址:https://www.cnblogs.com/fxx5/p/11649232.html
Copyright © 2011-2022 走看看