FeeConfigServiceDaoImplMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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="feeConfigServiceDaoImpl">
  5. <!-- 保存费用配置信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessFeeConfigInfo" parameterType="Map">
  7. insert into business_pay_fee_config(fee_type_cd, computing_formula, additional_amount, square_price, is_default,
  8. operate, config_id, fee_flag, fee_name,
  9. start_time, end_time, community_id, b_id, bill_type, payment_cd,
  10. payment_cycle, computing_formula_text, deduct_from)
  11. values (#{feeTypeCd}, #{computingFormula}, #{additionalAmount}, #{squarePrice}, #{isDefault}, #{operate},
  12. #{configId},
  13. #{feeFlag}, #{feeName}, #{startTime}, #{endTime}, #{communityId}, #{bId}, #{billType}, #{paymentCd},
  14. #{paymentCycle},
  15. #{computingFormulaText}, #{deductFrom})
  16. </insert>
  17. <!-- 查询费用配置信息(Business) add by wuxw 2018-07-03 -->
  18. <select id="getBusinessFeeConfigInfo" parameterType="Map" resultType="Map">
  19. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  20. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.square_price,t.square_price
  21. squarePrice,t.is_default,t.is_default isDefault,t.operate,t.config_id,t.config_id configId,t.fee_flag,t.fee_flag
  22. feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time startTime,t.end_time,t.end_time
  23. endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.bill_type,t.bill_type billType,
  24. t.payment_cd,t.payment_cycle,t.computing_formula_text,t.computing_formula_text
  25. computingFormulaText,t.deduct_from,t.deduct_from deductFrom
  26. from business_pay_fee_config t
  27. where 1 =1
  28. <if test="feeTypeCd !=null and feeTypeCd != ''">
  29. and t.fee_type_cd= #{feeTypeCd}
  30. </if>
  31. <if test="computingFormula !=null and computingFormula != ''">
  32. and t.computing_formula= #{computingFormula}
  33. </if>
  34. <if test="additionalAmount !=null and additionalAmount != '' or additionalAmount == 0">
  35. and t.additional_amount= #{additionalAmount}
  36. </if>
  37. <if test="squarePrice !=null and squarePrice != '' or squarePrice == 0">
  38. and t.square_price= #{squarePrice}
  39. </if>
  40. <if test="isDefault !=null and isDefault != ''">
  41. and t.is_default= #{isDefault}
  42. </if>
  43. <if test="operate !=null and operate != ''">
  44. and t.operate= #{operate}
  45. </if>
  46. <if test="configId !=null and configId != ''">
  47. and t.config_id= #{configId}
  48. </if>
  49. <if test="feeFlag !=null and feeFlag != ''">
  50. and t.fee_flag= #{feeFlag}
  51. </if>
  52. <if test="feeName !=null and feeName != ''">
  53. and t.fee_name like '%${feeName}%'
  54. </if>
  55. <if test="billType !=null and billType != ''">
  56. and t.bill_type= #{billType}
  57. </if>
  58. <if test="startTime !=null ">
  59. and t.start_time= #{startTime}
  60. </if>
  61. <if test="endTime !=null ">
  62. and t.end_time= #{endTime}
  63. </if>
  64. <if test="communityId !=null and communityId != ''">
  65. and t.community_id= #{communityId}
  66. </if>
  67. <if test="bId !=null and bId != ''">
  68. and t.b_id= #{bId}
  69. </if>
  70. <if test="deductFrom !=null and deductFrom != ''">
  71. and t.deduct_from = #{deductFrom}
  72. </if>
  73. </select>
  74. <!-- 保存费用配置信息至 instance表中 add by wuxw 2018-07-03 -->
  75. <insert id="saveFeeConfigInfoInstance" parameterType="Map">
  76. insert into pay_fee_config(
  77. fee_type_cd,computing_formula,additional_amount,status_cd,square_price,is_default,config_id,fee_flag,fee_name,
  78. start_time,end_time,community_id,b_id,bill_type,payment_cd,payment_cycle,computing_formula_text,deduct_from
  79. ) select
  80. t.fee_type_cd,t.computing_formula,t.additional_amount,'0',t.square_price,t.is_default,t.config_id,t.fee_flag,t.fee_name,
  81. t.start_time,t.end_time,t.community_id,
  82. t.b_id,t.bill_type,t.payment_cd,t.payment_cycle,t.computing_formula_text,t.deduct_from
  83. from business_pay_fee_config t where 1=1
  84. <if test="feeTypeCd !=null and feeTypeCd != ''">
  85. and t.fee_type_cd= #{feeTypeCd}
  86. </if>
  87. <if test="computingFormula !=null and computingFormula != ''">
  88. and t.computing_formula= #{computingFormula}
  89. </if>
  90. <if test="additionalAmount !=null and additionalAmount != ''">
  91. and t.additional_amount= #{additionalAmount}
  92. </if>
  93. <if test="squarePrice !=null and squarePrice != ''">
  94. and t.square_price= #{squarePrice}
  95. </if>
  96. <if test="isDefault !=null and isDefault != ''">
  97. and t.is_default= #{isDefault}
  98. </if>
  99. and t.operate= 'ADD'
  100. <if test="configId !=null and configId != ''">
  101. and t.config_id= #{configId}
  102. </if>
  103. <if test="feeFlag !=null and feeFlag != ''">
  104. and t.fee_flag= #{feeFlag}
  105. </if>
  106. <if test="feeName !=null and feeName != ''">
  107. and t.fee_name= #{feeName}
  108. </if>
  109. <if test="billType !=null and billType != ''">
  110. and t.bill_type= #{billType}
  111. </if>
  112. <if test="startTime !=null ">
  113. and t.start_time= #{startTime}
  114. </if>
  115. <if test="endTime !=null ">
  116. and t.end_time= #{endTime}
  117. </if>
  118. <if test="communityId !=null and communityId != ''">
  119. and t.community_id= #{communityId}
  120. </if>
  121. <if test="bId !=null and bId != ''">
  122. and t.b_id= #{bId}
  123. </if>
  124. </insert>
  125. <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
  126. <select id="getFeeConfigInfo" parameterType="Map" resultType="Map">
  127. select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
  128. computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
  129. statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
  130. configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
  131. startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
  132. td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
  133. t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle,
  134. t.computing_formula_text,t.computing_formula_text computingFormulaText,t.deduct_from,t.deduct_from
  135. deductFrom,td4.name computingFormulaName
  136. from pay_fee_config t
  137. left join t_dict td1 on t.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  138. td1.table_columns = 'fee_type_cd'
  139. left join t_dict td2 on t.fee_flag = td2.status_cd and td2.table_name = 'pay_fee_config' and td2.table_columns =
  140. 'fee_flag'
  141. left join t_dict td3 on t.bill_type = td3.status_cd and td3.table_name = 'pay_fee_config' and td3.table_columns
  142. = 'bill_type'
  143. left join t_dict td4 on t.computing_formula = td4.status_cd and td4.table_name = 'pay_fee_config' and
  144. td4.table_columns = 'computing_formula'
  145. where 1 = 1
  146. <if test="feeTypeCd !=null and feeTypeCd != ''">
  147. and t.fee_type_cd= #{feeTypeCd}
  148. </if>
  149. <if test="computingFormula !=null and computingFormula != ''">
  150. and t.computing_formula= #{computingFormula}
  151. </if>
  152. <if test="additionalAmount !=null and additionalAmount != ''">
  153. and t.additional_amount= #{additionalAmount}
  154. </if>
  155. <if test="statusCd !=null and statusCd != ''">
  156. and t.status_cd= #{statusCd}
  157. </if>
  158. <if test="squarePrice !=null and squarePrice != ''">
  159. and t.square_price= #{squarePrice}
  160. </if>
  161. <if test="isDefault !=null and isDefault != ''">
  162. and t.is_default= #{isDefault}
  163. </if>
  164. <if test="configId !=null and configId != ''">
  165. and t.config_id= #{configId}
  166. </if>
  167. <if test="feeFlag !=null and feeFlag != ''">
  168. and t.fee_flag= #{feeFlag}
  169. </if>
  170. <if test="feeName !=null and feeName != ''">
  171. and t.fee_name like '%${feeName}%'
  172. </if>
  173. <if test="feeNameEq !=null and feeNameEq != ''">
  174. and t.fee_name = #{feeNameEq}
  175. </if>
  176. <if test="startTime !=null ">
  177. and t.start_time= #{startTime}
  178. </if>
  179. <if test="endTime !=null ">
  180. and t.end_time= #{endTime}
  181. </if>
  182. <if test="valid !=null and valid == 1">
  183. and t.end_time &gt; now()
  184. </if>
  185. <if test="curTime !=null ">
  186. and t.end_time &gt; #{curTime}
  187. and t.start_time &lt; #{curTime}
  188. </if>
  189. <if test="communityId !=null and communityId != ''">
  190. and t.community_id= #{communityId}
  191. </if>
  192. <if test="bId !=null and bId != ''">
  193. and t.b_id= #{bId}
  194. </if>
  195. <if test="paymentCd !=null and paymentCd != ''">
  196. and t.payment_cd= #{paymentCd}
  197. </if>
  198. <if test="paymentCycle !=null and paymentCycle != ''">
  199. and t.payment_cycle= #{paymentCycle}
  200. </if>
  201. <if test="billType !=null and billType != ''">
  202. and t.bill_type= #{billType}
  203. </if>
  204. <if test="deductFrom !=null and deductFrom != ''">
  205. and t.deduct_from = #{deductFrom}
  206. </if>
  207. order by t.create_time desc
  208. <if test="page != -1 and page != null ">
  209. limit #{page}, #{row}
  210. </if>
  211. </select>
  212. <!-- 修改费用配置信息 add by wuxw 2018-07-03 -->
  213. <update id="updateFeeConfigInfoInstance" parameterType="Map">
  214. update pay_fee_config t set t.status_cd = #{statusCd}
  215. <if test="newBId != null and newBId != ''">
  216. ,t.b_id = #{newBId}
  217. </if>
  218. <if test="feeTypeCd !=null and feeTypeCd != ''">
  219. , t.fee_type_cd= #{feeTypeCd}
  220. </if>
  221. <if test="computingFormula !=null and computingFormula != ''">
  222. , t.computing_formula= #{computingFormula}
  223. </if>
  224. <if test="computingFormulaText !=null and computingFormulaText != ''">
  225. , t.computing_formula_text= #{computingFormulaText}
  226. </if>
  227. <if test="additionalAmount !=null and additionalAmount != '' or additionalAmount == 0">
  228. , t.additional_amount= #{additionalAmount}
  229. </if>
  230. <if test="squarePrice !=null and squarePrice != '' or squarePrice == 0">
  231. , t.square_price= #{squarePrice}
  232. </if>
  233. <if test="paymentCd !=null and paymentCd != ''">
  234. , t.payment_cd= #{paymentCd}
  235. </if>
  236. <if test="paymentCycle !=null and paymentCycle != ''">
  237. , t.payment_cycle= #{paymentCycle}
  238. </if>
  239. <if test="isDefault !=null and isDefault != ''">
  240. , t.is_default= #{isDefault}
  241. </if>
  242. <if test="feeFlag !=null and feeFlag != ''">
  243. , t.fee_flag= #{feeFlag}
  244. </if>
  245. <if test="feeName !=null and feeName != ''">
  246. , t.fee_name= #{feeName}
  247. </if>
  248. <if test="billType !=null and billType != ''">
  249. , t.bill_type= #{billType}
  250. </if>
  251. <if test="startTime !=null ">
  252. , t.start_time= #{startTime}
  253. </if>
  254. <if test="endTime !=null ">
  255. , t.end_time= #{endTime}
  256. </if>
  257. <if test="communityId !=null and communityId != ''">
  258. , t.community_id= #{communityId}
  259. </if>
  260. <if test="deductFrom !=null and deductFrom != ''">
  261. , t.deduct_from= #{deductFrom}
  262. </if>
  263. where 1=1
  264. <if test="configId !=null and configId != ''">
  265. and t.config_id= #{configId}
  266. </if>
  267. <if test="bId !=null and bId != ''">
  268. and t.b_id= #{bId}
  269. </if>
  270. </update>
  271. <!-- 查询费用配置数量 add by wuxw 2018-07-03 -->
  272. <select id="queryFeeConfigsCount" parameterType="Map" resultType="Map">
  273. select count(1) count
  274. from pay_fee_config t
  275. left join t_dict td1 on t.fee_type_cd = td1.status_cd and td1.table_name = 'pay_fee_config' and
  276. td1.table_columns = 'fee_type_cd'
  277. left join t_dict td2 on t.fee_flag = td2.status_cd and td2.table_name = 'pay_fee_config' and td2.table_columns =
  278. 'fee_flag'
  279. left join t_dict td3 on t.bill_type = td3.status_cd and td3.table_name = 'pay_fee_config' and td3.table_columns
  280. = 'bill_type'
  281. left join t_dict td4 on t.computing_formula = td4.status_cd and td4.table_name = 'pay_fee_config' and
  282. td4.table_columns = 'computing_formula'
  283. where 1 = 1
  284. <if test="feeTypeCd !=null and feeTypeCd != ''">
  285. and t.fee_type_cd= #{feeTypeCd}
  286. </if>
  287. <if test="computingFormula !=null and computingFormula != ''">
  288. and t.computing_formula= #{computingFormula}
  289. </if>
  290. <if test="additionalAmount !=null and additionalAmount != ''">
  291. and t.additional_amount= #{additionalAmount}
  292. </if>
  293. <if test="statusCd !=null and statusCd != ''">
  294. and t.status_cd= #{statusCd}
  295. </if>
  296. <if test="squarePrice !=null and squarePrice != ''">
  297. and t.square_price= #{squarePrice}
  298. </if>
  299. <if test="isDefault !=null and isDefault != ''">
  300. and t.is_default= #{isDefault}
  301. </if>
  302. <if test="configId !=null and configId != ''">
  303. and t.config_id= #{configId}
  304. </if>
  305. <if test="feeFlag !=null and feeFlag != ''">
  306. and t.fee_flag= #{feeFlag}
  307. </if>
  308. <if test="feeName !=null and feeName != ''">
  309. and t.fee_name like '%${feeName}%'
  310. </if>
  311. <if test="startTime !=null ">
  312. and t.start_time= #{startTime}
  313. </if>
  314. <if test="endTime !=null ">
  315. and t.end_time= #{endTime}
  316. </if>
  317. <if test="valid !=null and valid == 1">
  318. and t.end_time &gt; now()
  319. </if>
  320. <if test="communityId !=null and communityId != ''">
  321. and t.community_id= #{communityId}
  322. </if>
  323. <if test="bId !=null and bId != ''">
  324. and t.b_id= #{bId}
  325. </if>
  326. <if test="paymentCd !=null and paymentCd != ''">
  327. and t.payment_cd= #{paymentCd}
  328. </if>
  329. <if test="paymentCycle !=null and paymentCycle != ''">
  330. and t.payment_cycle= #{paymentCycle}
  331. </if>
  332. <if test="billType !=null and billType != ''">
  333. and t.bill_type= #{billType}
  334. </if>
  335. <if test="deductFrom !=null and deductFrom != ''">
  336. and t.deduct_from = #{deductFrom}
  337. </if>
  338. </select>
  339. <!-- 保存费用配置信息 add by wuxw 2018-07-03 -->
  340. <insert id="saveFeeConfig" parameterType="Map">
  341. insert into pay_fee_config(fee_type_cd, computing_formula, additional_amount, status_cd, square_price,
  342. is_default, config_id, fee_flag, fee_name,
  343. start_time, end_time, community_id, b_id, bill_type, payment_cd, payment_cycle,
  344. computing_formula_text, deduct_from)
  345. values (#{feeTypeCd}, #{computingFormula}, #{additionalAmount}, '0', #{squarePrice}, #{isDefault}, #{configId},
  346. #{feeFlag}, #{feeName}, #{startTime}, #{endTime}, #{communityId}, '-1', #{billType}, #{paymentCd},
  347. #{paymentCycle}, #{computingFormulaText}, #{deductFrom})
  348. </insert>
  349. </mapper>