CourseBusinessMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. FROM
  56. course_business b
  57. LEFT JOIN course_project_type p on b.project_id =p.id
  58. LEFT JOIN course_education_type e ON p.education_id = e.id
  59. LEFT JOIN order_input_template t ON b.template_status = t.id
  60. where 1=1
  61. and p.status != -1
  62. and e.status != -1
  63. <if test="status != null and status.size()!=0 ">
  64. AND b.status in
  65. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  66. #{item}
  67. </foreach>
  68. </if>
  69. <if test="businessName != null and businessName != ''">
  70. AND b.business_name = #{businessName}
  71. </if>
  72. <if test="encoder != null and encoder != ''">
  73. AND b.encoder = #{encoder}
  74. </if>
  75. <if test="projectId != null and projectId != ''">
  76. AND p.id = #{projectId}
  77. </if>
  78. <if test="educationId != null and educationId != ''">
  79. AND e.id = #{educationId}
  80. </if>
  81. <if test="id != null and id != ''">
  82. AND b.id = #{id}
  83. </if>
  84. order by b.sort
  85. </select>
  86. <select id="queryFullName" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultType="string">
  87. SELECT
  88. concat( e.education_name, b.business_name, p.project_name )
  89. FROM
  90. course_business b
  91. LEFT JOIN course_project_type p ON b.project_id = p.id
  92. LEFT JOIN course_education_type e ON p.education_id = e.id
  93. WHERE
  94. b.id = #{id}
  95. </select>
  96. <select id="queryFullId" parameterType="com.zhongzheng.modules.course.bo.CourseBusinessQueryBo" resultMap="CourseBusinessVoResult">
  97. SELECT
  98. e.id as education_id,
  99. p.id AS project_id,
  100. b.id AS business_id
  101. FROM
  102. course_business b
  103. LEFT JOIN course_project_type p ON b.project_id = p.id
  104. LEFT JOIN course_education_type e ON p.education_id = e.id
  105. WHERE
  106. b.business_name = #{businessName}
  107. AND e.education_name = #{educationName}
  108. AND p.project_name = #{projectName}
  109. limit 1
  110. </select>
  111. <select id="getBusinessByTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseBusiness">
  112. SELECT * FROM course_business WHERE encoder = #{encoder} and tenant_id = #{newTenantId}
  113. </select>
  114. <select id="getBusinessByIdTenant" parameterType="map" resultType="com.zhongzheng.modules.course.domain.CourseBusiness">
  115. SELECT b.*,t.name as templateName FROM course_business b
  116. LEFT JOIN order_input_template t ON b.template_status = t.id
  117. WHERE b.id = #{businessId} and b.tenant_id = #{tenantId}
  118. </select>
  119. </mapper>