OwnerCarServiceDaoImplMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="ownerCarServiceDaoImpl">
  6. <!-- 保存车辆管理信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessOwnerCarInfo" parameterType="Map">
  8. insert into business_owner_car(
  9. car_color,car_brand,car_type,operate,car_num,ps_id,remark,owner_id,b_id,user_id,car_id,community_id,start_time,end_time,state
  10. ) values (
  11. #{carColor},#{carBrand},#{carType},#{operate},#{carNum},#{psId},#{remark},#{ownerId},#{bId},#{userId},#{carId},#{communityId},
  12. #{startTime},#{endTime},#{state}
  13. )
  14. </insert>
  15. <!-- 查询车辆管理信息(Business) add by wuxw 2018-07-03 -->
  16. <select id="getBusinessOwnerCarInfo" parameterType="Map" resultType="Map">
  17. select t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type
  18. carType,t.operate,t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.owner_id,t.owner_id
  19. ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId,t.community_id,t.community_id
  20. communityId,t.start_time,t.end_time,t.state,t.start_time startTime,t.end_time endTime
  21. from business_owner_car t
  22. where 1 =1
  23. <if test="carColor !=null and carColor != ''">
  24. and t.car_color= #{carColor}
  25. </if>
  26. <if test="carBrand !=null and carBrand != ''">
  27. and t.car_brand= #{carBrand}
  28. </if>
  29. <if test="carType !=null and carType != ''">
  30. and t.car_type= #{carType}
  31. </if>
  32. <if test="operate !=null and operate != ''">
  33. and t.operate= #{operate}
  34. </if>
  35. <if test="carNum !=null and carNum != ''">
  36. and t.car_num= #{carNum}
  37. </if>
  38. <if test="psId !=null and psId != ''">
  39. and t.ps_id= #{psId}
  40. </if>
  41. <if test="remark !=null and remark != ''">
  42. and t.remark= #{remark}
  43. </if>
  44. <if test="ownerId !=null and ownerId != ''">
  45. and t.owner_id= #{ownerId}
  46. </if>
  47. <if test="bId !=null and bId != ''">
  48. and t.b_id= #{bId}
  49. </if>
  50. <if test="userId !=null and userId != ''">
  51. and t.user_id= #{userId}
  52. </if>
  53. <if test="carId !=null and carId != ''">
  54. and t.car_id= #{carId}
  55. </if>
  56. <if test="communityId !=null and communityId != ''">
  57. and t.community_id= #{communityId}
  58. </if>
  59. </select>
  60. <!-- 保存车辆管理信息至 instance表中 add by wuxw 2018-07-03 -->
  61. <insert id="saveOwnerCarInfoInstance" parameterType="Map">
  62. insert into owner_car(
  63. car_color,car_brand,car_type,car_num,ps_id,remark,status_cd,owner_id,b_id,user_id,car_id,community_id,start_time,end_time,state
  64. ) select
  65. t.car_color,t.car_brand,t.car_type,t.car_num,t.ps_id,t.remark,'0',t.owner_id,t.b_id,t.user_id,t.car_id,t.community_id,t.start_time,t.end_time,t.state
  66. from business_owner_car t where 1=1
  67. <if test="carColor !=null and carColor != ''">
  68. and t.car_color= #{carColor}
  69. </if>
  70. <if test="carBrand !=null and carBrand != ''">
  71. and t.car_brand= #{carBrand}
  72. </if>
  73. <if test="carType !=null and carType != ''">
  74. and t.car_type= #{carType}
  75. </if>
  76. and t.operate= 'ADD'
  77. <if test="carNum !=null and carNum != ''">
  78. and t.car_num= #{carNum}
  79. </if>
  80. <if test="psId !=null and psId != ''">
  81. and t.ps_id= #{psId}
  82. </if>
  83. <if test="remark !=null and remark != ''">
  84. and t.remark= #{remark}
  85. </if>
  86. <if test="ownerId !=null and ownerId != ''">
  87. and t.owner_id= #{ownerId}
  88. </if>
  89. <if test="bId !=null and bId != ''">
  90. and t.b_id= #{bId}
  91. </if>
  92. <if test="userId !=null and userId != ''">
  93. and t.user_id= #{userId}
  94. </if>
  95. <if test="carId !=null and carId != ''">
  96. and t.car_id= #{carId}
  97. </if>
  98. <if test="communityId !=null and communityId != ''">
  99. and t.community_id= #{communityId}
  100. </if>
  101. </insert>
  102. <!-- 查询车辆管理信息 add by wuxw 2018-07-03 -->
  103. <select id="getOwnerCarInfo" parameterType="Map" resultType="Map">
  104. select t.car_color,t.car_color carColor,t.car_brand,t.car_brand carBrand,t.car_type,t.car_type carType,t1.name
  105. carTypeName,
  106. t.car_num,t.car_num carNum,t.ps_id,t.ps_id psId,t.remark,t.status_cd,t.status_cd statusCd,t.owner_id,
  107. t.owner_id ownerId,t.b_id,t.b_id bId,t.user_id,t.user_id userId,t.car_id,t.car_id carId ,t.create_time
  108. createTime,t.community_id communityId,bow.name ownerName,bow.id_card idCard,bow.link,t2.name stateName,
  109. t.start_time,t.start_time startTime,t.end_time,t.end_time endTime,t.state
  110. from owner_car t
  111. left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
  112. left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
  113. left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id =
  114. t.community_id
  115. where 1=1
  116. <if test="statusCd !=null and statusCd != ''">
  117. and t.status_cd = #{statusCd}
  118. </if>
  119. <if test="carColor !=null and carColor != ''">
  120. and t.car_color= #{carColor}
  121. </if>
  122. <if test="carBrand !=null and carBrand != ''">
  123. and t.car_brand= #{carBrand}
  124. </if>
  125. <if test="carType !=null and carType != ''">
  126. and t.car_type= #{carType}
  127. </if>
  128. <if test="carNum !=null and carNum != ''">
  129. and t.car_num= #{carNum}
  130. </if>
  131. <if test="carNums !=null">
  132. and t.car_num in
  133. <foreach collection="carNums" item="item" index="index" open="(" close=")" separator=",">
  134. #{item}
  135. </foreach>
  136. </if>
  137. <if test="psId !=null and psId != ''">
  138. and t.ps_id= #{psId}
  139. </if>
  140. <if test="psIds !=null">
  141. and t.ps_id in
  142. <foreach collection="psIds" item="item" index="index" open="(" close=")" separator=",">
  143. #{item}
  144. </foreach>
  145. </if>
  146. <if test="remark !=null and remark != ''">
  147. and t.remark= #{remark}
  148. </if>
  149. <if test="statusCd !=null and statusCd != ''">
  150. and t.status_cd= #{statusCd}
  151. </if>
  152. <if test="ownerId !=null and ownerId != ''">
  153. and t.owner_id= #{ownerId}
  154. </if>
  155. <if test="ownerName !=null and ownerName != ''">
  156. and bow.name like '%${ownerName}%'
  157. </if>
  158. <if test="bId !=null and bId != ''">
  159. and t.b_id= #{bId}
  160. </if>
  161. <if test="carId !=null and carId != ''">
  162. and t.car_id= #{carId}
  163. </if>
  164. <if test="carIds !=null">
  165. and t.car_id in
  166. <foreach collection="carIds" item="item" index="index" open="(" close=")" separator=",">
  167. #{item}
  168. </foreach>
  169. </if>
  170. <if test="communityId !=null and communityId != ''">
  171. and t.community_id= #{communityId}
  172. </if>
  173. <if test="state !=null and state != ''">
  174. and t.state= #{state}
  175. </if>
  176. <if test="valid == '1'">
  177. and t.end_time &gt; now()
  178. </if>
  179. order by t.create_time desc
  180. <if test="page != -1 and page != null ">
  181. limit #{page}, #{row}
  182. </if>
  183. </select>
  184. <!-- 修改车辆管理信息 add by wuxw 2018-07-03 -->
  185. <update id="updateOwnerCarInfoInstance" parameterType="Map">
  186. update owner_car t set t.status_cd = #{statusCd}
  187. <if test="newBId != null and newBId != ''">
  188. ,t.b_id = #{newBId}
  189. </if>
  190. <if test="carColor !=null and carColor != ''">
  191. , t.car_color= #{carColor}
  192. </if>
  193. <if test="carBrand !=null and carBrand != ''">
  194. , t.car_brand= #{carBrand}
  195. </if>
  196. <if test="carType !=null and carType != ''">
  197. , t.car_type= #{carType}
  198. </if>
  199. <if test="carNum !=null and carNum != ''">
  200. , t.car_num= #{carNum}
  201. </if>
  202. <if test="psId !=null and psId != ''">
  203. , t.ps_id= #{psId}
  204. </if>
  205. <if test="remark !=null and remark != ''">
  206. , t.remark= #{remark}
  207. </if>
  208. <if test="ownerId !=null and ownerId != ''">
  209. , t.owner_id= #{ownerId}
  210. </if>
  211. <if test="userId !=null and userId != ''">
  212. , t.user_id= #{userId}
  213. </if>
  214. <if test="startTime !=null ">
  215. , t.start_time= #{startTime}
  216. </if>
  217. <if test="endTime !=null ">
  218. , t.end_time= #{endTime}
  219. </if>
  220. <if test="state !=null ">
  221. , t.state= #{state}
  222. </if>
  223. where 1=1
  224. <if test="bId !=null and bId != ''">
  225. and t.b_id= #{bId}
  226. </if>
  227. <if test="carId !=null and carId != ''">
  228. and t.car_id= #{carId}
  229. </if>
  230. <if test="communityId !=null and communityId != ''">
  231. and t.community_id= #{communityId}
  232. </if>
  233. </update>
  234. <!-- 查询车辆管理数量 add by wuxw 2018-07-03 -->
  235. <select id="queryOwnerCarsCount" parameterType="Map" resultType="Map">
  236. select count(1) count
  237. from owner_car t
  238. left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
  239. left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
  240. left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id =
  241. t.community_id
  242. where 1=1
  243. <if test="statusCd !=null and statusCd != ''">
  244. and t.status_cd = #{statusCd}
  245. </if>
  246. <if test="carColor !=null and carColor != ''">
  247. and t.car_color= #{carColor}
  248. </if>
  249. <if test="carBrand !=null and carBrand != ''">
  250. and t.car_brand= #{carBrand}
  251. </if>
  252. <if test="carType !=null and carType != ''">
  253. and t.car_type= #{carType}
  254. </if>
  255. <if test="carNum !=null and carNum != ''">
  256. and t.car_num= #{carNum}
  257. </if>
  258. <if test="carNums !=null">
  259. and t.car_num in
  260. <foreach collection="carNums" item="item" index="index" open="(" close=")" separator=",">
  261. #{item}
  262. </foreach>
  263. </if>
  264. <if test="psId !=null and psId != ''">
  265. and t.ps_id= #{psId}
  266. </if>
  267. <if test="remark !=null and remark != ''">
  268. and t.remark= #{remark}
  269. </if>
  270. <if test="statusCd !=null and statusCd != ''">
  271. and t.status_cd= #{statusCd}
  272. </if>
  273. <if test="ownerId !=null and ownerId != ''">
  274. and t.owner_id= #{ownerId}
  275. </if>
  276. <if test="ownerName !=null and ownerName != ''">
  277. and bow.name like '%${ownerName}%'
  278. </if>
  279. <if test="bId !=null and bId != ''">
  280. and t.b_id= #{bId}
  281. </if>
  282. <if test="carId !=null and carId != ''">
  283. and t.car_id= #{carId}
  284. </if>
  285. <if test="carIds !=null">
  286. and t.car_id in
  287. <foreach collection="carIds" item="item" index="index" open="(" close=")" separator=",">
  288. #{item}
  289. </foreach>
  290. </if>
  291. <if test="communityId !=null and communityId != ''">
  292. and t.community_id= #{communityId}
  293. </if>
  294. <if test="state !=null and state != ''">
  295. and t.state= #{state}
  296. </if>
  297. <if test="valid == '1'">
  298. and t.end_time &gt; now()
  299. </if>
  300. </select>
  301. </mapper>