OrderBusinessConfigMapper.xml 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.order.mapper.OrderBusinessConfigMapper">
  6. <resultMap type="com.zhongzheng.modules.order.domain.OrderBusinessConfig" id="OrderBusinessConfigResult">
  7. <result property="id" column="id"/>
  8. <result property="businessId" column="business_id"/>
  9. <result property="configName" column="config_name"/>
  10. <result property="createTime" column="create_time"/>
  11. <result property="updateTime" column="update_time"/>
  12. <result property="status" column="status"/>
  13. <result property="gradeType" column="grade_type"/>
  14. <result property="mainImg" column="main_img"/>
  15. </resultMap>
  16. <resultMap type="com.zhongzheng.modules.order.vo.OrderBusinessConfigVo" id="OrderBusinessConfigVoResult">
  17. <result property="id" column="id"/>
  18. <result property="educationTypeId" column="education_type_id"/>
  19. <result property="businessId" column="business_id"/>
  20. <result property="projectId" column="project_id"/>
  21. <result property="configName" column="config_name"/>
  22. <result property="aliasName" column="alias_name"/>
  23. <result property="businessName" column="business_name"/>
  24. <result property="educationName" column="education_name"/>
  25. <result property="projectName" column="project_name"/>
  26. <result property="gradeType" column="grade_type"/>
  27. <result property="mainImg" column="main_img"/>
  28. </resultMap>
  29. <select id="getList" parameterType="com.zhongzheng.modules.order.bo.OrderBusinessConfigQueryBo" resultMap="OrderBusinessConfigVoResult">
  30. SELECT
  31. obc.*,
  32. cb.alias_name,
  33. cb.business_name,
  34. cpt.project_name,
  35. cet.education_name,
  36. cpt.education_id as education_type_id,
  37. cb.project_id
  38. FROM
  39. order_business_config obc
  40. LEFT JOIN course_business cb ON obc.business_id = cb.id
  41. LEFT JOIN course_project_type cpt ON cb.project_id = cpt.id
  42. LEFT JOIN course_education_type cet ON cet.id = cpt.education_id
  43. WHERE
  44. 1=1
  45. and cet.`status` = 1
  46. and cb.`status` = 1
  47. <if test="status != null and status.size()!=0 ">
  48. AND obc.`status` in
  49. <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
  50. #{item}
  51. </foreach>
  52. </if>
  53. <if test="gradeType != null and gradeType != ''">
  54. and obc.grade_type = #{gradeType}
  55. </if>
  56. <if test="businessId != null and businessId != ''">
  57. and obc.business_id = #{businessId}
  58. </if>
  59. <if test="projectId != null and projectId != ''">
  60. and cpt.id = #{projectId}
  61. </if>
  62. <if test="educationId != null and educationId != ''">
  63. and cet.id = #{educationId}
  64. </if>
  65. <if test="businessName != null and businessName != ''">
  66. and cb.business_name = #{businessName}
  67. </if>
  68. <if test="projectName != null and projectName != ''">
  69. and cpt.project_name = #{projectName}
  70. </if>
  71. <if test="educationName != null and educationName != ''">
  72. and cet.education_name = #{educationName}
  73. </if>
  74. <if test="configName != null and configName != ''">
  75. AND obc.config_name like concat('%', #{configName}, '%')
  76. </if>
  77. <if test="subjectId != null and subjectId != ''">
  78. and (SELECT COUNT(obcg.id) FROM order_business_config_goods obcg where obcg.subject_id = #{subjectId} AND obcg.config_id = obc.id AND obcg.`status` = 1) > 0
  79. </if>
  80. ORDER BY obc.config_sort DESC
  81. </select>
  82. <select id="getDetail" parameterType="com.zhongzheng.modules.order.bo.OrderBusinessConfigQueryBo" resultMap="OrderBusinessConfigVoResult">
  83. SELECT
  84. obc.*,
  85. cb.alias_name,
  86. cb.business_name,
  87. cpt.project_name,
  88. cet.education_name
  89. FROM
  90. order_business_config obc
  91. LEFT JOIN course_business cb ON obc.business_id = cb.id
  92. LEFT JOIN course_project_type cpt ON cb.project_id = cpt.id
  93. LEFT JOIN course_education_type cet ON cet.id = cpt.education_id
  94. WHERE
  95. obc.id = #{id}
  96. </select>
  97. </mapper>