CompanyMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.CompanyMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Company">
  6. <id column="id" property="id" />
  7. <result column="company_name" property="companyName" />
  8. <result column="company_address" property="companyAddress" />
  9. <result column="company_type" property="companyType" />
  10. <result column="administrator_id" property="administratorId" />
  11. <result column="administrator" property="administrator" />
  12. </resultMap>
  13. <!-- 通用查询结果列 -->
  14. <sql id="Base_Column_List">
  15. id, company_name, company_address, company_type, administrator_id, administrator
  16. </sql>
  17. <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.CompanyVO">
  18. <id column="id" property="id" />
  19. <result column="company_name" property="companyName" />
  20. <result column="company_address" property="companyAddress" />
  21. <result column="companytype" property="companyType" />
  22. <result column="administrator_id" property="administratorId" />
  23. <result column="administrator" property="administrator" />
  24. <result column="y_lng" property="yLng" />
  25. <result column="x_lat" property="xLat" />
  26. <collection property="relateCompanyList" javaType="java.util.List" select="selectRelateCompanyList"
  27. column="{Id=id,companyType = companytype}"
  28. ofType="com.hssx.cloudmodel.entity.Company"/>
  29. </resultMap>
  30. <resultMap id="BaseResultMapMouldVO" type="com.hssx.cloudmodel.entity.vo.CompanyVO">
  31. <id column="id" property="id" />
  32. <result column="company_name" property="companyName" />
  33. <result column="company_address" property="companyAddress" />
  34. <result column="company_type" property="companyType" />
  35. <result column="y_lng" property="yLng" />
  36. <result column="x_lat" property="xLat" />
  37. <collection property="list" javaType="java.util.List" select="selectMouldsList" column="id"
  38. ofType="com.hssx.cloudmodel.entity.Mould"/>
  39. </resultMap>
  40. <!--<select id="getListByKeyName" resultMap="BaseResultMapVO">-->
  41. <!--select-->
  42. <!--<include refid="Base_Column_List"/>-->
  43. <!--from-->
  44. <!--tb_company-->
  45. <!--<where>-->
  46. <!--<if test="keyName != null and keyName != ''">-->
  47. <!--and company_name like concat('%',#{keyName},'%')-->
  48. <!--</if>-->
  49. <!--<if test="companyType != null">-->
  50. <!--and company_type = #{companyType}-->
  51. <!--</if>-->
  52. <!--</where>-->
  53. <!--</select>-->
  54. <select id="getCustomerListByKeyName" resultMap="BaseResultMapVO">
  55. select
  56. t.id, t.company_name, t.company_address, t.company_type companytype,t.administrator_id,t.administrator,tc.y_lng, tc.x_lat
  57. from
  58. tb_company t
  59. left join
  60. tb_lng_lat_company tc
  61. on tc.company_id = t.id
  62. <where>
  63. <if test="keyName != null and keyName != ''">
  64. and t.company_name like concat('%',#{keyName},'%')
  65. </if>
  66. <if test="companyType != null">
  67. and t.company_type = #{companyType}
  68. </if>
  69. </where>
  70. </select>
  71. <select id="selectRelateCompanyList" resultType="com.hssx.cloudmodel.entity.Company" parameterType="java.util.Map">
  72. SELECT
  73. t.id, t.company_name,t.company_type
  74. from
  75. tb_asset_custom_company tbcc
  76. left join
  77. tb_company t
  78. <if test="companyType == 0">
  79. on t.id = tbcc.custom_id
  80. </if>
  81. <if test="companyType == 1">
  82. on t.id = tbcc.assert_id
  83. </if>
  84. <where>
  85. <if test="companyType == 0">
  86. tbcc.assert_id = #{Id}
  87. </if>
  88. <if test="companyType == 1">
  89. tbcc.custom_id = #{Id}
  90. </if>
  91. </where>
  92. </select>
  93. <select id="getListMould" resultMap="BaseResultMapMouldVO">
  94. select
  95. t.id, t.company_name, t.company_address, t.company_type,tbc.y_lng, tbc.x_lat
  96. from
  97. tb_mould tm
  98. LEFT JOIN
  99. tb_company t
  100. on
  101. tm.produce_company_id = t.id
  102. LEFT JOIN
  103. tb_lng_lat_company tbc
  104. ON
  105. tbc.company_id = t.id
  106. where t.id IS NOT NULL AND tm.id in
  107. <foreach item="item" index="index" collection="mouldIds"
  108. open="(" separator="," close=")">
  109. #{item}
  110. </foreach>
  111. </select>
  112. <resultMap id="BaseResultMouldMap" type="com.hssx.cloudmodel.entity.Mould">
  113. <id column="id" property="id" />
  114. <result column="model_no" property="modelNo" />
  115. <result column="model_name" property="modelName" />
  116. <result column="water_gap" property="waterGap" />
  117. <result column="tonnage" property="tonnage" />
  118. <result column="oc_cycle" property="ocCycle" />
  119. <result column="daily_output" property="dailyOutput" />
  120. <result column="company_id" property="companyId" />
  121. <result column="current_version_id" property="currentVersionId" />
  122. <result column="state" property="state" />
  123. <result column="is_delete" property="isDelete" />
  124. <result column="creator_id" property="creatorId" />
  125. <result column="project_id" property="projectId" />
  126. <result column="rfid" property="rfid" />
  127. <result column="setting_life" property="settingLife" />
  128. <result column="area" property="area" />
  129. <result column="initial_modulus" property="initialModulus" />
  130. <result column="equipment_id" property="equipmentId" />
  131. <result column="belong_project_grade" property="belongProjectGrade" />
  132. <result column="produce_company_id" property="produceCompanyId" />
  133. <result column="run_times" property="runTimes" />
  134. </resultMap>
  135. <select id="selectMouldsList" resultMap="BaseResultMouldMap">
  136. select
  137. id, model_no, model_name, water_gap, tonnage, oc_cycle, daily_output, company_id, current_version_id, state, is_delete, creator_id, project_id, rfid, setting_life, area,
  138. initial_modulus, equipment_id, belong_project_grade, produce_company_id, run_times
  139. from
  140. tb_mould
  141. where
  142. produce_company_id = #{id}
  143. </select>
  144. </mapper>