OwnerCarServiceDaoImplMapper.xml 14 KB

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