CarInoutDetailV1ServiceDaoImplMapper.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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="carInoutDetailV1ServiceDaoImpl">
  6. <!-- 保存车辆进出明细信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveCarInoutDetailInfo" parameterType="Map">
  8. insert into car_inout_detail(
  9. inout_id,machine_id,machine_code,car_inout,pa_id,detail_id,car_num,community_id
  10. ) values (
  11. #{inoutId},#{machineId},#{machineCode},#{carInout},#{paId},#{detailId},#{carNum},#{communityId}
  12. )
  13. </insert>
  14. <!-- 查询车辆进出明细信息 add by wuxw 2018-07-03 -->
  15. <select id="getCarInoutDetailInfo" parameterType="Map" resultType="Map">
  16. select t.inout_id,t.inout_id inoutId,t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code
  17. machineCode,t.car_inout,t.car_inout carInout,t.pa_id,t.pa_id paId,t.detail_id,t.detail_id
  18. detailId,t.car_num,t.car_num carNum,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,
  19. ci.in_time inTime,ci.out_time outTime,cip.real_charge realCharge,ci.pa_id paId,td.name stateName
  20. from car_inout_detail t
  21. left join car_inout ci on t.inout_id = ci.inout_id and ci.status_cd = '0' and t.community_id = ci.community_id
  22. left join car_inout_payment cip on cip.inout_id = ci.inout_id and cip.community_id = ci.community_id
  23. left join t_dict td on ci.state = td.status_cd and td.table_columns='state' and td.table_name = 'car_inout'
  24. where 1 =1
  25. <if test="inoutId !=null and inoutId != ''">
  26. and t.inout_id= #{inoutId}
  27. </if>
  28. <if test="machineId !=null and machineId != ''">
  29. and t.machine_id= #{machineId}
  30. </if>
  31. <if test="machineCode !=null and machineCode != ''">
  32. and t.machine_code= #{machineCode}
  33. </if>
  34. <if test="carInout !=null and carInout != ''">
  35. and t.car_inout= #{carInout}
  36. </if>
  37. <if test="paId !=null and paId != ''">
  38. and t.pa_id= #{paId}
  39. </if>
  40. <if test="paIds !=null ">
  41. and t.pa_id in
  42. <foreach collection="paIds" item="item" index="index" open="(" close=")" separator=",">
  43. #{item}
  44. </foreach>
  45. </if>
  46. <if test="detailId !=null and detailId != ''">
  47. and t.detail_id= #{detailId}
  48. </if>
  49. <if test="carNum !=null and carNum != ''">
  50. and t.car_num= #{carNum}
  51. </if>
  52. <if test="statusCd !=null and statusCd != ''">
  53. and t.status_cd= #{statusCd}
  54. </if>
  55. <if test="communityId !=null and communityId != ''">
  56. and t.community_id= #{communityId}
  57. </if>
  58. order by t.create_time desc
  59. <if test="page != -1 and page != null ">
  60. limit #{page}, #{row}
  61. </if>
  62. </select>
  63. <!-- 修改车辆进出明细信息 add by wuxw 2018-07-03 -->
  64. <update id="updateCarInoutDetailInfo" parameterType="Map">
  65. update car_inout_detail t set t.status_cd = #{statusCd}
  66. <if test="newBId != null and newBId != ''">
  67. ,t.b_id = #{newBId}
  68. </if>
  69. <if test="inoutId !=null and inoutId != ''">
  70. , t.inout_id= #{inoutId}
  71. </if>
  72. <if test="machineId !=null and machineId != ''">
  73. , t.machine_id= #{machineId}
  74. </if>
  75. <if test="machineCode !=null and machineCode != ''">
  76. , t.machine_code= #{machineCode}
  77. </if>
  78. <if test="carInout !=null and carInout != ''">
  79. , t.car_inout= #{carInout}
  80. </if>
  81. <if test="paId !=null and paId != ''">
  82. , t.pa_id= #{paId}
  83. </if>
  84. <if test="carNum !=null and carNum != ''">
  85. , t.car_num= #{carNum}
  86. </if>
  87. <if test="communityId !=null and communityId != ''">
  88. , t.community_id= #{communityId}
  89. </if>
  90. where 1=1
  91. <if test="detailId !=null and detailId != ''">
  92. and t.detail_id= #{detailId}
  93. </if>
  94. </update>
  95. <!-- 查询车辆进出明细数量 add by wuxw 2018-07-03 -->
  96. <select id="queryCarInoutDetailsCount" parameterType="Map" resultType="Map">
  97. select count(1) count
  98. from car_inout_detail t
  99. left join car_inout ci on t.inout_id = ci.inout_id and ci.status_cd = '0' and t.community_id = ci.community_id
  100. left join car_inout_payment cip on cip.inout_id = ci.inout_id and cip.community_id = ci.community_id
  101. where 1 = 1
  102. <if test="inoutId !=null and inoutId != ''">
  103. and t.inout_id= #{inoutId}
  104. </if>
  105. <if test="machineId !=null and machineId != ''">
  106. and t.machine_id= #{machineId}
  107. </if>
  108. <if test="machineCode !=null and machineCode != ''">
  109. and t.machine_code= #{machineCode}
  110. </if>
  111. <if test="carInout !=null and carInout != ''">
  112. and t.car_inout= #{carInout}
  113. </if>
  114. <if test="paId !=null and paId != ''">
  115. and t.pa_id= #{paId}
  116. </if>
  117. <if test="paIds !=null ">
  118. and t.pa_id in
  119. <foreach collection="paIds" item="item" index="index" open="(" close=")" separator=",">
  120. #{item}
  121. </foreach>
  122. </if>
  123. <if test="detailId !=null and detailId != ''">
  124. and t.detail_id= #{detailId}
  125. </if>
  126. <if test="carNum !=null and carNum != ''">
  127. and t.car_num= #{carNum}
  128. </if>
  129. <if test="statusCd !=null and statusCd != ''">
  130. and t.status_cd= #{statusCd}
  131. </if>
  132. <if test="communityId !=null and communityId != ''">
  133. and t.community_id= #{communityId}
  134. </if>
  135. </select>
  136. </mapper>