CheckRecordAttachMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  4. <mapper namespace="com.zhyc.xps.aqpt.mapper.CheckRecordAttachMapper">
  5. <resultMap id="CheckRecordAttachDtoMap" type="com.zhyc.xps.aqpt.dto.CheckRecordAttachDto">
  6. <result column="oc_id" property="ocId" jdbcType="BIGINT" /><!--OC ID-->
  7. <result column="task_id" property="taskId" jdbcType="BIGINT" /><!--TASK ID-->
  8. <result column="check_record_id" property="checkRecordId" jdbcType="BIGINT" /><!--RECORD ID-->
  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" /><!--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="CheckRecordAttachDto_Cols">
  22. A.oc_id,
  23. A.task_id,
  24. A.check_record_id,
  25. A.file_id,
  26. B.file_title,
  27. B.dir_id,
  28. B.file_url,
  29. B.file_ext,
  30. B.file_size,
  31. B.file_author,
  32. B.file_desc,
  33. B.uploaded_by AS uploader_id,
  34. C.account_name AS uploader_name,
  35. B.uploaded_at
  36. </sql>
  37. <!--分页查询角色信息-->
  38. <select id="getByPage" parameterType="java.util.Map" resultMap="CheckRecordAttachDtoMap">
  39. SELECT
  40. <include refid="CheckRecordAttachDto_Cols"/>
  41. FROM check_record_attach AS A
  42. LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
  43. LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
  44. WHERE 1 = 1
  45. <if test="ocId != null">
  46. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  47. </if>
  48. <if test="taskId != null">
  49. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  50. </if>
  51. <if test="checkRecordId != null">
  52. AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
  53. </if>
  54. <if test="keywords != null and keywords != ''">
  55. AND B.file_title like "%"#{keywords}"%"
  56. </if>
  57. ORDER BY A.file_id ASC
  58. </select>
  59. <select id="getByList" parameterType="java.util.Map" resultMap="CheckRecordAttachDtoMap">
  60. SELECT
  61. <include refid="CheckRecordAttachDto_Cols"/>
  62. FROM check_record_attach AS A
  63. LEFT JOIN doc_file AS B ON(A.oc_id = B.oc_id AND A.file_id = B.file_id )
  64. LEFT JOIN account AS C ON(B.oc_id = C.oc_id AND B.uploaded_by = C.account_id)
  65. WHERE 1 = 1
  66. <if test="ocId != null">
  67. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  68. </if>
  69. <if test="taskId != null">
  70. AND A.task_id = #{taskId ,jdbcType=BIGINT}
  71. </if>
  72. <if test="checkRecordId != null">
  73. AND A.check_record_id = #{checkRecordId ,jdbcType=BIGINT}
  74. </if>
  75. <if test="keywords != null and keywords != ''">
  76. AND B.file_title like "%"#{keywords}"%"
  77. </if>
  78. ORDER BY A.file_id ASC
  79. </select>
  80. <insert id="create" parameterType="com.zhyc.xps.aqpt.entity.CheckRecordAttach">
  81. INSERT INTO check_record_attach
  82. <trim prefix="(" suffix=")" suffixOverrides=",">
  83. <if test="ocId != null">
  84. oc_id,
  85. </if>
  86. <if test="taskId != null">
  87. task_id,
  88. </if>
  89. <if test="checkRecordId != null">
  90. check_record_id,
  91. </if>
  92. <if test="fileId != null">
  93. file_id,
  94. </if>
  95. <if test="createdAt != null">
  96. created_at,
  97. </if>
  98. <if test="createdBy != null">
  99. created_by,
  100. </if>
  101. </trim>
  102. <trim prefix="values (" suffix=")" suffixOverrides=",">
  103. <if test="ocId != null">
  104. #{ocId ,jdbcType=BIGINT},
  105. </if>
  106. <if test="taskId != null">
  107. #{taskId ,jdbcType=BIGINT},
  108. </if>
  109. <if test="checkRecordId != null">
  110. #{checkRecordId ,jdbcType=BIGINT},
  111. </if>
  112. <if test="fileId != null">
  113. #{fileId ,jdbcType=BIGINT},
  114. </if>
  115. <if test="createdAt != null">
  116. #{createdAt ,jdbcType=TIMESTAMP},
  117. </if>
  118. <if test="createdBy != null">
  119. #{createdBy ,jdbcType=BIGINT},
  120. </if>
  121. </trim>
  122. </insert>
  123. <!--删除-->
  124. <delete id="delete" parameterType="java.util.Map">
  125. DELETE FROM check_record_attach
  126. WHERE 1 = 1
  127. <if test="ocId != null">
  128. AND oc_id = #{ocId ,jdbcType=BIGINT}
  129. </if>
  130. <if test="taskId != null">
  131. AND task_id = #{taskId ,jdbcType=BIGINT}
  132. </if>
  133. <if test="checkRecordId != null">
  134. AND check_record_id = #{checkRecordId ,jdbcType=BIGINT}
  135. </if>
  136. <if test="fileId != null">
  137. AND file_id = #{fileId ,jdbcType=BIGINT}
  138. </if>
  139. </delete>
  140. </mapper>