MedMyMaterialMapper.xml 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.MedMyMaterialMapper">-->
  4. <!-- <sql id="includeMyMaterial">-->
  5. <!-- m.id id,-->
  6. <!-- m.id my_material_id,-->
  7. <!-- m.material_id material_id,-->
  8. <!-- m.user_id user_id,-->
  9. <!-- mc.id category_id,-->
  10. <!-- mc.category_name category_name,-->
  11. <!-- m.title title,-->
  12. <!-- COALESCE(m.description, '') description,-->
  13. <!-- COALESCE(m.thumb, '') thumb,-->
  14. <!-- m.material_type material_type,-->
  15. <!-- &lt;!&ndash; COALESCE(m.content, '') content, &ndash;&gt;-->
  16. <!-- &lt;!&ndash; COALESCE(m.file, '') file, &ndash;&gt;-->
  17. <!-- m.create_time create_time,-->
  18. <!-- m.update_time update_time-->
  19. <!-- </sql>-->
  20. <!-- <sql id="includeMyMaterialDetail">-->
  21. <!-- m.id id,-->
  22. <!-- m.id my_material_id,-->
  23. <!-- m.material_id material_id,-->
  24. <!-- m.user_id user_id,-->
  25. <!-- mc.id category_id,-->
  26. <!-- mc.category_name category_name,-->
  27. <!-- m.title title,-->
  28. <!-- COALESCE(m.description, '') description,-->
  29. <!-- COALESCE(m.thumb, '') thumb,-->
  30. <!-- m.material_type material_type,-->
  31. <!-- COALESCE(m.content, '') content,-->
  32. <!-- COALESCE(m.file, '') file,-->
  33. <!-- m.create_time create_time,-->
  34. <!-- m.update_time update_time-->
  35. <!-- </sql>-->
  36. <!-- <resultMap id="resultMapMaterial" type="java.util.LinkedHashMap">-->
  37. <!-- <id property="id" column="id" jdbcType="BIGINT" />-->
  38. <!-- <result property="my_material_id" column="my_material_id" javaType="java.lang.Long"/>-->
  39. <!-- <result property="material_id" column="material_id" javaType="java.lang.Long"/>-->
  40. <!-- <result property="user_id" column="user_id" javaType="java.lang.Long"/>-->
  41. <!-- <result property="category_id" column="category_id" javaType="java.lang.Long"/>-->
  42. <!-- <result property="category_name" column="category_name" />-->
  43. <!-- <result property="title" column="title" />-->
  44. <!-- <result property="description" column="description" />-->
  45. <!-- <result property="thumb" column="thumb" />-->
  46. <!-- <result property="material_type" column="material_type" javaType="java.lang.Integer"/>-->
  47. <!-- &lt;!&ndash; <result property="content" column="content" /> &ndash;&gt;-->
  48. <!-- &lt;!&ndash; <result property="file" column="file" /> &ndash;&gt;-->
  49. <!-- <result property="create_time" column="create_time" />-->
  50. <!-- <result property="update_time" column="update_time" />-->
  51. <!-- </resultMap>-->
  52. <!-- <resultMap id="resultMapMaterialDetail" type="java.util.LinkedHashMap">-->
  53. <!-- <id property="id" column="id" jdbcType="BIGINT" />-->
  54. <!-- <result property="my_material_id" column="my_material_id" javaType="java.lang.Long"/>-->
  55. <!-- <result property="material_id" column="material_id" javaType="java.lang.Long"/>-->
  56. <!-- <result property="user_id" column="user_id" javaType="java.lang.Long"/>-->
  57. <!-- <result property="category_id" column="category_id" javaType="java.lang.Long"/>-->
  58. <!-- <result property="category_name" column="category_name" />-->
  59. <!-- <result property="title" column="title" />-->
  60. <!-- <result property="description" column="description" />-->
  61. <!-- <result property="thumb" column="thumb" />-->
  62. <!-- <result property="material_type" column="material_type" javaType="java.lang.Integer"/>-->
  63. <!-- <result property="content" column="content" />-->
  64. <!-- <result property="file" column="file" />-->
  65. <!-- <result property="create_time" column="create_time" />-->
  66. <!-- <result property="update_time" column="update_time" />-->
  67. <!-- </resultMap>-->
  68. <!-- <sql id="leftJoinCategory">-->
  69. <!-- LEFT JOIN med_material_category mc ON m.category_id = mc.id-->
  70. <!-- </sql>-->
  71. <!-- &lt;!&ndash; 查 列表 &ndash;&gt;-->
  72. <!-- <select id="queryMyMaterialList" resultMap="resultMapMaterial">-->
  73. <!-- SELECT-->
  74. <!-- <include refid="includeMyMaterial" />-->
  75. <!-- FROM med_my_material m-->
  76. <!-- <include refid="leftJoinCategory" />-->
  77. <!-- <where>-->
  78. <!-- <if test="my_material_ids != null and my_material_ids.size() > 0">-->
  79. <!-- AND m.id IN-->
  80. <!-- <foreach item="id" collection="my_material_ids" open="(" separator="," close=")">-->
  81. <!-- #{id}-->
  82. <!-- </foreach>-->
  83. <!-- </if>-->
  84. <!-- <if test="title != null and title != ''">-->
  85. <!-- AND m.title LIKE CONCAT('%', #{title}, '%')-->
  86. <!-- </if>-->
  87. <!-- <if test="description != null and description != ''">-->
  88. <!-- AND m.description LIKE CONCAT('%', #{description}, '%')-->
  89. <!-- </if>-->
  90. <!-- <if test="category_id != null and category_id != ''">-->
  91. <!-- AND m.category_id = #{category_id}-->
  92. <!-- </if>-->
  93. <!-- <if test="user_id != null and user_id != ''">-->
  94. <!-- AND m.user_id = #{user_id}-->
  95. <!-- </if>-->
  96. <!-- <if test="material_id != null and material_id != ''">-->
  97. <!-- AND m.material_id = #{material_id}-->
  98. <!-- </if>-->
  99. <!-- <if test="create_time != null and create_time != ''">-->
  100. <!-- AND m.create_time >= #{create_time}-->
  101. <!-- </if>-->
  102. <!-- </where>-->
  103. <!-- ORDER BY m.update_time DESC-->
  104. <!-- </select>-->
  105. <!-- &lt;!&ndash; 查 详情 (二次查询) &ndash;&gt;-->
  106. <!-- <select id="queryMyMaterialDetail" resultMap="resultMapMaterialDetail">-->
  107. <!-- SELECT <include refid="includeMyMaterialDetail" />-->
  108. <!-- FROM med_my_material m-->
  109. <!-- <include refid="leftJoinCategory" />-->
  110. <!-- WHERE m.id = #{my_material_id}-->
  111. <!-- </select>-->
  112. <!-- <insert id="insertMyMaterial" parameterType="com.backendsys.entity.Med.MedMyMaterialDTO"-->
  113. <!-- useGeneratedKeys="true" keyProperty="my_material_id">-->
  114. <!-- INSERT INTO med_my_material (-->
  115. <!-- category_id, user_id, title, material_type-->
  116. <!-- <if test="material_id != null and material_id != ''">, material_id</if>-->
  117. <!-- <if test="description != null and description != ''">, description</if>-->
  118. <!-- <if test="thumb != null and thumb != ''">, thumb</if>-->
  119. <!-- <if test="content != null and content != ''">, content</if>-->
  120. <!-- <if test="file != null and file != ''">, file</if>-->
  121. <!-- )-->
  122. <!-- VALUES (-->
  123. <!-- #{category_id}, #{user_id}, #{title}, #{material_type}-->
  124. <!-- <if test="material_id != null and material_id != ''">, #{material_id}</if>-->
  125. <!-- <if test="description != null and description != ''">, #{description}</if>-->
  126. <!-- <if test="thumb != null and thumb != ''">, #{thumb}</if>-->
  127. <!-- <if test="content != null and content != ''">, #{content}</if>-->
  128. <!-- <if test="file != null and file != ''">, #{file}</if>-->
  129. <!-- );-->
  130. <!-- </insert>-->
  131. <!-- <update id="updateMyMaterial" parameterType="com.backendsys.entity.Med.MedMaterialDTO"-->
  132. <!-- useGeneratedKeys="true" keyProperty="my_material_id">-->
  133. <!-- UPDATE med_my_material-->
  134. <!-- SET-->
  135. <!-- category_id = #{category_id},-->
  136. <!-- user_id = #{user_id},-->
  137. <!-- title = #{title},-->
  138. <!-- material_type = #{material_type},-->
  139. <!-- <if test="material_id != null and material_id != ''">, material_id = #{material_id}</if>-->
  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. <!-- WHERE id = #{my_material_id};-->
  145. <!-- </update>-->
  146. <!-- &lt;!&ndash; 删除 &ndash;&gt;-->
  147. <!-- <delete id="deleteMyMaterial" parameterType="java.lang.Long">-->
  148. <!-- DELETE FROM med_my_material WHERE id = #{my_material_id};-->
  149. <!-- </delete>-->
  150. <!-- &lt;!&ndash; 删除 (批量) &ndash;&gt;-->
  151. <!-- <delete id="deleteMyMaterialBatch" parameterType="java.lang.Long">-->
  152. <!-- DELETE FROM med_my_material WHERE id IN-->
  153. <!-- <foreach collection="ids" item="id" open="(" separator="," close=")">-->
  154. <!-- #{id}-->
  155. <!-- </foreach>-->
  156. <!-- </delete>-->
  157. <!--</mapper>-->