OwnerCarServiceDaoImplMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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
  116. t.status_cd = '0'
  117. <if test="carColor !=null and carColor != ''">
  118. and t.car_color= #{carColor}
  119. </if>
  120. <if test="carBrand !=null and carBrand != ''">
  121. and t.car_brand= #{carBrand}
  122. </if>
  123. <if test="carType !=null and carType != ''">
  124. and t.car_type= #{carType}
  125. </if>
  126. <if test="carNum !=null and carNum != ''">
  127. and t.car_num= #{carNum}
  128. </if>
  129. <if test="carNums !=null">
  130. and t.car_num in
  131. <foreach collection="carNums" item="item" index="index" open="(" close=")" separator=",">
  132. #{item}
  133. </foreach>
  134. </if>
  135. <if test="psId !=null and psId != ''">
  136. and t.ps_id= #{psId}
  137. </if>
  138. <if test="remark !=null and remark != ''">
  139. and t.remark= #{remark}
  140. </if>
  141. <if test="statusCd !=null and statusCd != ''">
  142. and t.status_cd= #{statusCd}
  143. </if>
  144. <if test="ownerId !=null and ownerId != ''">
  145. and t.owner_id= #{ownerId}
  146. </if>
  147. <if test="ownerName !=null and ownerName != ''">
  148. and bow.name= #{ownerName}
  149. </if>
  150. <if test="bId !=null and bId != ''">
  151. and t.b_id= #{bId}
  152. </if>
  153. <if test="userId !=null and userId != ''">
  154. and t.user_id= #{userId}
  155. </if>
  156. <if test="carId !=null and carId != ''">
  157. and t.car_id= #{carId}
  158. </if>
  159. <if test="carIds !=null">
  160. and t.car_id in
  161. <foreach collection="carIds" item="item" index="index" open="(" close=")" separator=",">
  162. #{item}
  163. </foreach>
  164. </if>
  165. <if test="communityId !=null and communityId != ''">
  166. and t.community_id= #{communityId}
  167. </if>
  168. <if test="state !=null and state != ''">
  169. and t.state= #{state}
  170. </if>
  171. <if test="valid == '1'">
  172. and t.end_time &gt; now()
  173. </if>
  174. order by t.create_time desc
  175. <if test="page != -1 and page != null ">
  176. limit #{page}, #{row}
  177. </if>
  178. </select>
  179. <!-- 修改车辆管理信息 add by wuxw 2018-07-03 -->
  180. <update id="updateOwnerCarInfoInstance" parameterType="Map">
  181. update owner_car t set t.status_cd = #{statusCd}
  182. <if test="newBId != null and newBId != ''">
  183. ,t.b_id = #{newBId}
  184. </if>
  185. <if test="carColor !=null and carColor != ''">
  186. , t.car_color= #{carColor}
  187. </if>
  188. <if test="carBrand !=null and carBrand != ''">
  189. , t.car_brand= #{carBrand}
  190. </if>
  191. <if test="carType !=null and carType != ''">
  192. , t.car_type= #{carType}
  193. </if>
  194. <if test="carNum !=null and carNum != ''">
  195. , t.car_num= #{carNum}
  196. </if>
  197. <if test="psId !=null and psId != ''">
  198. , t.ps_id= #{psId}
  199. </if>
  200. <if test="remark !=null and remark != ''">
  201. , t.remark= #{remark}
  202. </if>
  203. <if test="ownerId !=null and ownerId != ''">
  204. , t.owner_id= #{ownerId}
  205. </if>
  206. <if test="userId !=null and userId != ''">
  207. , t.user_id= #{userId}
  208. </if>
  209. <if test="startTime !=null ">
  210. , t.start_time= #{startTime}
  211. </if>
  212. <if test="endTime !=null ">
  213. , t.end_time= #{endTime}
  214. </if>
  215. <if test="state !=null ">
  216. , t.state= #{state}
  217. </if>
  218. where 1=1
  219. <if test="bId !=null and bId != ''">
  220. and t.b_id= #{bId}
  221. </if>
  222. <if test="carId !=null and carId != ''">
  223. and t.car_id= #{carId}
  224. </if>
  225. <if test="communityId !=null and communityId != ''">
  226. and t.community_id= #{communityId}
  227. </if>
  228. </update>
  229. <!-- 查询车辆管理数量 add by wuxw 2018-07-03 -->
  230. <select id="queryOwnerCarsCount" parameterType="Map" resultType="Map">
  231. select count(1) count
  232. from owner_car t
  233. left join building_owner bow on t.owner_id = bow.member_id and bow.status_cd = '0' and bow.community_id = t.community_id
  234. where 1 =1
  235. <if test="carColor !=null and carColor != ''">
  236. and t.car_color= #{carColor}
  237. </if>
  238. <if test="carBrand !=null and carBrand != ''">
  239. and t.car_brand= #{carBrand}
  240. </if>
  241. <if test="carType !=null and carType != ''">
  242. and t.car_type= #{carType}
  243. </if>
  244. <if test="carNum !=null and carNum != ''">
  245. and t.car_num= #{carNum}
  246. </if>
  247. <if test="psId !=null and psId != ''">
  248. and t.ps_id= #{psId}
  249. </if>
  250. <if test="remark !=null and remark != ''">
  251. and t.remark= #{remark}
  252. </if>
  253. <if test="statusCd !=null and statusCd != ''">
  254. and t.status_cd= #{statusCd}
  255. </if>
  256. <if test="ownerId !=null and ownerId != ''">
  257. and t.owner_id= #{ownerId}
  258. </if>
  259. <if test="ownerName !=null and ownerName != ''">
  260. and bow.name= #{ownerName}
  261. </if>
  262. <if test="bId !=null and bId != ''">
  263. and t.b_id= #{bId}
  264. </if>
  265. <if test="userId !=null and userId != ''">
  266. and t.user_id= #{userId}
  267. </if>
  268. <if test="carId !=null and carId != ''">
  269. and t.car_id= #{carId}
  270. </if>
  271. <if test="communityId !=null and communityId != ''">
  272. and t.community_id= #{communityId}
  273. </if>
  274. <if test="state !=null and state != ''">
  275. and t.state= #{state}
  276. </if>
  277. </select>
  278. </mapper>