EntDangerAttachMapper.xml 5.5 KB

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