CourseBusinessMapper.xml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.zhongzheng.modules.course.mapper.CourseBusinessMapper">
  6. <resultMap type="com.zhongzheng.modules.course.domain.CourseBusiness" id="CourseBusinessResult">
  7. <result property="id" column="id"/>
  8. <result property="businessName" column="business_name"/>
  9. <result property="remark" column="remark"/>
  10. <result property="projectId" column="project_id"/>
  11. <result property="schoolYear" column="school_year"/>
  12. <result property="status" column="status"/>
  13. <result property="createTime" column="create_time"/>
  14. <result property="updateTime" column="update_time"/>
  15. <result property="goodsLearningOrder" column="goods_learning_order"/>
  16. <result property="profileTpUserIds" column="profile_tp_user_ids"/>
  17. <result property="periodUserIds" column="period_user_ids"/>
  18. <result property="periodConfirmUserIds" column="period_confirm_user_ids"/>
  19. <result property="refundUserIds" column="refund_user_ids"/>
  20. <result property="refundConfirmUserIds" column="refund_confirm_user_ids"/>
  21. <result property="sort" column="sort"/>
  22. <result property="goodsFieldJson" column="goods_field_json"/>
  23. <result property="aliasName" column="alias_name"/>
  24. </resultMap>
  25. <resultMap type="com.zhongzheng.modules.course.vo.CourseBusinessVo" id="CourseBusinessVoResult">
  26. <result property="id" column="id"/>
  27. <result property="businessName" column="business_name"/>
  28. <result property="businessId" column="business_id"/>
  29. <result property="remark" column="remark"/>
  30. <result property="projectId" column="project_id"/>
  31. <result property="schoolYear" column="school_year"/>
  32. <result property="status" column="status"/>
  33. <result property="educationName" column="education_name"/>
  34. <result property="projectName" column="project_name"/>
  35. <result property="educationId" column="education_id"/>
  36. <result property="templateStatus" column="template_status"/>
  37. <result property="templateName" column="template_name"/>
  38. <result property="goodsLearningOrder" column="goods_learning_order"/>
  39. <result property="profileTpUserIds" column="profile_tp_user_ids"/>
  40. <result property="periodUserIds" column="period_user_ids"/>
  41. <result property="periodConfirmUserIds" column="period_confirm_user_ids"/>
  42. <result property="refundUserIds" column="refund_user_ids"/>
  43. <result property="refundConfirmUserIds" column="refund_confirm_user_ids"/>
  44. <result property="sort" column="sort"/>
  45. <result property="goodsFieldJson" column="goods_field_json"/>
  46. <result property="aliasName" column="alias_name"/>
  47. </resultMap>
  48. <select id="queryList" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultMap="CourseBusinessVoResult">
  49. SELECT
  50. b.*,
  51. e.education_name,
  52. e.id as education_id,
  53. p.project_name,
  54. t.name as template_name,
  55. p.id as project_id
  56. FROM
  57. course_business b
  58. LEFT JOIN course_project_type p on b.project_id =p.id
  59. LEFT JOIN course_education_type e ON p.education_id = e.id
  60. LEFT JOIN order_input_template t ON b.template_status = t.id
  61. where 1=1
  62. and p.status != -1
  63. and e.status != -1
  64. <if test="status != null and status.size()!=0 ">
  65. AND b.status in
  66. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  67. #{item}
  68. </foreach>
  69. </if>
  70. <if test="businessName != null and businessName != ''">
  71. AND b.business_name = #{businessName}
  72. </if>
  73. <if test="encoder != null and encoder != ''">
  74. AND b.encoder = #{encoder}
  75. </if>
  76. <if test="projectId != null and projectId != ''">
  77. AND p.id = #{projectId}
  78. </if>
  79. <if test="educationId != null and educationId != ''">
  80. AND e.id = #{educationId}
  81. </if>
  82. <if test="id != null and id != ''">
  83. AND b.id = #{id}
  84. </if>
  85. order by b.sort
  86. </select>
  87. <select id="queryFullName" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultType="string">
  88. SELECT
  89. concat( e.education_name, b.business_name, p.project_name )
  90. FROM
  91. course_business b
  92. LEFT JOIN course_project_type p ON b.project_id = p.id
  93. LEFT JOIN course_education_type e ON p.education_id = e.id
  94. WHERE
  95. b.id = #{id}
  96. </select>
  97. <select id="queryFullId" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultMap="CourseBusinessVoResult">
  98. SELECT
  99. e.id as education_id,
  100. p.id AS project_id,
  101. b.id AS business_id
  102. FROM
  103. course_business b
  104. LEFT JOIN course_project_type p ON b.project_id = p.id
  105. LEFT JOIN course_education_type e ON p.education_id = e.id
  106. WHERE
  107. b.business_name = #{businessName}
  108. AND e.education_name = #{educationName}
  109. AND p.project_name = #{projectName}
  110. limit 1
  111. </select>
  112. <select id="getBusinessByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseBusiness">
  113. SELECT * FROM course_business WHERE encoder = #{encoder} and tenant_id = #{newTenantId}
  114. </select>
  115. <select id="getBusinessByIdTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseBusiness">
  116. SELECT b.*,t.name as templateName FROM course_business b
  117. LEFT JOIN order_input_template t ON b.template_status = t.id
  118. WHERE b.id = #{businessId} and b.tenant_id = #{tenantId}
  119. </select>
  120. <select id="queryAllList" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultMap="CourseBusinessVoResult">
  121. SELECT
  122. b.id as business_id,
  123. b.business_name,
  124. b.alias_name,
  125. e.education_name,
  126. e.id as education_id,
  127. p.project_name,
  128. p.id as project_id
  129. FROM
  130. course_business b
  131. LEFT JOIN course_project_type p on b.project_id =p.id
  132. LEFT JOIN course_education_type e ON p.education_id = e.id
  133. where 1=1
  134. and p.status = 1
  135. and b.status = 1
  136. <if test="businessName != null and businessName != ''">
  137. AND b.business_name = #{businessName}
  138. </if>
  139. <if test="encoder != null and encoder != ''">
  140. AND b.encoder = #{encoder}
  141. </if>
  142. <if test="projectId != null and projectId != ''">
  143. AND p.id = #{projectId}
  144. </if>
  145. <if test="educationId != null and educationId != ''">
  146. AND e.id = #{educationId}
  147. </if>
  148. <if test="id != null and id != ''">
  149. AND b.id = #{id}
  150. </if>
  151. order by b.sort
  152. </select>
  153. </mapper>