ExpenseAccountDetailsMapper.xml 12 KB

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