InstallPlanMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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.assistant.InstallPlanMapper">
  4. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.assistant.InstallPlan">
  5. <!--@mbg.generated-->
  6. <id column="id" property="id" />
  7. <result column="site_id" property="siteId" />
  8. <result column="plan_name" property="planName" />
  9. <result column="province" property="province" />
  10. <result column="city" property="city" />
  11. <result column="region" property="region" />
  12. <result column="community_id" property="communityId" />
  13. <result column="community_name" property="communityName" />
  14. <result column="pre_install_number" property="preInstallNumber" />
  15. <result column="customer_id" property="customerId" />
  16. <result column="device_type_id" property="deviceTypeId" />
  17. <result column="install_group_name" property="installGroupName" />
  18. <result column="install_group_header" property="installGroupHeader" />
  19. <result column="phone" property="phone" />
  20. <result column="plan_start_date" property="planStartDate" />
  21. <result column="plan_end_date" property="planEndDate" />
  22. <result column="plan_status" property="planStatus" />
  23. <result column="date_create" property="dateCreate" />
  24. <result column="date_update" property="dateUpdate" />
  25. <result column="create_by" property="createBy" />
  26. <result column="update_by" property="updateBy" />
  27. <result column="status" property="status" />
  28. <result column="remark" property="remark" />
  29. <result column="enable_unit" property="enableUnit" />
  30. <result column="building_number" property="buildingNumber" />
  31. <result column="unit_number" property="unitNumber" />
  32. <result column="file_path" property="filePath" />
  33. <result column="enable_download" property="enableDownload" />
  34. <result column="platform_type" property="platformType"/>
  35. </resultMap>
  36. <sql id="Base_Column_List">
  37. <!--@mbg.generated-->
  38. id, site_id, plan_name, province, city, region, community_id, community_name, pre_install_number,
  39. customer_id, device_type_id, install_group_name, install_group_header, phone, plan_start_date,
  40. plan_end_date, plan_status, date_create, date_update, create_by, update_by, `status`,
  41. remark, enable_unit, building_number, unit_number, file_path, enable_download
  42. </sql>
  43. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.assistant.InstallPlan" useGeneratedKeys="true">
  44. <!--@mbg.generated-->
  45. insert into sc_install_plan
  46. <trim prefix="(" suffix=")" suffixOverrides=",">
  47. <if test="siteId != null">
  48. site_id,
  49. </if>
  50. <if test="planName != null">
  51. plan_name,
  52. </if>
  53. <if test="province != null">
  54. province,
  55. </if>
  56. <if test="city != null">
  57. city,
  58. </if>
  59. <if test="region != null">
  60. region,
  61. </if>
  62. <if test="communityId != null">
  63. community_id,
  64. </if>
  65. <if test="communityName != null">
  66. community_name,
  67. </if>
  68. <if test="preInstallNumber != null">
  69. pre_install_number,
  70. </if>
  71. <if test="customerId != null">
  72. customer_id,
  73. </if>
  74. <if test="deviceTypeId != null">
  75. device_type_id,
  76. </if>
  77. <if test="installGroupName != null">
  78. install_group_name,
  79. </if>
  80. <if test="installGroupHeader != null">
  81. install_group_header,
  82. </if>
  83. <if test="phone != null">
  84. phone,
  85. </if>
  86. <if test="planStartDate != null">
  87. plan_start_date,
  88. </if>
  89. <if test="planEndDate != null">
  90. plan_end_date,
  91. </if>
  92. <if test="planStatus != null">
  93. plan_status,
  94. </if>
  95. <if test="dateCreate != null">
  96. date_create,
  97. </if>
  98. <if test="dateUpdate != null">
  99. date_update,
  100. </if>
  101. <if test="createBy != null">
  102. create_by,
  103. </if>
  104. <if test="updateBy != null">
  105. update_by,
  106. </if>
  107. <if test="status != null">
  108. `status`,
  109. </if>
  110. <if test="remark != null">
  111. remark,
  112. </if>
  113. <if test="enableUnit != null">
  114. enable_unit,
  115. </if>
  116. <if test="buildingNumber != null">
  117. building_number,
  118. </if>
  119. <if test="unitNumber != null">
  120. unit_number,
  121. </if>
  122. <if test="filePath != null">
  123. file_path,
  124. </if>
  125. <if test="enableDownload != null">
  126. enable_download,
  127. </if>
  128. <if test="platformType != null">
  129. platform_type,
  130. </if>
  131. </trim>
  132. <trim prefix="values (" suffix=")" suffixOverrides=",">
  133. <if test="siteId != null">
  134. #{siteId},
  135. </if>
  136. <if test="planName != null">
  137. #{planName},
  138. </if>
  139. <if test="province != null">
  140. #{province},
  141. </if>
  142. <if test="city != null">
  143. #{city},
  144. </if>
  145. <if test="region != null">
  146. #{region},
  147. </if>
  148. <if test="communityId != null">
  149. #{communityId},
  150. </if>
  151. <if test="communityName != null">
  152. #{communityName},
  153. </if>
  154. <if test="preInstallNumber != null">
  155. #{preInstallNumber},
  156. </if>
  157. <if test="customerId != null">
  158. #{customerId},
  159. </if>
  160. <if test="deviceTypeId != null">
  161. #{deviceTypeId},
  162. </if>
  163. <if test="installGroupName != null">
  164. #{installGroupName},
  165. </if>
  166. <if test="installGroupHeader != null">
  167. #{installGroupHeader},
  168. </if>
  169. <if test="phone != null">
  170. #{phone},
  171. </if>
  172. <if test="planStartDate != null">
  173. #{planStartDate},
  174. </if>
  175. <if test="planEndDate != null">
  176. #{planEndDate},
  177. </if>
  178. <if test="planStatus != null">
  179. #{planStatus},
  180. </if>
  181. <if test="dateCreate != null">
  182. #{dateCreate},
  183. </if>
  184. <if test="dateUpdate != null">
  185. #{dateUpdate},
  186. </if>
  187. <if test="createBy != null">
  188. #{createBy},
  189. </if>
  190. <if test="updateBy != null">
  191. #{updateBy},
  192. </if>
  193. <if test="status != null">
  194. #{status},
  195. </if>
  196. <if test="remark != null">
  197. #{remark},
  198. </if>
  199. <if test="enableUnit != null">
  200. #{enableUnit},
  201. </if>
  202. <if test="buildingNumber != null">
  203. #{buildingNumber},
  204. </if>
  205. <if test="unitNumber != null">
  206. #{unitNumber},
  207. </if>
  208. <if test="filePath != null">
  209. #{filePath},
  210. </if>
  211. <if test="enableDownload != null">
  212. #{enableDownload},
  213. </if>
  214. <if test="platformType != null">
  215. #{platformType},
  216. </if>
  217. </trim>
  218. </insert>
  219. <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.assistant.InstallPlan">
  220. <!--@mbg.generated-->
  221. update sc_install_plan
  222. <set>
  223. <if test="siteId != null">
  224. site_id = #{siteId},
  225. </if>
  226. <if test="planName != null">
  227. plan_name = #{planName},
  228. </if>
  229. <if test="province != null">
  230. province = #{province},
  231. </if>
  232. <if test="city != null">
  233. city = #{city},
  234. </if>
  235. <if test="region != null">
  236. region = #{region},
  237. </if>
  238. <if test="communityId != null">
  239. community_id = #{communityId},
  240. </if>
  241. <if test="communityName != null">
  242. community_name = #{communityName},
  243. </if>
  244. <if test="preInstallNumber != null">
  245. pre_install_number = #{preInstallNumber},
  246. </if>
  247. <if test="customerId != null">
  248. customer_id = #{customerId},
  249. </if>
  250. <if test="deviceTypeId != null">
  251. device_type_id = #{deviceTypeId},
  252. </if>
  253. <if test="installGroupName != null">
  254. install_group_name = #{installGroupName},
  255. </if>
  256. <if test="installGroupHeader != null">
  257. install_group_header = #{installGroupHeader},
  258. </if>
  259. <if test="phone != null">
  260. phone = #{phone},
  261. </if>
  262. <if test="planStartDate != null">
  263. plan_start_date = #{planStartDate},
  264. </if>
  265. <if test="planEndDate != null">
  266. plan_end_date = #{planEndDate},
  267. </if>
  268. <if test="planStatus != null">
  269. plan_status = #{planStatus},
  270. </if>
  271. <if test="dateCreate != null">
  272. date_create = #{dateCreate},
  273. </if>
  274. <if test="dateUpdate != null">
  275. date_update = #{dateUpdate},
  276. </if>
  277. <if test="createBy != null">
  278. create_by = #{createBy},
  279. </if>
  280. <if test="updateBy != null">
  281. update_by = #{updateBy},
  282. </if>
  283. <if test="status != null">
  284. `status` = #{status},
  285. </if>
  286. <if test="remark != null">
  287. remark = #{remark},
  288. </if>
  289. <if test="enableUnit != null">
  290. enable_unit = #{enableUnit},
  291. </if>
  292. <if test="buildingNumber != null">
  293. building_number = #{buildingNumber},
  294. </if>
  295. <if test="unitNumber != null">
  296. unit_number = #{unitNumber},
  297. </if>
  298. <if test="filePath != null">
  299. file_path = #{filePath},
  300. </if>
  301. <if test="enableDownload != null">
  302. enable_download = #{enableDownload},
  303. </if>
  304. </set>
  305. where id = #{id}
  306. </update>
  307. <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
  308. <!--@mbg.generated-->
  309. insert into sc_install_plan
  310. (site_id, plan_name, province, city, region, community_id, community_name, pre_install_number,
  311. customer_id, device_type_id, install_group_name, install_group_header, phone, plan_start_date,
  312. plan_end_date, plan_status, date_create, date_update, create_by, update_by, `status`,
  313. remark, enable_unit, building_number, unit_number, file_path, enable_download)
  314. values
  315. <foreach collection="list" item="item" separator=",">
  316. (#{item.siteId}, #{item.planName}, #{item.province}, #{item.city}, #{item.region},
  317. #{item.communityId}, #{item.communityName}, #{item.preInstallNumber}, #{item.customerId},
  318. #{item.deviceTypeId}, #{item.installGroupName}, #{item.installGroupHeader}, #{item.phone},
  319. #{item.planStartDate}, #{item.planEndDate}, #{item.planStatus}, #{item.dateCreate},
  320. #{item.dateUpdate}, #{item.createBy}, #{item.updateBy}, #{item.status}, #{item.remark},
  321. #{item.enableUnit}, #{item.buildingNumber}, #{item.unitNumber}, #{item.filePath},
  322. #{item.enableDownload})
  323. </foreach>
  324. </insert>
  325. <select id="getList" resultType="com.bz.smart_city.dto.assistant.InstallPlanDTO">
  326. select
  327. ip.id,
  328. ip.site_id,
  329. ip.plan_name,
  330. ip.province,
  331. ip.city,
  332. ip.region,
  333. ip.community_id,
  334. ip.pre_install_number,
  335. ip.customer_id,
  336. ip.device_type_id,
  337. ip.install_group_name,
  338. ip.install_group_header,
  339. ip.phone,
  340. ip.plan_start_date,
  341. ip.plan_end_date,
  342. ip.plan_status,
  343. ip.date_create,
  344. ip.date_update,
  345. ip.create_by,
  346. ip.update_by,
  347. ip.`status`,
  348. ip.remark,
  349. ip.enable_unit,
  350. ip.building_number,
  351. ip.unit_number,
  352. ip.enable_download,
  353. ip.platform_type,
  354. com.name as community_name,
  355. com.address as address,
  356. cus.customer_name,
  357. dt.equipment_type as device_type_name,
  358. sa1.name as province_name,
  359. sa2.name as city_name,
  360. sa3.name as region_name
  361. from sc_install_plan ip
  362. left join sc_community com on(com.id = ip.community_id)
  363. left join sc_customer cus on(cus.id = ip.customer_id)
  364. left join sc_device_type dt on(dt.id = ip.device_type_id)
  365. left join sc_area sa1 on sa1.id = ip.province
  366. left join sc_area sa2 on sa2.id = ip.city
  367. left join sc_area sa3 on sa3.id = ip.region
  368. where ip.status = 1
  369. <if test="type != null and type != ''"> and ip.platform_type = #{type} </if>
  370. <if test="siteId != null"> and ip.site_id = #{siteId} </if>
  371. <if test="name != null and name != ''"> AND com.name LIKE concat('%',#{name},'%')</if>
  372. <if test="customerList != null and customerList.size() != 0">
  373. and ip.customer_id in <foreach close=")" collection="customerList" item="item" open="(" separator=",">#{item.id} </foreach>
  374. </if>
  375. order by ip.date_create desc
  376. </select>
  377. <select id="findById" resultType="com.bz.smart_city.dto.assistant.InstallPlanDTO">
  378. select
  379. ip.id,
  380. ip.site_id,
  381. ip.plan_name,
  382. ip.province,
  383. ip.city,
  384. ip.region,
  385. ip.community_id,
  386. ip.pre_install_number,
  387. ip.customer_id,
  388. ip.device_type_id,
  389. ip.install_group_name,
  390. ip.install_group_header,
  391. ip.phone,
  392. ip.plan_start_date,
  393. ip.plan_end_date,
  394. ip.plan_status,
  395. ip.date_create,
  396. ip.date_update,
  397. ip.create_by,
  398. ip.update_by,
  399. ip.`status`,
  400. ip.remark,
  401. ip.enable_unit,
  402. ip.file_path,
  403. com.address as address,
  404. com.name as community_name,
  405. cus.customer_name,
  406. dt.equipment_type as device_type_name,
  407. sa1.name as province_name,
  408. sa2.name as city_name,
  409. sa3.name as region_name
  410. from sc_install_plan ip
  411. left join sc_community com on(com.id = ip.community_id)
  412. left join sc_customer cus on(cus.id = ip.customer_id)
  413. left join sc_device_type dt on(dt.id = ip.device_type_id)
  414. left join sc_area sa1 on sa1.id = ip.province
  415. left join sc_area sa2 on sa2.id = ip.city
  416. left join sc_area sa3 on sa3.id = ip.region
  417. where ip.status = 1 and ip.id = #{planId}
  418. </select>
  419. </mapper>