PartMapper.xml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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.PartMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Part">
  6. <id column="id" property="id" />
  7. <result column="part_no" property="partNo" />
  8. <result column="part_name" property="partName" />
  9. <result column="indate" property="indate" />
  10. <result column="part_life" property="partLife" />
  11. <result column="is_vulnerable" property="isVulnerable" />
  12. <result column="creator_id" property="creatorId" />
  13. <result column="creator" property="creator" />
  14. <result column="mould_id" property="mouldId" />
  15. </resultMap>
  16. <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.PartVO">
  17. <id column="id" property="id" />
  18. <result column="part_no" property="partNo" />
  19. <result column="part_name" property="partName" />
  20. <result column="indate" property="indate" />
  21. <result column="part_life" property="partLife" />
  22. <result column="is_vulnerable" property="isVulnerable" />
  23. <result column="creator_id" property="creatorId" />
  24. <result column="creator" property="creator" />
  25. <result column="mould_id" property="mouldId" />
  26. <result column="state" property="state" />
  27. <association property="part2dFile" javaType="com.hssx.cloudmodel.entity.MouldFile" column="id" select="getPart2dFileByPartId">
  28. </association>
  29. <association property="part3dFile" javaType="com.hssx.cloudmodel.entity.MouldFile" column="id" select="getPart3dFileByPartId">
  30. </association>
  31. </resultMap>
  32. <!-- 通用查询结果列 -->
  33. <sql id="Base_Column_List">
  34. id, part_no, part_name, indate, part_life, is_vulnerable, creator_id, creator, mould_id
  35. </sql>
  36. <select id="selectPartFileByMouldId" resultMap="BaseResultMapVO">
  37. select
  38. tbp.id, tbp.part_no, tbp.part_name, tbmf.indate, tbp.part_life, tbp.is_vulnerable, tbp.creator_id, tbp.creator, tbp.mould_id,tbmf.state
  39. from
  40. tb_part tbp
  41. left join
  42. tb_mould_file tbmf
  43. on tbmf.part_id = tbp.id
  44. where
  45. mould_id = #{userVO.mouldId}
  46. group by tbp.id
  47. </select>
  48. <select id="getPart2dFileByPartId" resultType="com.hssx.cloudmodel.entity.MouldFile">
  49. select
  50. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  51. project_id, file_url, file_name, blong_type, content, state,
  52. file_type, file_size, dwg_type, part_id
  53. from
  54. tb_mould_file
  55. where
  56. part_id = #{id}
  57. and dwg_type = 0
  58. </select>
  59. <select id="getPart3dFileByPartId" resultType="com.hssx.cloudmodel.entity.MouldFile">
  60. select
  61. id, uplodtor_id, uploadtor, indate, model_id, sparepart_id,
  62. project_id, file_url, file_name, blong_type, content, state,
  63. file_type, file_size, dwg_type, part_id
  64. from
  65. tb_mould_file
  66. where
  67. part_id = #{id}
  68. and dwg_type = 1
  69. </select>
  70. </mapper>