MedMaterialMapper.xml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <!--<?xml version="1.0" encoding="utf-8" ?>-->
  2. <!--<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >-->
  3. <!--<mapper namespace="com.backendsys.mapper.Med.MedMaterialMapper">-->
  4. <!-- <sql id="includeMaterial">-->
  5. <!-- m.id id,-->
  6. <!-- m.id material_id,-->
  7. <!-- mc.id category_id,-->
  8. <!-- mc.category_name category_name,-->
  9. <!-- m.title title,-->
  10. <!-- COALESCE(m.description, '') description,-->
  11. <!-- COALESCE(m.thumb, '') thumb,-->
  12. <!-- m.material_type material_type,-->
  13. <!-- &lt;!&ndash; COALESCE(m.content, '') content, &ndash;&gt;-->
  14. <!-- &lt;!&ndash; COALESCE(m.file, '') file, &ndash;&gt;-->
  15. <!-- m.is_top is_top,-->
  16. <!-- m.status status,-->
  17. <!-- m.audit_status audit_status,-->
  18. <!-- m.create_time create_time,-->
  19. <!-- m.update_time update_time-->
  20. <!-- </sql>-->
  21. <!-- <sql id="includeMaterialDetail">-->
  22. <!-- m.id id,-->
  23. <!-- m.id material_id,-->
  24. <!-- mc.id category_id,-->
  25. <!-- mc.category_name category_name,-->
  26. <!-- m.title title,-->
  27. <!-- COALESCE(m.description, '') description,-->
  28. <!-- COALESCE(m.thumb, '') thumb,-->
  29. <!-- m.material_type material_type,-->
  30. <!-- COALESCE(m.content, '') content,-->
  31. <!-- COALESCE(m.file, '') file,-->
  32. <!-- m.is_top is_top,-->
  33. <!-- m.status status,-->
  34. <!-- m.audit_status audit_status,-->
  35. <!-- m.create_time create_time,-->
  36. <!-- m.update_time update_time-->
  37. <!-- </sql>-->
  38. <!-- -->
  39. <!-- <resultMap id="resultMapMaterial" type="java.util.LinkedHashMap">-->
  40. <!-- <id property="id" column="id" jdbcType="BIGINT" />-->
  41. <!-- <result property="material_id" column="material_id" javaType="java.lang.Long"/>-->
  42. <!-- <result property="category_id" column="category_id" javaType="java.lang.Long"/>-->
  43. <!-- <result property="category_name" column="category_name" />-->
  44. <!-- <result property="title" column="title" />-->
  45. <!-- <result property="description" column="description" />-->
  46. <!-- <result property="thumb" column="thumb" />-->
  47. <!-- <result property="material_type" column="material_type" javaType="java.lang.Integer"/>-->
  48. <!-- &lt;!&ndash; <result property="content" column="content" /> &ndash;&gt;-->
  49. <!-- &lt;!&ndash; <result property="file" column="file" /> &ndash;&gt;-->
  50. <!-- <result property="is_top" column="is_top" javaType="java.lang.Integer"/>-->
  51. <!-- <result property="status" column="status" javaType="java.lang.Integer"/>-->
  52. <!-- <result property="audit_status" column="audit_status" javaType="java.lang.Integer"/>-->
  53. <!-- <result property="create_time" column="create_time" />-->
  54. <!-- <result property="update_time" column="update_time" />-->
  55. <!-- </resultMap>-->
  56. <!-- <resultMap id="resultMapMaterialDetail" type="java.util.LinkedHashMap">-->
  57. <!-- <id property="id" column="id" jdbcType="BIGINT" />-->
  58. <!-- <result property="material_id" column="material_id" javaType="java.lang.Long"/>-->
  59. <!-- <result property="category_id" column="category_id" javaType="java.lang.Long"/>-->
  60. <!-- <result property="category_name" column="category_name" />-->
  61. <!-- <result property="title" column="title" />-->
  62. <!-- <result property="description" column="description" />-->
  63. <!-- <result property="thumb" column="thumb" />-->
  64. <!-- <result property="material_type" column="material_type" javaType="java.lang.Integer" />-->
  65. <!-- <result property="content" column="content" />-->
  66. <!-- <result property="file" column="file" />-->
  67. <!-- <result property="is_top" column="is_top" javaType="java.lang.Integer"/>-->
  68. <!-- <result property="status" column="status" javaType="java.lang.Integer"/>-->
  69. <!-- <result property="audit_status" column="audit_status" javaType="java.lang.Integer"/>-->
  70. <!-- <result property="create_time" column="create_time" />-->
  71. <!-- <result property="update_time" column="update_time" />-->
  72. <!-- </resultMap>-->
  73. <!-- <sql id="leftJoinCategory">-->
  74. <!-- LEFT JOIN med_material_category mc ON m.category_id = mc.id-->
  75. <!-- </sql>-->
  76. <!-- &lt;!&ndash; 查 列表 &ndash;&gt;-->
  77. <!-- <select id="queryMaterialList" resultMap="resultMapMaterial">-->
  78. <!-- SELECT-->
  79. <!-- <include refid="includeMaterial" />-->
  80. <!-- FROM med_material m-->
  81. <!-- <include refid="leftJoinCategory" />-->
  82. <!-- <where>-->
  83. <!-- <if test="title != null and title != ''">-->
  84. <!-- AND m.title LIKE CONCAT('%', #{title}, '%')-->
  85. <!-- </if>-->
  86. <!-- <if test="description != null and description != ''">-->
  87. <!-- AND m.description LIKE CONCAT('%', #{description}, '%')-->
  88. <!-- </if>-->
  89. <!-- <if test="category_id != null and category_id != ''">-->
  90. <!-- AND m.category_id = #{category_id}-->
  91. <!-- </if>-->
  92. <!-- <if test="status != null and status != ''">-->
  93. <!-- AND m.status = #{status}-->
  94. <!-- </if>-->
  95. <!-- <if test="audit_status != null and audit_status != ''">-->
  96. <!-- AND m.audit_status = #{audit_status}-->
  97. <!-- </if>-->
  98. <!-- <if test="create_time != null and create_time != ''">-->
  99. <!-- AND m.create_time >= #{create_time}-->
  100. <!-- </if>-->
  101. <!-- </where>-->
  102. <!-- ORDER BY m.is_top = 1 DESC, m.update_time DESC-->
  103. <!-- </select>-->
  104. <!-- <select id="queryMaterialDetail" resultMap="resultMapMaterialDetail">-->
  105. <!-- SELECT <include refid="includeMaterialDetail" />-->
  106. <!-- FROM med_material m-->
  107. <!-- <include refid="leftJoinCategory" />-->
  108. <!-- WHERE m.id = #{material_id}-->
  109. <!-- </select>-->
  110. <!-- <insert id="insertMaterial" parameterType="com.backendsys.entity.Med.MedMaterialDTO"-->
  111. <!-- useGeneratedKeys="true" keyProperty="material_id">-->
  112. <!-- INSERT INTO med_material (-->
  113. <!-- category_id, title, material_type-->
  114. <!-- <if test="description != null and description != ''">, description</if>-->
  115. <!-- <if test="thumb != null and thumb != ''">, thumb</if>-->
  116. <!-- <if test="content != null and content != ''">, content</if>-->
  117. <!-- <if test="file != null and file != ''">, file</if>-->
  118. <!-- <if test="is_top != null and is_top != ''">, is_top</if>-->
  119. <!-- &lt;!&ndash; <if test="audit_status != null and audit_status != ''">, audit_status</if> &ndash;&gt;-->
  120. <!-- <if test="status != null and status != ''">, status</if>-->
  121. <!-- )-->
  122. <!-- VALUES (-->
  123. <!-- #{category_id}, #{title}, #{material_type}-->
  124. <!-- <if test="description != null and description != ''">, #{description}</if>-->
  125. <!-- <if test="thumb != null and thumb != ''">, #{thumb}</if>-->
  126. <!-- <if test="content != null and content != ''">, #{content}</if>-->
  127. <!-- <if test="file != null and file != ''">, #{file}</if>-->
  128. <!-- <if test="is_top != null and is_top != ''">, #{is_top}</if>-->
  129. <!-- &lt;!&ndash; <if test="audit_status != null and audit_status != ''">, #{audit_status}</if> &ndash;&gt;-->
  130. <!-- <if test="status != null and status != ''">, #{status}</if>-->
  131. <!-- );-->
  132. <!-- </insert>-->
  133. <!-- <update id="updateMaterial" parameterType="com.backendsys.entity.Med.MedMaterialDTO"-->
  134. <!-- useGeneratedKeys="true" keyProperty="material_id">-->
  135. <!-- UPDATE med_material-->
  136. <!-- SET-->
  137. <!-- category_id = #{category_id},-->
  138. <!-- title = #{title},-->
  139. <!-- material_type = #{material_type},-->
  140. <!-- <if test="description != null and description != ''">, description = #{description}</if>-->
  141. <!-- <if test="thumb != null and thumb != ''">, thumb = #{thumb}</if>-->
  142. <!-- <if test="content != null and content != ''">, content = #{content}</if>-->
  143. <!-- <if test="file != null and file != ''">, file = #{file}</if>-->
  144. <!-- <if test="is_top != null and is_top != ''">, is_top = #{is_top}</if>-->
  145. <!-- &lt;!&ndash; <if test="audit_status != null and audit_status != ''">, audit_status = #{audit_status}</if> &ndash;&gt;-->
  146. <!-- <if test="status != null and status != ''">, status = #{status}</if>-->
  147. <!-- WHERE id = #{material_id};-->
  148. <!-- </update>-->
  149. <!-- &lt;!&ndash; &ndash;&gt;-->
  150. <!-- &lt;!&ndash; 审核 &ndash;&gt;-->
  151. <!-- <update id="auditMaterial" parameterType="com.backendsys.entity.Med.MedMaterialDTO">-->
  152. <!-- UPDATE med_material SET-->
  153. <!-- <trim suffixOverrides="," suffix=" ">-->
  154. <!-- <if test="audit_status != null and audit_status != ''">audit_status = #{audit_status},</if>-->
  155. <!-- <if test="audit_note != null and audit_note != ''">audit_note = #{audit_note},</if>-->
  156. <!-- </trim>-->
  157. <!-- WHERE id = #{material_id};-->
  158. <!-- </update>-->
  159. <!-- &lt;!&ndash; 删除 &ndash;&gt;-->
  160. <!-- <delete id="deleteMaterial" parameterType="java.lang.Long">-->
  161. <!-- DELETE FROM med_material WHERE id = #{material_id};-->
  162. <!-- </delete>-->
  163. <!-- &lt;!&ndash; 删除 (批量) &ndash;&gt;-->
  164. <!-- <delete id="deleteMaterialBatch" parameterType="java.lang.Long">-->
  165. <!-- DELETE FROM med_material WHERE id IN-->
  166. <!-- <foreach collection="ids" item="id" open="(" separator="," close=")">-->
  167. <!-- #{id}-->
  168. <!-- </foreach>-->
  169. <!-- </delete>-->
  170. <!--</mapper>-->