InspectionObjectMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  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.bz.smart_city.dao.InspectionObjectMapper">
  4. <!--auto generated Code-->
  5. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.InspectionObject">
  6. <result column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="site_id" property="siteId" jdbcType="INTEGER"/>
  8. <result column="object_name" property="objectName" jdbcType="VARCHAR"/>
  9. <result column="location" property="location" jdbcType="VARCHAR"/>
  10. <result column="is_flag" property="isFlag" jdbcType="VARCHAR"/>
  11. <result column="longitude" property="longitude" jdbcType="DECIMAL"/>
  12. <result column="latitude" property="latitude" jdbcType="DECIMAL"/>
  13. <result column="mark_location" property="markLocation" jdbcType="VARCHAR"/>
  14. <result column="standard_id" property="standardId" jdbcType="INTEGER"/>
  15. <result column="object_status" property="objectStatus" jdbcType="INTEGER"/>
  16. <result column="device_id" property="deviceId" jdbcType="BIGINT"/>
  17. <result column="status" property="status" jdbcType="INTEGER"/>
  18. <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
  19. <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
  20. <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
  21. <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
  22. <result column="plan_id" property="planId" jdbcType="INTEGER"/>
  23. <result column="x_coordinates" property="xCoordinates" jdbcType="DECIMAL"/>
  24. <result column="y_coordinates" property="yCoordinates" jdbcType="DECIMAL"/>
  25. </resultMap>
  26. <!--auto generated Code-->
  27. <sql id="Base_Column_List">
  28. id,
  29. site_id,
  30. object_name,
  31. location,
  32. is_flag,
  33. longitude,
  34. latitude,
  35. mark_location,
  36. standard_id,
  37. object_status,
  38. device_id,
  39. status,
  40. date_create,
  41. date_update,
  42. create_by,
  43. update_by,
  44. plan_id,
  45. x_coordinates,
  46. y_coordinates
  47. </sql>
  48. <!--auto generated Code-->
  49. <insert id="insert" useGeneratedKeys="true" keyProperty="inspectionObject.id">
  50. INSERT INTO sc_inspection_object (
  51. id,
  52. site_id,
  53. object_name,
  54. location,
  55. is_flag,
  56. longitude,
  57. latitude,
  58. mark_location,
  59. standard_id,
  60. object_status,
  61. device_id,
  62. status,
  63. date_create,
  64. date_update,
  65. create_by,
  66. update_by,
  67. plan_id,
  68. x_coordinates,
  69. y_coordinates
  70. ) VALUES (
  71. #{inspectionObject.id,jdbcType=INTEGER},
  72. #{inspectionObject.siteId,jdbcType=INTEGER},
  73. #{inspectionObject.objectName,jdbcType=VARCHAR},
  74. #{inspectionObject.location,jdbcType=VARCHAR},
  75. #{inspectionObject.isFlag,jdbcType=VARCHAR},
  76. #{inspectionObject.longitude,jdbcType=DECIMAL},
  77. #{inspectionObject.latitude,jdbcType=DECIMAL},
  78. #{inspectionObject.markLocation,jdbcType=VARCHAR},
  79. #{inspectionObject.standardId,jdbcType=INTEGER},
  80. #{inspectionObject.objectStatus,jdbcType=INTEGER},
  81. #{inspectionObject.deviceId,jdbcType=BIGINT},
  82. #{inspectionObject.status,jdbcType=INTEGER},
  83. #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
  84. #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
  85. #{inspectionObject.createBy,jdbcType=VARCHAR},
  86. #{inspectionObject.updateBy,jdbcType=VARCHAR},
  87. #{inspectionObject.planId,jdbcType=INTEGER},
  88. #{inspectionObject.xCoordinates,jdbcType=DECIMAL},
  89. #{inspectionObject.yCoordinates,jdbcType=DECIMAL}
  90. )
  91. </insert>
  92. <!--auto generated Code-->
  93. <insert id="insertSelective" useGeneratedKeys="true" keyProperty="inspectionObject.id">
  94. INSERT INTO sc_inspection_object
  95. <trim prefix="(" suffix=")" suffixOverrides=",">
  96. <if test="inspectionObject.id!=null"> id,</if>
  97. <if test="inspectionObject.siteId!=null"> site_id,</if>
  98. <if test="inspectionObject.objectName!=null"> object_name,</if>
  99. <if test="inspectionObject.location!=null"> location,</if>
  100. <if test="inspectionObject.isFlag!=null"> is_flag,</if>
  101. <if test="inspectionObject.longitude!=null"> longitude,</if>
  102. <if test="inspectionObject.latitude!=null"> latitude,</if>
  103. <if test="inspectionObject.markLocation!=null"> mark_location,</if>
  104. <if test="inspectionObject.standardId!=null"> standard_id,</if>
  105. <if test="inspectionObject.objectStatus!=null"> object_status,</if>
  106. <if test="inspectionObject.deviceId!=null"> device_id,</if>
  107. <if test="inspectionObject.status!=null"> status,</if>
  108. <if test="inspectionObject.dateCreate!=null"> date_create,</if>
  109. <if test="inspectionObject.dateUpdate!=null"> date_update,</if>
  110. <if test="inspectionObject.createBy!=null"> create_by,</if>
  111. <if test="inspectionObject.updateBy!=null"> update_by,</if>
  112. <if test="inspectionObject.planId!=null"> plan_id,</if>
  113. <if test="inspectionObject.xCoordinates!=null"> x_coordinates,</if>
  114. <if test="inspectionObject.yCoordinates!=null"> y_coordinates,</if>
  115. </trim>
  116. VALUES
  117. <trim prefix="(" suffix=")" suffixOverrides=",">
  118. <if test="inspectionObject.id!=null">#{inspectionObject.id,jdbcType=INTEGER},
  119. </if>
  120. <if test="inspectionObject.siteId!=null">#{inspectionObject.siteId,jdbcType=INTEGER},
  121. </if>
  122. <if test="inspectionObject.objectName!=null">#{inspectionObject.objectName,jdbcType=VARCHAR},
  123. </if>
  124. <if test="inspectionObject.location!=null">#{inspectionObject.location,jdbcType=VARCHAR},
  125. </if>
  126. <if test="inspectionObject.isFlag!=null">#{inspectionObject.isFlag,jdbcType=VARCHAR},
  127. </if>
  128. <if test="inspectionObject.longitude!=null">#{inspectionObject.longitude,jdbcType=DECIMAL},
  129. </if>
  130. <if test="inspectionObject.latitude!=null">#{inspectionObject.latitude,jdbcType=DECIMAL},
  131. </if>
  132. <if test="inspectionObject.markLocation!=null">#{inspectionObject.markLocation,jdbcType=VARCHAR},
  133. </if>
  134. <if test="inspectionObject.standardId!=null">#{inspectionObject.standardId,jdbcType=INTEGER},
  135. </if>
  136. <if test="inspectionObject.objectStatus!=null">#{inspectionObject.objectStatus,jdbcType=INTEGER},
  137. </if>
  138. <if test="inspectionObject.deviceId!=null">#{inspectionObject.deviceId,jdbcType=BIGINT},
  139. </if>
  140. <if test="inspectionObject.status!=null">#{inspectionObject.status,jdbcType=INTEGER},
  141. </if>
  142. <if test="inspectionObject.dateCreate!=null">#{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
  143. </if>
  144. <if test="inspectionObject.dateUpdate!=null">#{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
  145. </if>
  146. <if test="inspectionObject.createBy!=null">#{inspectionObject.createBy,jdbcType=VARCHAR},
  147. </if>
  148. <if test="inspectionObject.updateBy!=null">#{inspectionObject.updateBy,jdbcType=VARCHAR},
  149. </if>
  150. <if test="inspectionObject.planId!=null">#{inspectionObject.planId,jdbcType=INTEGER},
  151. </if>
  152. <if test="inspectionObject.xCoordinates!=null">#{inspectionObject.xCoordinates,jdbcType=DECIMAL},
  153. </if>
  154. <if test="inspectionObject.yCoordinates!=null">#{inspectionObject.yCoordinates,jdbcType=DECIMAL},
  155. </if>
  156. </trim>
  157. </insert>
  158. <!--auto generated Code-->
  159. <insert id="insertList">
  160. INSERT INTO sc_inspection_object (
  161. id,
  162. site_id,
  163. object_name,
  164. location,
  165. is_flag,
  166. longitude,
  167. latitude,
  168. mark_location,
  169. standard_id,
  170. object_status,
  171. device_id,
  172. status,
  173. date_create,
  174. date_update,
  175. create_by,
  176. update_by,
  177. plan_id,
  178. x_coordinates,
  179. y_coordinates
  180. )VALUES
  181. <foreach collection="inspectionObjects" item="inspectionObject" index="index" separator=",">
  182. (
  183. #{inspectionObject.id,jdbcType=INTEGER},
  184. #{inspectionObject.siteId,jdbcType=INTEGER},
  185. #{inspectionObject.objectName,jdbcType=VARCHAR},
  186. #{inspectionObject.location,jdbcType=VARCHAR},
  187. #{inspectionObject.isFlag,jdbcType=VARCHAR},
  188. #{inspectionObject.longitude,jdbcType=DECIMAL},
  189. #{inspectionObject.latitude,jdbcType=DECIMAL},
  190. #{inspectionObject.markLocation,jdbcType=VARCHAR},
  191. #{inspectionObject.standardId,jdbcType=INTEGER},
  192. #{inspectionObject.objectStatus,jdbcType=INTEGER},
  193. #{inspectionObject.deviceId,jdbcType=BIGINT},
  194. #{inspectionObject.status,jdbcType=INTEGER},
  195. #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},
  196. #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},
  197. #{inspectionObject.createBy,jdbcType=VARCHAR},
  198. #{inspectionObject.updateBy,jdbcType=VARCHAR},
  199. #{inspectionObject.planId,jdbcType=INTEGER},
  200. #{inspectionObject.xCoordinates,jdbcType=DECIMAL},
  201. #{inspectionObject.yCoordinates,jdbcType=DECIMAL}
  202. )
  203. </foreach>
  204. </insert>
  205. <!--auto generated Code-->
  206. <update id="updateByPrimaryKeySelective">
  207. UPDATE sc_inspection_object
  208. <set>
  209. <if test="inspectionObject.siteId != null"> site_id= #{inspectionObject.siteId,jdbcType=INTEGER},</if>
  210. <if test="inspectionObject.objectName != null"> object_name= #{inspectionObject.objectName,jdbcType=VARCHAR},</if>
  211. <if test="inspectionObject.location != null"> location= #{inspectionObject.location,jdbcType=VARCHAR},</if>
  212. <if test="inspectionObject.isFlag != null"> is_flag= #{inspectionObject.isFlag,jdbcType=VARCHAR},</if>
  213. <if test="inspectionObject.longitude != null"> longitude= #{inspectionObject.longitude,jdbcType=DECIMAL},</if>
  214. <if test="inspectionObject.latitude != null"> latitude= #{inspectionObject.latitude,jdbcType=DECIMAL},</if>
  215. <if test="inspectionObject.markLocation != null"> mark_location= #{inspectionObject.markLocation,jdbcType=VARCHAR},</if>
  216. <if test="inspectionObject.standardId != null"> standard_id= #{inspectionObject.standardId,jdbcType=INTEGER},</if>
  217. <if test="inspectionObject.objectStatus != null"> object_status= #{inspectionObject.objectStatus,jdbcType=INTEGER},</if>
  218. <if test="inspectionObject.deviceId != null"> device_id= #{inspectionObject.deviceId,jdbcType=BIGINT},</if>
  219. <if test="inspectionObject.status != null"> status= #{inspectionObject.status,jdbcType=INTEGER},</if>
  220. <if test="inspectionObject.dateCreate != null"> date_create= #{inspectionObject.dateCreate,jdbcType=TIMESTAMP},</if>
  221. <if test="inspectionObject.dateUpdate != null"> date_update= #{inspectionObject.dateUpdate,jdbcType=TIMESTAMP},</if>
  222. <if test="inspectionObject.createBy != null"> create_by= #{inspectionObject.createBy,jdbcType=VARCHAR},</if>
  223. <if test="inspectionObject.updateBy != null"> update_by= #{inspectionObject.updateBy,jdbcType=VARCHAR},</if>
  224. <if test="inspectionObject.planId != null"> plan_id= #{inspectionObject.planId,jdbcType=INTEGER},</if>
  225. <if test="inspectionObject.xCoordinates != null"> x_coordinates= #{inspectionObject.xCoordinates,jdbcType=DECIMAL},</if>
  226. <if test="inspectionObject.yCoordinates != null"> y_coordinates= #{inspectionObject.yCoordinates,jdbcType=DECIMAL}</if>
  227. </set>
  228. WHERE id = #{inspectionObject.id,jdbcType=INTEGER}
  229. </update>
  230. <select id="getList" resultType="com.bz.smart_city.dto.InspectionObjectDto">
  231. select
  232. sio.*,sis.standard_name,sd.device_no,sd.device_type as device_type_id,sd.manufacturer_id
  233. from sc_inspection_object sio
  234. left join sc_inspection_standard sis on (sis.id = sio.standard_id and sis.status = 1)
  235. left join sc_device sd on (sd.id = sio.device_id and sd.status = 1)
  236. where sio.status = 1
  237. <if test="siteId != null"> and sio.site_id = #{siteId} </if>
  238. <if test="name != null and name != ''"> AND sio.object_name LIKE concat('%',#{name},'%')</if>
  239. <if test="location != null and location != ''"> AND sio.location LIKE concat('%',#{location} ,'%')</if>
  240. <if test="objectStatus != null"> and sio.object_status = #{objectStatus} </if>
  241. <if test="objectIds != null and objectIds.size() != 0">
  242. and sio.id in
  243. <foreach collection="objectIds" item="item" open="(" separator="," close=")">#{item}</foreach>
  244. </if>
  245. order by sio.date_create desc
  246. </select>
  247. <select id="findByNameUnique" resultType="java.lang.Integer">
  248. select count(1) from sc_inspection_object
  249. where status = 1 and object_name = #{objectName}
  250. <if test="siteId != null"> and site_id = #{siteId} </if>
  251. <if test="id != null"> and id != #{id}</if>
  252. </select>
  253. <select id="countByStandardId" resultType="java.lang.Integer">
  254. select id from sc_inspection_object where status = 1 and standard_id = #{standardId}
  255. </select>
  256. </mapper>