ExpenseAccountDetailsMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.goafanti.common.dao.ExpenseAccountDetailsMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseAccountDetails">
  5. <id column="id" jdbcType="INTEGER" property="id" />
  6. <result column="eaid" jdbcType="INTEGER" property="eaid" />
  7. <result column="type" jdbcType="INTEGER" property="type" />
  8. <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
  9. <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
  10. <result column="start_district" jdbcType="VARCHAR" property="startDistrict" />
  11. <result column="end_district" jdbcType="VARCHAR" property="endDistrict" />
  12. <result column="amount" jdbcType="DECIMAL" property="amount" />
  13. <result column="vehicle" jdbcType="INTEGER" property="vehicle" />
  14. <result column="vehicle_other" jdbcType="VARCHAR" property="vehicleOther" />
  15. <result column="remarks" jdbcType="VARCHAR" property="remarks" />
  16. <result column="agree_time" jdbcType="TIMESTAMP" property="agreeTime" />
  17. <result column="pay_type" jdbcType="INTEGER" property="payType" />
  18. <result column="invoice_type" jdbcType="INTEGER" property="invoiceType" />
  19. <result column="invoice_no" jdbcType="VARCHAR" property="invoiceNo" />
  20. <result column="payer_name" jdbcType="VARCHAR" property="payerName" />
  21. <result column="open_bank" jdbcType="VARCHAR" property="openBank" />
  22. <result column="bank_accounts" jdbcType="VARCHAR" property="bankAccounts" />
  23. <result column="open_bank_address" jdbcType="VARCHAR" property="openBankAddress" />
  24. <result column="lend_id" jdbcType="INTEGER" property="lendId" />
  25. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  26. <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
  27. </resultMap>
  28. <sql id="Base_Column_List">
  29. id, eaid, `type`, start_time, end_time, start_district, end_district, amount, vehicle,
  30. vehicle_other, remarks, agree_time, pay_type, invoice_type, invoice_no, payer_name,
  31. open_bank, bank_accounts, open_bank_address, lend_id, create_time, real_amount
  32. </sql>
  33. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  34. select
  35. <include refid="Base_Column_List" />
  36. from expense_account_details
  37. where id = #{id,jdbcType=INTEGER}
  38. </select>
  39. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  40. delete from expense_account_details
  41. where id = #{id,jdbcType=INTEGER}
  42. </delete>
  43. <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccountDetails" useGeneratedKeys="true">
  44. insert into expense_account_details (eaid, `type`, start_time,
  45. end_time, start_district, end_district,
  46. amount, vehicle, vehicle_other,
  47. remarks, agree_time, pay_type,
  48. invoice_type, invoice_no, payer_name,
  49. open_bank, bank_accounts, open_bank_address,
  50. lend_id, create_time, real_amount
  51. )
  52. values (#{eaid,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, #{startTime,jdbcType=TIMESTAMP},
  53. #{endTime,jdbcType=TIMESTAMP}, #{startDistrict,jdbcType=VARCHAR}, #{endDistrict,jdbcType=VARCHAR},
  54. #{amount,jdbcType=DECIMAL}, #{vehicle,jdbcType=INTEGER}, #{vehicleOther,jdbcType=VARCHAR},
  55. #{remarks,jdbcType=VARCHAR}, #{agreeTime,jdbcType=TIMESTAMP}, #{payType,jdbcType=INTEGER},
  56. #{invoiceType,jdbcType=INTEGER}, #{invoiceNo,jdbcType=VARCHAR}, #{payerName,jdbcType=VARCHAR},
  57. #{openBank,jdbcType=VARCHAR}, #{bankAccounts,jdbcType=VARCHAR}, #{openBankAddress,jdbcType=VARCHAR},
  58. #{lendId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{realAmount,jdbcType=DECIMAL}
  59. )
  60. </insert>
  61. <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccountDetails" useGeneratedKeys="true">
  62. insert into expense_account_details
  63. <trim prefix="(" suffix=")" suffixOverrides=",">
  64. <if test="eaid != null">
  65. eaid,
  66. </if>
  67. <if test="type != null">
  68. `type`,
  69. </if>
  70. <if test="startTime != null">
  71. start_time,
  72. </if>
  73. <if test="endTime != null">
  74. end_time,
  75. </if>
  76. <if test="startDistrict != null">
  77. start_district,
  78. </if>
  79. <if test="endDistrict != null">
  80. end_district,
  81. </if>
  82. <if test="amount != null">
  83. amount,
  84. </if>
  85. <if test="vehicle != null">
  86. vehicle,
  87. </if>
  88. <if test="vehicleOther != null">
  89. vehicle_other,
  90. </if>
  91. <if test="remarks != null">
  92. remarks,
  93. </if>
  94. <if test="agreeTime != null">
  95. agree_time,
  96. </if>
  97. <if test="payType != null">
  98. pay_type,
  99. </if>
  100. <if test="invoiceType != null">
  101. invoice_type,
  102. </if>
  103. <if test="invoiceNo != null">
  104. invoice_no,
  105. </if>
  106. <if test="payerName != null">
  107. payer_name,
  108. </if>
  109. <if test="openBank != null">
  110. open_bank,
  111. </if>
  112. <if test="bankAccounts != null">
  113. bank_accounts,
  114. </if>
  115. <if test="openBankAddress != null">
  116. open_bank_address,
  117. </if>
  118. <if test="lendId != null">
  119. lend_id,
  120. </if>
  121. <if test="createTime != null">
  122. create_time,
  123. </if>
  124. <if test="realAmount != null">
  125. real_amount,
  126. </if>
  127. </trim>
  128. <trim prefix="values (" suffix=")" suffixOverrides=",">
  129. <if test="eaid != null">
  130. #{eaid,jdbcType=INTEGER},
  131. </if>
  132. <if test="type != null">
  133. #{type,jdbcType=INTEGER},
  134. </if>
  135. <if test="startTime != null">
  136. #{startTime,jdbcType=TIMESTAMP},
  137. </if>
  138. <if test="endTime != null">
  139. #{endTime,jdbcType=TIMESTAMP},
  140. </if>
  141. <if test="startDistrict != null">
  142. #{startDistrict,jdbcType=VARCHAR},
  143. </if>
  144. <if test="endDistrict != null">
  145. #{endDistrict,jdbcType=VARCHAR},
  146. </if>
  147. <if test="amount != null">
  148. #{amount,jdbcType=DECIMAL},
  149. </if>
  150. <if test="vehicle != null">
  151. #{vehicle,jdbcType=INTEGER},
  152. </if>
  153. <if test="vehicleOther != null">
  154. #{vehicleOther,jdbcType=VARCHAR},
  155. </if>
  156. <if test="remarks != null">
  157. #{remarks,jdbcType=VARCHAR},
  158. </if>
  159. <if test="agreeTime != null">
  160. #{agreeTime,jdbcType=TIMESTAMP},
  161. </if>
  162. <if test="payType != null">
  163. #{payType,jdbcType=INTEGER},
  164. </if>
  165. <if test="invoiceType != null">
  166. #{invoiceType,jdbcType=INTEGER},
  167. </if>
  168. <if test="invoiceNo != null">
  169. #{invoiceNo,jdbcType=VARCHAR},
  170. </if>
  171. <if test="payerName != null">
  172. #{payerName,jdbcType=VARCHAR},
  173. </if>
  174. <if test="openBank != null">
  175. #{openBank,jdbcType=VARCHAR},
  176. </if>
  177. <if test="bankAccounts != null">
  178. #{bankAccounts,jdbcType=VARCHAR},
  179. </if>
  180. <if test="openBankAddress != null">
  181. #{openBankAddress,jdbcType=VARCHAR},
  182. </if>
  183. <if test="lendId != null">
  184. #{lendId,jdbcType=INTEGER},
  185. </if>
  186. <if test="createTime != null">
  187. #{createTime,jdbcType=TIMESTAMP},
  188. </if>
  189. <if test="realAmount != null">
  190. #{realAmount,jdbcType=DECIMAL},
  191. </if>
  192. </trim>
  193. </insert>
  194. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccountDetails">
  195. update expense_account_details
  196. <set>
  197. <if test="eaid != null">
  198. eaid = #{eaid,jdbcType=INTEGER},
  199. </if>
  200. <if test="type != null">
  201. `type` = #{type,jdbcType=INTEGER},
  202. </if>
  203. <if test="startTime != null">
  204. start_time = #{startTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="endTime != null">
  207. end_time = #{endTime,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="startDistrict != null">
  210. start_district = #{startDistrict,jdbcType=VARCHAR},
  211. </if>
  212. <if test="endDistrict != null">
  213. end_district = #{endDistrict,jdbcType=VARCHAR},
  214. </if>
  215. <if test="amount != null">
  216. amount = #{amount,jdbcType=DECIMAL},
  217. </if>
  218. <if test="vehicle != null">
  219. vehicle = #{vehicle,jdbcType=INTEGER},
  220. </if>
  221. <if test="vehicleOther != null">
  222. vehicle_other = #{vehicleOther,jdbcType=VARCHAR},
  223. </if>
  224. <if test="remarks != null">
  225. remarks = #{remarks,jdbcType=VARCHAR},
  226. </if>
  227. <if test="agreeTime != null">
  228. agree_time = #{agreeTime,jdbcType=TIMESTAMP},
  229. </if>
  230. <if test="payType != null">
  231. pay_type = #{payType,jdbcType=INTEGER},
  232. </if>
  233. <if test="invoiceType != null">
  234. invoice_type = #{invoiceType,jdbcType=INTEGER},
  235. </if>
  236. <if test="invoiceNo != null">
  237. invoice_no = #{invoiceNo,jdbcType=VARCHAR},
  238. </if>
  239. <if test="payerName != null">
  240. payer_name = #{payerName,jdbcType=VARCHAR},
  241. </if>
  242. <if test="openBank != null">
  243. open_bank = #{openBank,jdbcType=VARCHAR},
  244. </if>
  245. <if test="bankAccounts != null">
  246. bank_accounts = #{bankAccounts,jdbcType=VARCHAR},
  247. </if>
  248. <if test="openBankAddress != null">
  249. open_bank_address = #{openBankAddress,jdbcType=VARCHAR},
  250. </if>
  251. <if test="lendId != null">
  252. lend_id = #{lendId,jdbcType=INTEGER},
  253. </if>
  254. <if test="createTime != null">
  255. create_time = #{createTime,jdbcType=TIMESTAMP},
  256. </if>
  257. <if test="realAmount != null">
  258. real_amount = #{realAmount,jdbcType=DECIMAL},
  259. </if>
  260. </set>
  261. where id = #{id,jdbcType=INTEGER}
  262. </update>
  263. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseAccountDetails">
  264. update expense_account_details
  265. set eaid = #{eaid,jdbcType=INTEGER},
  266. `type` = #{type,jdbcType=INTEGER},
  267. start_time = #{startTime,jdbcType=TIMESTAMP},
  268. end_time = #{endTime,jdbcType=TIMESTAMP},
  269. start_district = #{startDistrict,jdbcType=VARCHAR},
  270. end_district = #{endDistrict,jdbcType=VARCHAR},
  271. amount = #{amount,jdbcType=DECIMAL},
  272. vehicle = #{vehicle,jdbcType=INTEGER},
  273. vehicle_other = #{vehicleOther,jdbcType=VARCHAR},
  274. remarks = #{remarks,jdbcType=VARCHAR},
  275. agree_time = #{agreeTime,jdbcType=TIMESTAMP},
  276. pay_type = #{payType,jdbcType=INTEGER},
  277. invoice_type = #{invoiceType,jdbcType=INTEGER},
  278. invoice_no = #{invoiceNo,jdbcType=VARCHAR},
  279. payer_name = #{payerName,jdbcType=VARCHAR},
  280. open_bank = #{openBank,jdbcType=VARCHAR},
  281. bank_accounts = #{bankAccounts,jdbcType=VARCHAR},
  282. open_bank_address = #{openBankAddress,jdbcType=VARCHAR},
  283. lend_id = #{lendId,jdbcType=INTEGER},
  284. create_time = #{createTime,jdbcType=TIMESTAMP},
  285. real_amount = #{realAmount,jdbcType=DECIMAL}
  286. where id = #{id,jdbcType=INTEGER}
  287. </update>
  288. <select id="selectAmountCountByEAid" resultType="java.math.BigDecimal">
  289. select ifnull(sum(amount),0)amount from expense_account_details
  290. where eaid = #{id}
  291. </select>
  292. <select id="selectByEAid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountDetails">
  293. SELECT id, eaid, `type`, date_format(a.start_time,'%Y-%m-%d %H:%i:%S')startTimeStr, date_format(a.end_time,'%Y-%m-%d %H:%i:%S')endTimeStr,
  294. start_district startDistrict, end_district endDistrict, amount, vehicle, vehicle_other vehicleOther, remarks,
  295. date_format(a.agree_time,'%Y-%m-%d %H:%i:%S')agreeTimeStr, pay_type payType,invoice_type invoiceType, invoice_no invoiceNo,
  296. payer_name payerName, open_bank openBank, bank_accounts bankAccounts, open_bank_address openBankAddress, lend_id lendId,
  297. date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
  298. FROM expense_account_details a WHERE eaid= #{eaid}
  299. </select>
  300. <delete id="deleteByeaid">
  301. delete from expense_account_details
  302. where eaid = #{id}
  303. </delete>
  304. </mapper>