OwnerCarServiceDaoImplMapper.xml 10 KB

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