BankinformationMapper.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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.usoftchina.saas.document.mapper.BankinformationMapper" >
  4. <resultMap id="BaseResultMap" type="com.usoftchina.saas.document.entities.Bankinformation" >
  5. <id column="bk_id" property="id" jdbcType="INTEGER" />
  6. <result column="bk_bankcode" property="bk_bankcode" jdbcType="VARCHAR" />
  7. <result column="bk_bankname" property="bk_bankname" jdbcType="VARCHAR" />
  8. <result column="bk_date" property="bk_date" jdbcType="TIMESTAMP" />
  9. <result column="bk_type" property="bk_type" jdbcType="VARCHAR" />
  10. <result column="bk_beginamount" property="bk_beginamount" jdbcType="DOUBLE" />
  11. <result column="bk_thisamount" property="bk_thisamount" jdbcType="DOUBLE" />
  12. <result column="bk_status" property="bk_status" jdbcType="VARCHAR" />
  13. <result column="bk_statuscode" property="bk_statuscode" jdbcType="VARCHAR" />
  14. <result column="bk_ym" property="bk_ym" jdbcType="INTEGER" />
  15. <result column="companyid" property="companyId" jdbcType="INTEGER" />
  16. <result column="updaterId" property="updaterId" jdbcType="INTEGER" />
  17. <result column="updateTime" property="updateTime" jdbcType="TIMESTAMP" />
  18. <result column="bk_text1" property="bk_text1" jdbcType="VARCHAR" />
  19. <result column="bk_text2" property="bk_text2" jdbcType="VARCHAR" />
  20. <result column="bk_text3" property="bk_text3" jdbcType="VARCHAR" />
  21. <result column="bk_text4" property="bk_text4" jdbcType="VARCHAR" />
  22. <result column="bk_text5" property="bk_text5" jdbcType="VARCHAR" />
  23. <result column="bk_remark" property="bk_remark" jdbcType="VARCHAR" />
  24. <result column="bk_spending" property="bk_spending" jdbcType="DOUBLE" />
  25. <result column="bk_income" property="bk_income" jdbcType="DOUBLE" />
  26. </resultMap>
  27. <resultMap id="ResultMapWithBLOBs" type="com.usoftchina.saas.document.entities.Bankinformation" extends="BaseResultMap" >
  28. <result column="bk_remark" property="bk_remark" jdbcType="LONGVARCHAR" />
  29. </resultMap>
  30. <sql id="Base_Column_List" >
  31. bk_id, bk_bankcode, bk_bankname, bk_date, bk_type, bk_beginamount, bk_thisamount,
  32. bk_status, bk_statuscode, bk_ym, companyid,
  33. updaterId, updateTime, bk_text1, bk_text2, bk_text3, bk_text4, bk_text5, bk_remark
  34. </sql>
  35. <sql id="Blob_Column_List" >
  36. bk_remark
  37. </sql>
  38. <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
  39. select
  40. <include refid="Base_Column_List" />
  41. ,
  42. <include refid="Blob_Column_List" />
  43. from bankinformation
  44. where bk_id = #{id,jdbcType=INTEGER}
  45. </select>
  46. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  47. delete from bankinformation
  48. where bk_id = #{id,jdbcType=INTEGER}
  49. </delete>
  50. <insert id="insert" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  51. insert into bankinformation (bk_id, bk_bankcode, bk_bankname,
  52. bk_date, bk_type, bk_beginamount,
  53. bk_thisamount, bk_status, bk_statuscode,
  54. bk_ym, companyid, updaterId,
  55. updateTime, bk_text1, bk_text2,
  56. bk_text3, bk_text4, bk_text5,
  57. bk_remark,
  58. creatorId,createTime,creatorName)
  59. values (#{bk_bankcode,jdbcType=VARCHAR}, #{bk_bankname,jdbcType=VARCHAR},
  60. #{bk_date,jdbcType=TIMESTAMP}, #{bk_type,jdbcType=VARCHAR}, #{bk_beginamount,jdbcType=DOUBLE},
  61. #{bk_thisamount,jdbcType=DOUBLE}, #{bk_status,jdbcType=VARCHAR}, #{bk_statuscode,jdbcType=VARCHAR},
  62. #{bk_ym,jdbcType=INTEGER}, #{companyId,jdbcType=INTEGER}, #{updaterId,jdbcType=INTEGER},
  63. #{updateTime,jdbcType=TIMESTAMP}, #{bk_text1,jdbcType=VARCHAR}, #{bk_text2,jdbcType=VARCHAR},
  64. #{bk_text3,jdbcType=VARCHAR}, #{bk_text4,jdbcType=VARCHAR}, #{bk_text5,jdbcType=VARCHAR},
  65. #{bk_remark,jdbcType=LONGVARCHAR},
  66. #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{creatorName,jdbcType=VARCHAR})
  67. </insert>
  68. <insert id="insertSelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  69. insert into bankinformation
  70. <trim prefix="(" suffix=")" suffixOverrides="," >
  71. <if test="bk_bankcode != null" >
  72. bk_bankcode,
  73. </if>
  74. <if test="bk_bankname != null" >
  75. bk_bankname,
  76. </if>
  77. <if test="bk_date != null" >
  78. bk_date,
  79. </if>
  80. <if test="bk_type != null" >
  81. bk_type,
  82. </if>
  83. <if test="bk_beginamount != null" >
  84. bk_beginamount,
  85. </if>
  86. <if test="bk_thisamount != null" >
  87. bk_thisamount,
  88. </if>
  89. <if test="bk_status != null" >
  90. bk_status,
  91. </if>
  92. <if test="bk_statuscode != null" >
  93. bk_statuscode,
  94. </if>
  95. <if test="bk_ym != null" >
  96. bk_ym,
  97. </if>
  98. <if test="companyId != null" >
  99. companyid,
  100. </if>
  101. <if test="updaterId != null" >
  102. updaterId,
  103. </if>
  104. <if test="updateTime != null" >
  105. updateTime,
  106. </if>
  107. <if test="bk_text1 != null" >
  108. bk_text1,
  109. </if>
  110. <if test="bk_text2 != null" >
  111. bk_text2,
  112. </if>
  113. <if test="bk_text3 != null" >
  114. bk_text3,
  115. </if>
  116. <if test="bk_text4 != null" >
  117. bk_text4,
  118. </if>
  119. <if test="bk_text5 != null" >
  120. bk_text5,
  121. </if>
  122. <if test="bk_remark != null" >
  123. bk_remark,
  124. </if>
  125. <if test="bk_spending != null" >
  126. bk_spending,
  127. </if>
  128. <if test="bk_income != null" >
  129. bk_income,
  130. </if>
  131. <if test="creatorId != null" >
  132. creatorId,
  133. </if>
  134. <if test="createTime != null" >
  135. createTime,
  136. </if>
  137. <if test="creatorName != null" >
  138. creatorName,
  139. </if>
  140. </trim>
  141. <trim prefix="values (" suffix=")" suffixOverrides="," >
  142. <if test="bk_bankcode != null" >
  143. #{bk_bankcode,jdbcType=VARCHAR},
  144. </if>
  145. <if test="bk_bankname != null" >
  146. #{bk_bankname,jdbcType=VARCHAR},
  147. </if>
  148. <if test="bk_date != null" >
  149. #{bk_date,jdbcType=TIMESTAMP},
  150. </if>
  151. <if test="bk_type != null" >
  152. #{bk_type,jdbcType=VARCHAR},
  153. </if>
  154. <if test="bk_beginamount != null" >
  155. #{bk_beginamount,jdbcType=DOUBLE},
  156. </if>
  157. <if test="bk_thisamount != null" >
  158. #{bk_thisamount,jdbcType=DOUBLE},
  159. </if>
  160. <if test="bk_status != null" >
  161. #{bk_status,jdbcType=VARCHAR},
  162. </if>
  163. <if test="bk_statuscode != null" >
  164. #{bk_statuscode,jdbcType=VARCHAR},
  165. </if>
  166. <if test="bk_ym != null" >
  167. #{bk_ym,jdbcType=INTEGER},
  168. </if>
  169. <if test="companyId != null" >
  170. #{companyId,jdbcType=INTEGER},
  171. </if>
  172. <if test="updaterId != null" >
  173. #{updaterId,jdbcType=INTEGER},
  174. </if>
  175. <if test="updateTime != null" >
  176. #{updateTime,jdbcType=TIMESTAMP},
  177. </if>
  178. <if test="bk_text1 != null" >
  179. #{bk_text1,jdbcType=VARCHAR},
  180. </if>
  181. <if test="bk_text2 != null" >
  182. #{bk_text2,jdbcType=VARCHAR},
  183. </if>
  184. <if test="bk_text3 != null" >
  185. #{bk_text3,jdbcType=VARCHAR},
  186. </if>
  187. <if test="bk_text4 != null" >
  188. #{bk_text4,jdbcType=VARCHAR},
  189. </if>
  190. <if test="bk_text5 != null" >
  191. #{bk_text5,jdbcType=VARCHAR},
  192. </if>
  193. <if test="bk_remark != null" >
  194. #{bk_remark,jdbcType=LONGVARCHAR},
  195. </if>
  196. <if test="bk_spending != null" >
  197. #{bk_spending,jdbcType=DOUBLE},
  198. </if>
  199. <if test="bk_income != null" >
  200. #{bk_income,jdbcType=DOUBLE},
  201. </if>
  202. <if test="creatorId != null" >
  203. #{creatorId,jdbcType=INTEGER},
  204. </if>
  205. <if test="createTime != null" >
  206. #{createTime,jdbcType=TIMESTAMP},
  207. </if>
  208. <if test="creatorName != null" >
  209. #{creatorName,jdbcType=VARCHAR},
  210. </if>
  211. </trim>
  212. <selectKey resultType="Long" keyProperty="id" order="AFTER">
  213. SELECT LAST_INSERT_ID()
  214. </selectKey>
  215. </insert>
  216. <update id="updateByPrimaryKeySelective" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  217. update bankinformation
  218. <set >
  219. <if test="bk_bankcode != null" >
  220. bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR},
  221. </if>
  222. <if test="bk_bankname != null" >
  223. bk_bankname = #{bk_bankname,jdbcType=VARCHAR},
  224. </if>
  225. <if test="bk_date != null" >
  226. bk_date = #{bk_date,jdbcType=TIMESTAMP},
  227. </if>
  228. <if test="bk_type != null" >
  229. bk_type = #{bk_type,jdbcType=VARCHAR},
  230. </if>
  231. <if test="bk_beginamount != null" >
  232. bk_beginamount = #{bk_beginamount,jdbcType=DOUBLE},
  233. </if>
  234. <if test="bk_thisamount != null" >
  235. bk_thisamount = #{bk_thisamount,jdbcType=DOUBLE},
  236. </if>
  237. <if test="bk_status != null" >
  238. bk_status = #{bk_status,jdbcType=VARCHAR},
  239. </if>
  240. <if test="bk_statuscode != null" >
  241. bk_statuscode = #{bk_statuscode,jdbcType=VARCHAR},
  242. </if>
  243. <if test="bk_ym != null" >
  244. bk_ym = #{bk_ym,jdbcType=INTEGER},
  245. </if>
  246. <if test="companyId != null" >
  247. companyid = #{companyId,jdbcType=INTEGER},
  248. </if>
  249. <if test="updaterId != null" >
  250. updaterId = #{updaterId,jdbcType=INTEGER},
  251. </if>
  252. <if test="updateTime != null" >
  253. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  254. </if>
  255. <if test="bk_text1 != null" >
  256. bk_text1 = #{bk_text1,jdbcType=VARCHAR},
  257. </if>
  258. <if test="bk_text2 != null" >
  259. bk_text2 = #{bk_text2,jdbcType=VARCHAR},
  260. </if>
  261. <if test="bk_text3 != null" >
  262. bk_text3 = #{bk_text3,jdbcType=VARCHAR},
  263. </if>
  264. <if test="bk_text4 != null" >
  265. bk_text4 = #{bk_text4,jdbcType=VARCHAR},
  266. </if>
  267. <if test="bk_text5 != null" >
  268. bk_text5 = #{bk_text5,jdbcType=VARCHAR},
  269. </if>
  270. <if test="bk_remark != null" >
  271. bk_remark = #{bk_remark,jdbcType=LONGVARCHAR},
  272. </if>
  273. <if test="bk_income != null" >
  274. bk_income = #{bk_income,jdbcType=DOUBLE},
  275. </if>
  276. <if test="bk_spending != null" >
  277. bk_spending = #{bk_spending,jdbcType=DOUBLE},
  278. </if>
  279. </set>
  280. where bk_id = #{id,jdbcType=INTEGER}
  281. </update>
  282. <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.usoftchina.saas.document.entities.Bankinformation" >
  283. update bankinformation
  284. set bk_bankcode = #{bkBankcode,jdbcType=VARCHAR},
  285. bk_bankname = #{bkBankname,jdbcType=VARCHAR},
  286. bk_date = #{bkDate,jdbcType=TIMESTAMP},
  287. bk_type = #{bkType,jdbcType=VARCHAR},
  288. bk_beginamount = #{bkBeginamount,jdbcType=DOUBLE},
  289. bk_thisamount = #{bkThisamount,jdbcType=DOUBLE},
  290. bk_status = #{bkStatus,jdbcType=VARCHAR},
  291. bk_statuscode = #{bkStatuscode,jdbcType=VARCHAR},
  292. bk_ym = #{bkYm,jdbcType=INTEGER},
  293. companyid = #{companyId,jdbcType=INTEGER},
  294. updaterId = #{updaterId,jdbcType=INTEGER},
  295. updateTime = #{updateTime,jdbcType=TIMESTAMP},
  296. bk_text1 = #{bkText1,jdbcType=VARCHAR},
  297. bk_text2 = #{bkText2,jdbcType=VARCHAR},
  298. bk_text3 = #{bkText3,jdbcType=VARCHAR},
  299. bk_text4 = #{bkText4,jdbcType=VARCHAR},
  300. bk_text5 = #{bkText5,jdbcType=VARCHAR},
  301. bk_remark = #{bkRemark,jdbcType=LONGVARCHAR}
  302. where bk_id = #{bkId,jdbcType=INTEGER}
  303. </update>
  304. <select id="selectAll" resultMap="BaseResultMap">
  305. SELECT * FROM bankinformation
  306. </select>
  307. <select id="selectBankinformationBycondition" resultMap="BaseResultMap">
  308. select
  309. <include refid="Base_Column_List" />
  310. from bankinformation
  311. <where>
  312. <if test="con != null">
  313. ${con}
  314. </if>
  315. <if test="companyId != null">
  316. and bankinformation.companyId = #{companyId}
  317. </if>
  318. </where> order by bk_date desc, bk_id desc
  319. </select>
  320. <select id="getCombo" resultType="com.usoftchina.saas.commons.dto.ComboDTO">
  321. SELECT CONCAT(bk_bankcode,' ',bk_bankname) display,bk_bankname value FROM bankinformation WHERE COMPANYID=#{companyId}
  322. </select>
  323. <select id="selectBankcode" resultType="java.lang.String">
  324. select bk_bankcode from bankinformation where
  325. bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR} and companyId = #{companyId}
  326. </select>
  327. <select id="selectBankId" resultType="java.lang.Long">
  328. select bk_id from bankinformation where bk_bankcode = #{bk_bankcode,jdbcType=VARCHAR} and companyId = #{companyId}
  329. </select>
  330. <select id="selectamount" parameterType="java.lang.Long" resultType="java.lang.Double">
  331. select bk_beginamount from bankinformation where bk_id = #{bk_id,jdbcType=INTEGER}
  332. </select>
  333. <select id="check" parameterMap="checkParamMap" statementType="CALLABLE">
  334. CALL SP_LIMITBASE(?, ?, ?, ?,?)
  335. </select>
  336. <parameterMap id="checkParamMap" type="java.util.Map">
  337. <parameter property="v_type" jdbcType="VARCHAR" mode="IN" />
  338. <parameter property="v_id" jdbcType="INTEGER" mode="IN" />
  339. <parameter property="v_code" jdbcType="VARCHAR" mode="IN" />
  340. <parameter property="v_companyid" jdbcType="INTEGER" mode="IN" />
  341. <parameter property="v_res" jdbcType="VARCHAR" mode="OUT" />
  342. </parameterMap>
  343. <select id="validateCodeWhenInsert" resultType="int">
  344. select count(*) from bankinformation where bk_bankcode = #{code} and companyId =#{companyId}
  345. </select>
  346. <select id="validateCodeWhenUpdate" resultType="int" >
  347. select count(*) from bankinformation where bk_bankcode = #{code} and bk_id != #{id} and companyId =#{companyId}
  348. </select>
  349. </mapper>