WfInsAttachMapper.xml 5.7 KB

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