VisitServiceDaoImplMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="visitServiceDaoImpl">
  5. <!-- 保存访客信息信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessVisitInfo" parameterType="Map">
  7. insert into business_visit_info(departure_time, v_name, visit_gender, owner_id, user_id, v_id, phone_number,
  8. operate, visit_case, community_id, b_id, visit_time, car_num, entourage,
  9. reason_type, state, state_remark, ps_id, free_time, record_state)
  10. values (#{departureTime}, #{vName}, #{visitGender}, #{ownerId}, #{userId}, #{vId}, #{phoneNumber}, #{operate},
  11. #{visitCase}, #{communityId}, #{bId}, #{visitTime}, #{carNum}, #{entourage}, #{reasonType}, #{state},
  12. #{stateRemark}, #{psId}, #{freeTime}, #{recordState})
  13. </insert>
  14. <!-- 查询访客信息信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessVisitInfo" parameterType="Map" resultType="Map">
  16. select t.departure_time,t.departure_time departureTime,t.v_name,t.v_name vName,t.visit_gender,t.visit_gender
  17. visitGender,t.owner_id,t.owner_id ownerId,t.user_id,t.user_id userId,t.v_id,t.v_id vId,t.visit_time,t.visit_time
  18. visitTime,t.phone_number,t.phone_number phoneNumber,t.operate,t.visit_case,t.visit_case
  19. visitCase,t.community_id,t.community_id communityId,t.b_id,t.b_id ,t.car_num,t.car_num carNum,t.entourage,
  20. t.reason_type,t.reason_type reasonType,t.state,t.state_remark,t.state_remark
  21. stateRemark,t.create_time,t.create_time createTime,t.ps_id,t.ps_id psId,t.free_time,t.free_time freeTime,
  22. t.record_state,t.record_state recordState
  23. from business_visit_info t
  24. where 1 =1
  25. <if test="departureTime !=null ">
  26. and t.departure_time= #{departureTime}
  27. </if>
  28. <if test="vName !=null and vName != ''">
  29. and t.v_name= #{vName}
  30. </if>
  31. <if test="visitGender !=null and visitGender != ''">
  32. and t.visit_gender= #{visitGender}
  33. </if>
  34. <if test="ownerId !=null and ownerId != ''">
  35. and t.owner_id= #{ownerId}
  36. </if>
  37. <if test="userId !=null and userId != ''">
  38. and t.user_id= #{userId}
  39. </if>
  40. <if test="vId !=null and vId != ''">
  41. and t.v_id= #{vId}
  42. </if>
  43. <if test="visitTime !=null ">
  44. and t.visit_time= #{visitTime}
  45. </if>
  46. <if test="freeTime !=null ">
  47. and t.free_time= #{freeTime}
  48. </if>
  49. <if test="phoneNumber !=null and phoneNumber != ''">
  50. and t.phone_number= #{phoneNumber}
  51. </if>
  52. <if test="operate !=null and operate != ''">
  53. and t.operate= #{operate}
  54. </if>
  55. <if test="visitCase !=null and visitCase != ''">
  56. and t.visit_case= #{visitCase}
  57. </if>
  58. <if test="carNum !=null and carNum != ''">
  59. and t.car_num= #{carNum}
  60. </if>
  61. <if test="entourage !=null and entourage != ''">
  62. and t.entourage= #{entourage}
  63. </if>
  64. <if test="reasonType !=null and reasonType != ''">
  65. and t.reason_type= #{reasonType}
  66. </if>
  67. <if test="recordState !=null and recordState != ''">
  68. and t.record_state= #{recordState}
  69. </if>
  70. <if test="state !=null and state != ''">
  71. and t.state= #{state}
  72. </if>
  73. <if test="stateRemark !=null and stateRemark != ''">
  74. and t.state_remark= #{stateRemark}
  75. </if>
  76. <if test="psId !=null and psId != ''">
  77. and t.ps_id= #{psId}
  78. </if>
  79. <if test="communityId !=null and communityId != ''">
  80. and t.community_id= #{communityId}
  81. </if>
  82. <if test="bId !=null and bId != ''">
  83. and t.b_id= #{bId}
  84. </if>
  85. </select>
  86. <!-- 保存访客信息信息至 instance表中 add by wuxw 2018-07-03 -->
  87. <insert id="saveVisitInfoInstance" parameterType="Map">
  88. insert into s_visit_info(
  89. departure_time,v_name,status_cd,visit_gender,owner_id,user_id,v_id,visit_time,phone_number,visit_case,community_id,b_id,car_num,
  90. entourage,reason_type,state,state_remark,ps_id,free_time,record_state
  91. ) select
  92. t.departure_time,t.v_name,'0',t.visit_gender,t.owner_id,t.user_id,t.v_id,t.visit_time,t.phone_number,t.visit_case,t.community_id,t.b_id,
  93. t.car_num,t.entourage,t.reason_type,t.state,t.state_remark,t.ps_id,t.free_time,t.record_state
  94. from business_visit_info t where 1=1
  95. <if test="departureTime !=null ">
  96. and t.departure_time= #{departureTime}
  97. </if>
  98. <if test="vName !=null and vName != ''">
  99. and t.v_name= #{vName}
  100. </if>
  101. <if test="visitGender !=null and visitGender != ''">
  102. and t.visit_gender= #{visitGender}
  103. </if>
  104. <if test="ownerId !=null and ownerId != ''">
  105. and t.owner_id= #{ownerId}
  106. </if>
  107. <if test="userId !=null and userId != ''">
  108. and t.user_id= #{userId}
  109. </if>
  110. <if test="vId !=null and vId != ''">
  111. and t.v_id= #{vId}
  112. </if>
  113. <if test="visitTime !=null ">
  114. and t.visit_time= #{visitTime}
  115. </if>
  116. <if test="freeTime !=null ">
  117. and t.free_time= #{freeTime}
  118. </if>
  119. <if test="phoneNumber !=null and phoneNumber != ''">
  120. and t.phone_number= #{phoneNumber}
  121. </if>
  122. <if test="carNum !=null and carNum != ''">
  123. and t.car_num= #{carNum}
  124. </if>
  125. <if test="entourage !=null and entourage != ''">
  126. and t.entourage= #{entourage}
  127. </if>
  128. <if test="reasonType !=null and reasonType != ''">
  129. and t.reason_type= #{reasonType}
  130. </if>
  131. <if test="recordState !=null and recordState != ''">
  132. and t.record_state= #{recordState}
  133. </if>
  134. <if test="state !=null and state != ''">
  135. and t.state= #{state}
  136. </if>
  137. <if test="stateRemark !=null and stateRemark != ''">
  138. and t.state_remark= #{stateRemark}
  139. </if>
  140. <if test="psId !=null and psId != ''">
  141. and t.ps_id= #{psId}
  142. </if>
  143. and t.operate= 'ADD'
  144. <if test="visitCase !=null and visitCase != ''">
  145. and t.visit_case= #{visitCase}
  146. </if>
  147. <if test="communityId !=null and communityId != ''">
  148. and t.community_id= #{communityId}
  149. </if>
  150. <if test="bId !=null and bId != ''">
  151. and t.b_id= #{bId}
  152. </if>
  153. </insert>
  154. <!-- 查询访客信息信息 add by wuxw 2018-07-03 -->
  155. <select id="getVisitInfo" parameterType="Map" resultType="Map">
  156. select t.departure_time,t.departure_time departureTime,t.v_name,t.v_name vName,t.status_cd,t.status_cd
  157. statusCd,t.visit_gender,t.visit_gender visitGender,t.owner_id,t.owner_id ownerId,t.user_id,t.user_id
  158. userId,t.v_id,t.v_id vId,t.visit_time,t.visit_time visitTime,t.phone_number,t.phone_number
  159. phoneNumber,t.visit_case,t.visit_case visitCase,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  160. t.car_num,t.car_num carNum,t.entourage,t.reason_type,t.reason_type
  161. reasonType,t.state,t.state_remark,t.state_remark stateRemark,td.name stateName,t.create_time,
  162. t.create_time createTime,t.ps_id,t.ps_id psId,t.free_time,t.free_time freeTime,
  163. t.record_state,t.record_state recordState,ps.num parkingSpaceNum,pa.num parkingAreaName,bo.name ownerName,
  164. fr.file_real_name fileRealName,fr.file_save_name fileSaveName
  165. from s_visit_info t
  166. left join t_dict td on t.state = td.status_cd and td.table_name = 's_visit_info' and td.table_columns = 'state'
  167. left join parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
  168. left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
  169. left join building_owner bo on t.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  170. left join file_rel fr on fr.obj_id = t.v_id and fr.status_cd = '0'
  171. where 1 = 1
  172. <if test="departureTime !=null ">
  173. and t.departure_time= #{departureTime}
  174. </if>
  175. <if test="vName !=null and vName != ''">
  176. and t.v_name= #{vName}
  177. </if>
  178. <if test="statusCd !=null and statusCd != ''">
  179. and t.status_cd= #{statusCd}
  180. </if>
  181. <if test="visitGender !=null and visitGender != ''">
  182. and t.visit_gender= #{visitGender}
  183. </if>
  184. <if test="ownerId !=null and ownerId != ''">
  185. and t.owner_id= #{ownerId}
  186. </if>
  187. <if test="vId !=null and vId != ''">
  188. and t.v_id= #{vId}
  189. </if>
  190. <if test="visitTime !=null ">
  191. and t.visit_time= #{visitTime}
  192. </if>
  193. <if test="freeTime !=null ">
  194. and t.free_time= #{freeTime}
  195. </if>
  196. <if test="phoneNumber !=null and phoneNumber != ''">
  197. and t.phone_number= #{phoneNumber}
  198. </if>
  199. <if test="visitCase !=null and visitCase != ''">
  200. and t.visit_case= #{visitCase}
  201. </if>
  202. <if test="communityId !=null and communityId != ''">
  203. and t.community_id= #{communityId}
  204. </if>
  205. <if test="bId !=null and bId != ''">
  206. and t.b_id= #{bId}
  207. </if>
  208. <if test="visitStartTime !=null and visitStartTime !='' ">
  209. and t.visit_time &gt;= #{visitStartTime}
  210. </if>
  211. <if test="visitEndTime !=null and visitEndTime !='' ">
  212. and t.visit_time &lt;= #{visitEndTime}
  213. </if>
  214. <if test="departureEndTime != null and departureEndTime != ''">
  215. and t.departure_time &lt;= #{departureEndTime}
  216. </if>
  217. <if test="carNum !=null and carNum != ''">
  218. and t.car_num= #{carNum}
  219. </if>
  220. <if test="entourage !=null and entourage != ''">
  221. and t.entourage= #{entourage}
  222. </if>
  223. <if test="reasonType !=null and reasonType != ''">
  224. and t.reason_type= #{reasonType}
  225. </if>
  226. <if test="recordState !=null and recordState != ''">
  227. and t.record_state= #{recordState}
  228. </if>
  229. <if test="psId !=null and psId != ''">
  230. and t.ps_id= #{psId}
  231. </if>
  232. <if test="state !=null and state != ''">
  233. and t.state= #{state}
  234. </if>
  235. <if test="stateRemark !=null and stateRemark != ''">
  236. and t.state_remark= #{stateRemark}
  237. </if>
  238. <if test="carNumNoEmpty !=null and carNumNoEmpty != ''">
  239. and t.car_num!= ""
  240. </if>
  241. <if test="sameDay !=null and sameDay != ''">
  242. and TO_DAYS(t.create_time) = TO_DAYS(NOW())
  243. </if>
  244. <if test="flag != null and flag == '1'">
  245. and t.ps_id != '' and t.ps_id != '-1' and t.ps_id is not null
  246. </if>
  247. order by t.create_time desc
  248. <if test="page != -1 and page != null ">
  249. limit #{page}, #{row}
  250. </if>
  251. </select>
  252. <!-- 修改访客信息信息 add by wuxw 2018-07-03 -->
  253. <update id="updateVisitInfoInstance" parameterType="Map">
  254. update s_visit_info t set t.status_cd = #{statusCd}
  255. <if test="newBId != null and newBId != ''">
  256. ,t.b_id = #{newBId}
  257. </if>
  258. <if test="departureTime !=null ">
  259. , t.departure_time= #{departureTime}
  260. </if>
  261. <if test="vName !=null and vName != ''">
  262. , t.v_name= #{vName}
  263. </if>
  264. <if test="visitGender !=null and visitGender != ''">
  265. , t.visit_gender= #{visitGender}
  266. </if>
  267. <if test="ownerId !=null and ownerId != ''">
  268. , t.owner_id= #{ownerId}
  269. </if>
  270. <if test="userId !=null and userId != ''">
  271. , t.user_id= #{userId}
  272. </if>
  273. <if test="visitTime !=null ">
  274. , t.visit_time= #{visitTime}
  275. </if>
  276. <if test="freeTime !=null ">
  277. , t.free_time= #{freeTime}
  278. </if>
  279. <if test="phoneNumber !=null and phoneNumber != ''">
  280. , t.phone_number= #{phoneNumber}
  281. </if>
  282. <if test="visitCase !=null and visitCase != ''">
  283. , t.visit_case= #{visitCase}
  284. </if>
  285. <if test="communityId !=null and communityId != ''">
  286. , t.community_id= #{communityId}
  287. </if>
  288. <if test="carNum !=null and carNum != ''">
  289. , t.car_num= #{carNum}
  290. </if>
  291. <if test="entourage !=null and entourage != ''">
  292. , t.entourage= #{entourage}
  293. </if>
  294. <if test="reasonType !=null and reasonType != ''">
  295. , t.reason_type= #{reasonType}
  296. </if>
  297. <if test="recordState !=null and recordState != ''">
  298. , t.record_state= #{recordState}
  299. </if>
  300. <if test="state !=null and state != ''">
  301. , t.state= #{state}
  302. </if>
  303. <if test="stateRemark !=null and stateRemark != ''">
  304. , t.state_remark= #{stateRemark}
  305. </if>
  306. <if test="psId !=null and psId != ''">
  307. , t.ps_id= #{psId}
  308. </if>
  309. where 1=1
  310. <if test="vId !=null and vId != ''">
  311. and t.v_id= #{vId}
  312. </if>
  313. <if test="bId !=null and bId != ''">
  314. and t.b_id= #{bId}
  315. </if>
  316. </update>
  317. <!-- 查询访客信息数量 add by wuxw 2018-07-03 -->
  318. <select id="queryVisitsCount" parameterType="Map" resultType="Map">
  319. select count(1) count
  320. from s_visit_info t
  321. left join t_dict td on t.state = td.status_cd and td.table_name = 's_visit_info' and td.table_columns = 'state'
  322. left join parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
  323. left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
  324. left join building_owner bo on t.owner_id = bo.owner_id and bo.owner_type_cd = '1001' and bo.status_cd = '0'
  325. left join file_rel fr on fr.obj_id = t.v_id and fr.status_cd = '0'
  326. where 1 = 1
  327. <if test="departureTime !=null ">
  328. and t.departure_time= #{departureTime}
  329. </if>
  330. <if test="vName !=null and vName != ''">
  331. and t.v_name= #{vName}
  332. </if>
  333. <if test="statusCd !=null and statusCd != ''">
  334. and t.status_cd= #{statusCd}
  335. </if>
  336. <if test="visitGender !=null and visitGender != ''">
  337. and t.visit_gender= #{visitGender}
  338. </if>
  339. <if test="ownerId !=null and ownerId != ''">
  340. and t.owner_id= #{ownerId}
  341. </if>
  342. <if test="userId !=null and userId != ''">
  343. and t.user_id= #{userId}
  344. </if>
  345. <if test="vId !=null and vId != ''">
  346. and t.v_id= #{vId}
  347. </if>
  348. <if test="visitTime !=null ">
  349. and t.visit_time= #{visitTime}
  350. </if>
  351. <if test="freeTime !=null ">
  352. and t.free_time= #{freeTime}
  353. </if>
  354. <if test="phoneNumber !=null and phoneNumber != ''">
  355. and t.phone_number= #{phoneNumber}
  356. </if>
  357. <if test="visitCase !=null and visitCase != ''">
  358. and t.visit_case= #{visitCase}
  359. </if>
  360. <if test="communityId !=null and communityId != ''">
  361. and t.community_id= #{communityId}
  362. </if>
  363. <if test="bId !=null and bId != ''">
  364. and t.b_id= #{bId}
  365. </if>
  366. <if test="visitStartTime !=null and visitStartTime !='' ">
  367. and t.visit_time &gt;= #{visitStartTime}
  368. </if>
  369. <if test="visitEndTime !=null and visitEndTime !='' ">
  370. and t.visit_time &lt;= #{visitEndTime}
  371. </if>
  372. <if test="carNum !=null and carNum != ''">
  373. and t.car_num= #{carNum}
  374. </if>
  375. <if test="entourage !=null and entourage != ''">
  376. and t.entourage= #{entourage}
  377. </if>
  378. <if test="reasonType !=null and reasonType != ''">
  379. and t.reason_type= #{reasonType}
  380. </if>
  381. <if test="recordState !=null and recordState != ''">
  382. and t.record_state= #{recordState}
  383. </if>
  384. <if test="state !=null and state != ''">
  385. and t.state= #{state}
  386. </if>
  387. <if test="stateRemark !=null and stateRemark != ''">
  388. and t.state_remark= #{stateRemark}
  389. </if>
  390. <if test="psId !=null and psId != ''">
  391. and t.ps_id= #{psId}
  392. </if>
  393. </select>
  394. </mapper>