MouldFileMapper.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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.hssx.cloudmodel.mapper.MouldFileMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.MouldFile">
  6. <id column="id" property="id" />
  7. <result column="uplodtor_id" property="uplodtorId" />
  8. <result column="uploadtor" property="uploadtor" />
  9. <result column="indate" property="indate" />
  10. <result column="model_id" property="modelId" />
  11. <result column="sparepart_id" property="sparepartId" />
  12. <result column="project_id" property="projectId" />
  13. <result column="file_url" property="fileUrl" />
  14. <result column="file_name" property="fileName" />
  15. <result column="blong_type" property="blongType" />
  16. <result column="content" property="content" />
  17. <result column="state" property="state" />
  18. <result column="file_type" property="fileType" />
  19. <result column="file_size" property="fileSize" />
  20. <result column="file_url_2" property="fileUrl2" />
  21. <result column="file_name_2" property="fileName2" />
  22. <result column="file_type_2" property="fileType2" />
  23. <result column="file_size_2" property="fileSize2" />
  24. <result column="dwg_type" property="dwgType" />
  25. <result column="part_id" property="partId" />
  26. <result column="is_update" property="isUpdate" />
  27. </resultMap>
  28. <!-- 通用查询映射结果 -->
  29. <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.MouldFileVO">
  30. <id column="id" property="id" />
  31. <result column="model_no" property="modelNo"/>
  32. <result column="model_name" property="modelName"/>
  33. <collection property="mould2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  34. select="queryMould2DFilesByMouldId" column="id">
  35. </collection>
  36. <collection property="mould3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  37. select="queryMould3DFilesByMouldId" column="id">
  38. </collection>
  39. <collection property="sparepart2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  40. select="querySparepart2DFilesByMouldId" column="id">
  41. </collection>
  42. <collection property="sparepart3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  43. select="querySparepart3DFilesByMouldId" column="id">
  44. </collection>
  45. <collection property="maintainFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  46. select="queryMaintainFilesByMouldId" column="id">
  47. </collection>
  48. </resultMap>
  49. <resultMap id="BaseResultMapApprovedVO" type="com.hssx.cloudmodel.entity.vo.MouldFileVO">
  50. <id column="id" property="id" />
  51. <result column="model_no" property="modelNo"/>
  52. <result column="model_name" property="modelName"/>
  53. <collection property="mould2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  54. select="queryApprovedMould2DFilesByMouldId" column="id">
  55. </collection>
  56. <collection property="mould3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  57. select="queryApprovedMould3DFilesByMouldId" column="id">
  58. </collection>
  59. <collection property="sparepart2DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  60. select="queryApprovedSparepart2DFilesByMouldId" column="id">
  61. </collection>
  62. <collection property="sparepart3DFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  63. select="queryApprovedSparepart3DFilesByMouldId" column="id">
  64. </collection>
  65. <collection property="maintainFiles" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.MouldFile"
  66. select="queryApprovedMaintainFilesByMouldId" column="id">
  67. </collection>
  68. </resultMap>
  69. <!-- 通用查询结果列 -->
  70. <sql id="Base_Column_List">
  71. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id, project_id, file_url, file_name, blong_type, content, state, file_type, file_size, file_url_2, file_name_2, file_type_2, file_size_2, dwg_type,part_id
  72. </sql>
  73. <select id="getFileListByProjectId" resultMap="BaseResultMapVO">
  74. select
  75. id,model_no,model_name
  76. from
  77. tb_mould
  78. <where>
  79. project_id in
  80. <foreach collection="list" index="index" open="(" item="item" close=")" separator=",">
  81. #{item}
  82. </foreach>
  83. <if test="userVO.keyName != null and userVO.keyName != ''">
  84. and model_name like concat('%',#{userVO.keyName},'%')
  85. </if>
  86. </where>
  87. </select>
  88. <select id="getFileListByMouldId" resultMap="BaseResultMapApprovedVO">
  89. select
  90. id,model_no,model_name
  91. from
  92. tb_mould
  93. <where>
  94. id = #{id}
  95. </where>
  96. </select>
  97. <select id="querySparepart3DFilesByMouldId" resultMap="BaseResultMap">
  98. select
  99. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  100. project_id, file_url, file_name, blong_type, content, state,
  101. file_type, file_size, dwg_type
  102. from
  103. tb_mould_file
  104. where
  105. model_id = #{id}
  106. and
  107. blong_type = 1
  108. and
  109. dwg_type = 1
  110. </select>
  111. <select id="queryApprovedSparepart3DFilesByMouldId" resultMap="BaseResultMap">
  112. select
  113. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  114. project_id, file_url, file_name, blong_type, content, state,
  115. file_type, file_size, dwg_type
  116. from
  117. tb_mould_file
  118. where
  119. model_id = #{id}
  120. and
  121. blong_type = 1
  122. and
  123. dwg_type = 1
  124. and
  125. state = 3
  126. </select>
  127. <select id="querySparepart2DFilesByMouldId" resultMap="BaseResultMap">
  128. select
  129. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  130. project_id, file_url, file_name, blong_type, content, state,
  131. file_type, file_size, dwg_type
  132. from
  133. tb_mould_file
  134. where
  135. model_id = #{id}
  136. and
  137. blong_type = 1
  138. and
  139. dwg_type = 0
  140. </select>
  141. <select id="queryApprovedSparepart2DFilesByMouldId" resultMap="BaseResultMap">
  142. select
  143. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  144. project_id, file_url, file_name, blong_type, content, state,
  145. file_type, file_size, dwg_type
  146. from
  147. tb_mould_file
  148. where
  149. model_id = #{id}
  150. and
  151. blong_type = 1
  152. and
  153. dwg_type = 0
  154. and
  155. state = 3
  156. </select>
  157. <select id="queryMould3DFilesByMouldId" resultMap="BaseResultMap">
  158. select
  159. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  160. project_id, file_url, file_name, blong_type, content, state,
  161. file_type, file_size, dwg_type
  162. from
  163. tb_mould_file
  164. where
  165. model_id = #{id}
  166. and
  167. blong_type = 0
  168. and
  169. dwg_type = 1
  170. </select>
  171. <select id="queryApprovedMould3DFilesByMouldId" resultMap="BaseResultMap">
  172. select
  173. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  174. project_id, file_url, file_name, blong_type, content, state,
  175. file_type, file_size, dwg_type
  176. from
  177. tb_mould_file
  178. where
  179. model_id = #{id}
  180. and
  181. blong_type = 0
  182. and
  183. dwg_type = 1
  184. and
  185. state = 3
  186. </select>
  187. <select id="queryMould2DFilesByMouldId" resultMap="BaseResultMap">
  188. select
  189. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  190. project_id, file_url, file_name, blong_type, content, state,
  191. file_type, file_size, dwg_type
  192. from
  193. tb_mould_file
  194. where
  195. model_id = #{id}
  196. and
  197. blong_type = 0
  198. and
  199. dwg_type = 0
  200. </select>
  201. <select id="queryMaintainFilesByMouldId" resultMap="BaseResultMap">
  202. select
  203. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  204. project_id, file_url, file_name, blong_type, content, state,
  205. file_type, file_size
  206. from
  207. tb_mould_file
  208. where
  209. model_id = #{id}
  210. and
  211. blong_type = 3
  212. </select>
  213. <select id="queryApprovedMaintainFilesByMouldId" resultMap="BaseResultMap">
  214. select
  215. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  216. project_id, file_url, file_name, blong_type, content, state,
  217. file_type, file_size
  218. from
  219. tb_mould_file
  220. where
  221. model_id = #{id}
  222. and
  223. blong_type = 3
  224. and
  225. state = 3
  226. </select>
  227. </mapper>