OrderBusinessConfigMapper.xml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 != ''">
  48. and obc.`status` = #{status}
  49. </if>
  50. <if test="gradeType != null and gradeType != ''">
  51. and obc.grade_type = #{gradeType}
  52. </if>
  53. <if test="businessId != null and businessId != ''">
  54. and obc.business_id = #{businessId}
  55. </if>
  56. <if test="projectId != null and projectId != ''">
  57. and cpt.id = #{projectId}
  58. </if>
  59. <if test="educationId != null and educationId != ''">
  60. and cet.id = #{educationId}
  61. </if>
  62. <if test="businessName != null and businessName != ''">
  63. and cb.business_name = #{businessName}
  64. </if>
  65. <if test="projectName != null and projectName != ''">
  66. and cpt.project_name = #{projectName}
  67. </if>
  68. <if test="educationName != null and educationName != ''">
  69. and cet.education_name = #{educationName}
  70. </if>
  71. <if test="configName != null and configName != ''">
  72. AND obc.config_name like concat('%', #{configName}, '%')
  73. </if>
  74. <if test="subjectId != null and subjectId != ''">
  75. 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
  76. </if>
  77. ORDER BY obc.config_sort DESC
  78. </select>
  79. <select id="getDetail" parameterType="com.zhongzheng.modules.order.bo.OrderBusinessConfigQueryBo" resultMap="OrderBusinessConfigVoResult">
  80. SELECT
  81. obc.*,
  82. cb.alias_name,
  83. cb.business_name,
  84. cpt.project_name,
  85. cet.education_name
  86. FROM
  87. order_business_config obc
  88. LEFT JOIN course_business cb ON obc.business_id = cb.id
  89. LEFT JOIN course_project_type cpt ON cb.project_id = cpt.id
  90. LEFT JOIN course_education_type cet ON cet.id = cpt.education_id
  91. WHERE
  92. obc.id = #{id}
  93. </select>
  94. </mapper>