AssessRecordAttachMapper.xml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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.zhyc.xps.lylc.mapper.AssessRecordAttachMapper">
  4. <resultMap id="AssessRecordAttachDtoMap" type="com.zhyc.xps.lylc.dto.AssessRecordAttachDto">
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="story_id" property="recordId" jdbcType="BIGINT" />
  7. <result column="item_id" property="itemId" jdbcType="BIGINT" />
  8. <result column="record_id" property="recordId" jdbcType="BIGINT" />
  9. <result column="file_id" property="fileId" jdbcType="BIGINT" />
  10. <result column="file_title" property="fileTitle" jdbcType="VARCHAR" />
  11. <result column="dir_id" property="dirId" jdbcType="BIGINT" /><!--Dir ID-->
  12. <result column="file_url" property="fileUrl" jdbcType="VARCHAR" />
  13. <result column="file_ext" property="fileExt" jdbcType="VARCHAR" />
  14. <result column="file_size" property="fileSize" jdbcType="BIGINT" />
  15. <result column="file_author" property="fileAuthor" jdbcType="VARCHAR" />
  16. <result column="file_desc" property="fileDesc" jdbcType="VARCHAR" />
  17. <result column="uploader_id" property="uploaderId" jdbcType="BIGINT" />
  18. <result column="uploader_name" property="uploaderName" jdbcType="VARCHAR" />
  19. <result column="uploaded_at" property="uploadedAt" jdbcType="TIMESTAMP"/>
  20. </resultMap>
  21. <sql id="AssessRecordAttachDto_Cols">
  22. A.oc_id,
  23. A.story_id,
  24. A.item_id,
  25. A.record_id,
  26. A.file_id,
  27. B.file_title,
  28. B.dir_id,
  29. B.file_url,
  30. B.file_ext,
  31. B.file_size,
  32. B.file_author,
  33. B.file_desc,
  34. B.uploaded_by AS uploader_id,
  35. C.account_name AS uploader_name,
  36. B.uploaded_at
  37. </sql>
  38. <!--分页查询-->
  39. <select id="getByPage" parameterType="java.util.Map" resultMap="AssessRecordAttachDtoMap">
  40. SELECT
  41. <include refid="AssessRecordAttachDto_Cols"/>
  42. FROM hos_assess_record_attach AS A
  43. LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
  44. LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
  45. WHERE 1 = 1
  46. <if test="ocId != null">
  47. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  48. </if>
  49. <if test="storyId != null">
  50. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  51. </if>
  52. <if test="itemId != null">
  53. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  54. </if>
  55. <if test="recordId != null">
  56. AND A.record_id = #{recordId ,jdbcType=BIGINT}
  57. </if>
  58. <if test="keywords != null and keywords != ''">
  59. AND B.file_title like "%"#{keywords}"%"
  60. </if>
  61. ORDER BY A.file_id ASC
  62. </select>
  63. <!--列表查询-->
  64. <select id="getByList" parameterType="java.util.Map" resultMap="AssessRecordAttachDtoMap">
  65. SELECT
  66. <include refid="AssessRecordAttachDto_Cols"/>
  67. FROM hos_assess_record_attach AS A
  68. LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
  69. LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
  70. WHERE 1 = 1
  71. <if test="ocId != null">
  72. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  73. </if>
  74. <if test="storyId != null">
  75. AND A.story_id = #{storyId ,jdbcType=BIGINT}
  76. </if>
  77. <if test="itemId != null">
  78. AND A.item_id = #{itemId ,jdbcType=BIGINT}
  79. </if>
  80. <if test="recordId != null">
  81. AND A.record_id = #{recordId ,jdbcType=BIGINT}
  82. </if>
  83. <if test="keywords != null and keywords != ''">
  84. AND B.file_title like "%"#{keywords}"%"
  85. </if>
  86. ORDER BY A.file_id ASC
  87. </select>
  88. <insert id="create" parameterType="com.zhyc.xps.lylc.entity.AssessRecordAttach">
  89. INSERT INTO hos_assess_record_attach
  90. <trim prefix="(" suffix=")" suffixOverrides=",">
  91. <if test="ocId != null">
  92. oc_id,
  93. </if>
  94. <if test="storyId != null">
  95. story_id,
  96. </if>
  97. <if test="itemId != null">
  98. item_id,
  99. </if>
  100. <if test="recordId != null">
  101. record_id,
  102. </if>
  103. <if test="fileId != null">
  104. file_id,
  105. </if>
  106. <if test="createdBy != null">
  107. created_by,
  108. </if>
  109. <if test="createdAt != null">
  110. created_at,
  111. </if>
  112. </trim>
  113. <trim prefix="values (" suffix=")" suffixOverrides=",">
  114. <if test="ocId != null">
  115. #{ocId ,jdbcType=BIGINT},
  116. </if>
  117. <if test="storyId != null">
  118. #{storyId ,jdbcType=BIGINT},
  119. </if>
  120. <if test="itemId != null">
  121. #{itemId ,jdbcType=BIGINT},
  122. </if>
  123. <if test="recordId != null">
  124. #{recordId ,jdbcType=BIGINT},
  125. </if>
  126. <if test="fileId != null">
  127. #{fileId ,jdbcType=BIGINT},
  128. </if>
  129. <if test="createdBy != null">
  130. #{createdBy ,jdbcType=BIGINT},
  131. </if>
  132. <if test="createdAt != null">
  133. #{createdAt ,jdbcType=TIMESTAMP},
  134. </if>
  135. </trim>
  136. </insert>
  137. <!--删除-->
  138. <delete id="delete" parameterType="java.util.Map">
  139. DELETE FROM hos_assess_record_attach
  140. WHERE 1 = 1
  141. <if test="ocId != null">
  142. AND oc_id = #{ocId ,jdbcType=BIGINT}
  143. </if>
  144. <if test="recordId != null">
  145. AND record_id = #{recordId ,jdbcType=BIGINT}
  146. </if>
  147. <if test="fileId != null">
  148. AND file_id = #{fileId ,jdbcType=BIGINT}
  149. </if>
  150. </delete>
  151. </mapper>