FeeAttrServiceDaoImplMapper.xml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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="feeAttrServiceDaoImpl">
  6. <!-- 保存费用属性信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessFeeAttrInfo" parameterType="Map">
  8. insert into business_pay_fee_attrs(
  9. attr_id,operate,spec_cd,community_id,b_id,fee_id,value
  10. ) values (
  11. #{attrId},#{operate},#{specCd},#{communityId},#{bId},#{feeId},#{value}
  12. )
  13. </insert>
  14. <!-- 查询费用属性信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessFeeAttrInfo" parameterType="Map" resultType="Map">
  16. select t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd specCd,t.community_id,t.community_id
  17. communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.value
  18. from business_pay_fee_attrs t
  19. where 1 =1
  20. <if test="attrId !=null and attrId != ''">
  21. and t.attr_id= #{attrId}
  22. </if>
  23. <if test="operate !=null and operate != ''">
  24. and t.operate= #{operate}
  25. </if>
  26. <if test="specCd !=null and specCd != ''">
  27. and t.spec_cd= #{specCd}
  28. </if>
  29. <if test="communityId !=null and communityId != ''">
  30. and t.community_id= #{communityId}
  31. </if>
  32. <if test="bId !=null and bId != ''">
  33. and t.b_id= #{bId}
  34. </if>
  35. <if test="feeId !=null and feeId != ''">
  36. and t.fee_id= #{feeId}
  37. </if>
  38. <if test="value !=null and value != ''">
  39. and t.value= #{value}
  40. </if>
  41. </select>
  42. <!-- 保存费用属性信息至 instance表中 add by wuxw 2018-07-03 -->
  43. <insert id="saveFeeAttrInfoInstance" parameterType="Map">
  44. insert into pay_fee_attrs(
  45. attr_id,spec_cd,status_cd,community_id,b_id,fee_id,value
  46. ) select t.attr_id,t.spec_cd,'0',t.community_id,t.b_id,t.fee_id,t.value from business_pay_fee_attrs t where 1=1
  47. <if test="attrId !=null and attrId != ''">
  48. and t.attr_id= #{attrId}
  49. </if>
  50. and t.operate= 'ADD'
  51. <if test="specCd !=null and specCd != ''">
  52. and t.spec_cd= #{specCd}
  53. </if>
  54. <if test="communityId !=null and communityId != ''">
  55. and t.community_id= #{communityId}
  56. </if>
  57. <if test="bId !=null and bId != ''">
  58. and t.b_id= #{bId}
  59. </if>
  60. <if test="feeId !=null and feeId != ''">
  61. and t.fee_id= #{feeId}
  62. </if>
  63. <if test="value !=null and value != ''">
  64. and t.value= #{value}
  65. </if>
  66. </insert>
  67. <!-- 查询费用属性信息 add by wuxw 2018-07-03 -->
  68. <select id="getFeeAttrInfo" parameterType="Map" resultType="Map">
  69. select t.attr_id,t.attr_id attrId,t.spec_cd,t.spec_cd specCd,t.status_cd,t.status_cd
  70. statusCd,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.value,
  71. td.name specCdName
  72. from pay_fee_attrs t
  73. left join t_dict td on t.spec_cd = td.status_cd and td.table_name = 'pay_fee_attrs' and td.table_columns = 'spec_cd'
  74. where 1 =1
  75. <if test="attrId !=null and attrId != ''">
  76. and t.attr_id= #{attrId}
  77. </if>
  78. <if test="specCd !=null and specCd != ''">
  79. and t.spec_cd= #{specCd}
  80. </if>
  81. <if test="statusCd !=null and statusCd != ''">
  82. and t.status_cd= #{statusCd}
  83. </if>
  84. <if test="communityId !=null and communityId != ''">
  85. and t.community_id= #{communityId}
  86. </if>
  87. <if test="bId !=null and bId != ''">
  88. and t.b_id= #{bId}
  89. </if>
  90. <if test="feeId !=null and feeId != ''">
  91. and t.fee_id= #{feeId}
  92. </if>
  93. <if test="feeIds !=null">
  94. and t.fee_id in
  95. <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
  96. #{item}
  97. </foreach>
  98. </if>
  99. <if test="value !=null and value != ''">
  100. and t.value= #{value}
  101. </if>
  102. <if test="page != -1 and page != null ">
  103. limit #{page}, #{row}
  104. </if>
  105. </select>
  106. <!-- 修改费用属性信息 add by wuxw 2018-07-03 -->
  107. <update id="updateFeeAttrInfoInstance" parameterType="Map">
  108. update pay_fee_attrs t set t.status_cd = #{statusCd}
  109. <if test="newBId != null and newBId != ''">
  110. ,t.b_id = #{newBId}
  111. </if>
  112. <if test="value !=null and value != ''">
  113. , t.value= #{value}
  114. </if>
  115. where 1=1
  116. <if test="attrId !=null and attrId != ''">
  117. and t.attr_id= #{attrId}
  118. </if>
  119. <if test="bId !=null and bId != ''">
  120. and t.b_id= #{bId}
  121. </if>
  122. <if test="specCd !=null and specCd != ''">
  123. and t.spec_cd= #{specCd}
  124. </if>
  125. <if test="communityId !=null and communityId != ''">
  126. and t.community_id= #{communityId}
  127. </if>
  128. <if test="feeId !=null and feeId != ''">
  129. and t.fee_id= #{feeId}
  130. </if>
  131. </update>
  132. <!-- 查询费用属性数量 add by wuxw 2018-07-03 -->
  133. <select id="queryFeeAttrsCount" parameterType="Map" resultType="Map">
  134. select count(1) count
  135. from pay_fee_attrs t
  136. where 1 =1
  137. <if test="attrId !=null and attrId != ''">
  138. and t.attr_id= #{attrId}
  139. </if>
  140. <if test="specCd !=null and specCd != ''">
  141. and t.spec_cd= #{specCd}
  142. </if>
  143. <if test="statusCd !=null and statusCd != ''">
  144. and t.status_cd= #{statusCd}
  145. </if>
  146. <if test="communityId !=null and communityId != ''">
  147. and t.community_id= #{communityId}
  148. </if>
  149. <if test="bId !=null and bId != ''">
  150. and t.b_id= #{bId}
  151. </if>
  152. <if test="feeId !=null and feeId != ''">
  153. and t.fee_id= #{feeId}
  154. </if>
  155. <if test="value !=null and value != ''">
  156. and t.value= #{value}
  157. </if>
  158. </select>
  159. <!-- 批量插入费用 -->
  160. <insert id="saveFeeAttrs" parameterType="Map">
  161. insert into pay_fee_attrs (attr_id,status_cd,spec_cd,community_id,b_id,fee_id,value)
  162. VALUES
  163. <foreach collection="feeAttrPos" item="item" separator=",">
  164. (#{item.attrId},'0',#{item.specCd},#{item.communityId},'-1',#{item.feeId},#{item.value})
  165. </foreach>
  166. </insert>
  167. </mapper>