TUnifyFileMapper.xml 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.tool.mapper.TUnifyFileMapper">
  6. <resultMap type="TUnifyFile" id="TUnifyFileResult">
  7. <result property="id" column="id" />
  8. <result property="fileId" column="file_id" />
  9. <result property="uploadName" column="upload_name" />
  10. <result property="uploadType" column="upload_type" />
  11. <result property="uploadPath" column="upload_path" />
  12. <result property="uploadFormat" column="upload_format" />
  13. <result property="newUploadName" column="new_upload_name" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="fileBusinessId" column="file_business_id" />
  16. <result property="createBy" column="create_by" />
  17. <result property="createTime" column="create_time" />
  18. <result property="updateBy" column="update_by" />
  19. <result property="updateTime" column="update_time" />
  20. </resultMap>
  21. <sql id="selectTUnifyFileVo">
  22. select id, file_id, upload_name, upload_type, upload_path, upload_format, new_upload_name, del_flag, file_business_id, create_by, create_time, update_by, update_time from t_unify_file
  23. </sql>
  24. <select id="selectTUnifyFileList" parameterType="TUnifyFile" resultMap="TUnifyFileResult">
  25. <include refid="selectTUnifyFileVo"/>
  26. <where>
  27. del_flag = 0
  28. <if test="fileId != null and fileId != ''"> and file_id = #{fileId}</if>
  29. <if test="uploadName != null and uploadName != ''"> and upload_name like concat('%', #{uploadName}, '%')</if>
  30. <if test="uploadType != null and uploadType != ''"> and upload_type = #{uploadType}</if>
  31. <if test="uploadPath != null and uploadPath != ''"> and upload_path = #{uploadPath}</if>
  32. <if test="uploadFormat != null and uploadFormat != ''"> and upload_format = #{uploadFormat}</if>
  33. <if test="newUploadName != null and newUploadName != ''"> and new_upload_name like concat('%', #{newUploadName}, '%')</if>
  34. <if test="fileBusinessId != null and fileBusinessId != ''"> and file_business_id = #{fileBusinessId}</if>
  35. </where>
  36. </select>
  37. <select id="selectTUnifyFileById" parameterType="String" resultMap="TUnifyFileResult">
  38. <include refid="selectTUnifyFileVo"/>
  39. where id = #{id}
  40. </select>
  41. <insert id="insertTUnifyFile" parameterType="TUnifyFile">
  42. insert into t_unify_file
  43. <trim prefix="(" suffix=")" suffixOverrides=",">
  44. <if test="id != null">id,</if>
  45. <if test="fileId != null">file_id,</if>
  46. <if test="uploadName != null">upload_name,</if>
  47. <if test="uploadType != null">upload_type,</if>
  48. <if test="uploadPath != null">upload_path,</if>
  49. <if test="uploadFormat != null">upload_format,</if>
  50. <if test="newUploadName != null">new_upload_name,</if>
  51. <if test="delFlag != null">del_flag,</if>
  52. <if test="fileBusinessId != null">file_business_id,</if>
  53. <if test="createBy != null">create_by,</if>
  54. <if test="createTime != null">create_time,</if>
  55. <if test="updateBy != null">update_by,</if>
  56. <if test="updateTime != null">update_time,</if>
  57. </trim>
  58. <trim prefix="values (" suffix=")" suffixOverrides=",">
  59. <if test="id != null">#{id},</if>
  60. <if test="fileId != null">#{fileId},</if>
  61. <if test="uploadName != null">#{uploadName},</if>
  62. <if test="uploadType != null">#{uploadType},</if>
  63. <if test="uploadPath != null">#{uploadPath},</if>
  64. <if test="uploadFormat != null">#{uploadFormat},</if>
  65. <if test="newUploadName != null">#{newUploadName},</if>
  66. <if test="delFlag != null">#{delFlag},</if>
  67. <if test="fileBusinessId != null">#{fileBusinessId},</if>
  68. <if test="createBy != null">#{createBy},</if>
  69. <if test="createTime != null">#{createTime},</if>
  70. <if test="updateBy != null">#{updateBy},</if>
  71. <if test="updateTime != null">#{updateTime},</if>
  72. </trim>
  73. </insert>
  74. <update id="updateTUnifyFile" parameterType="TUnifyFile">
  75. update t_unify_file
  76. <trim prefix="SET" suffixOverrides=",">
  77. <if test="fileId != null">file_id = #{fileId},</if>
  78. <if test="uploadName != null">upload_name = #{uploadName},</if>
  79. <if test="uploadType != null">upload_type = #{uploadType},</if>
  80. <if test="uploadPath != null">upload_path = #{uploadPath},</if>
  81. <if test="uploadFormat != null">upload_format = #{uploadFormat},</if>
  82. <if test="newUploadName != null">new_upload_name = #{newUploadName},</if>
  83. <if test="delFlag != null">del_flag = #{delFlag},</if>
  84. <if test="fileBusinessId != null">file_business_id = #{fileBusinessId},</if>
  85. <if test="createBy != null">create_by = #{createBy},</if>
  86. <if test="createTime != null">create_time = #{createTime},</if>
  87. <if test="updateBy != null">update_by = #{updateBy},</if>
  88. <if test="updateTime != null">update_time = #{updateTime},</if>
  89. </trim>
  90. where id = #{id}
  91. </update>
  92. <delete id="deleteTUnifyFileById" parameterType="String">
  93. delete from t_unify_file where id = #{id}
  94. </delete>
  95. <delete id="deleteTUnifyFileByIds" parameterType="String">
  96. delete from t_unify_file where id in
  97. <foreach item="id" collection="array" open="(" separator="," close=")">
  98. #{id}
  99. </foreach>
  100. </delete>
  101. <update id="updateTUnifyFileByIds" parameterType="String">
  102. update t_unify_file
  103. set del_flag = 1
  104. where id in
  105. <foreach item="id" collection="array" open="(" separator="," close=")">
  106. #{id}
  107. </foreach>
  108. </update>
  109. <update id="updateTUnifyFileBusinessIds" parameterType="String">
  110. update t_unify_file
  111. set del_flag = 1
  112. where file_business_id in
  113. <foreach item="id" collection="array" open="(" separator="," close=")">
  114. #{id}
  115. </foreach>
  116. </update>
  117. <select id="selectTUnifyFileByBusinessIdList" parameterType="String" resultMap="TUnifyFileResult">
  118. <include refid="selectTUnifyFileVo"/>
  119. where file_business_id = #{fileBusinessId} and del_flag = 0
  120. <if test="uploadType != null and uploadType != ''"> and upload_type = #{uploadType}</if>
  121. </select>
  122. <select id="listFileId" parameterType="String" resultMap="TUnifyFileResult">
  123. <include refid="selectTUnifyFileVo"/>
  124. where file_id = #{fileId} and del_flag = 0
  125. order by create_time
  126. </select>
  127. </mapper>